# SETON

You can use the SETON function to "turn on" a specific bit in a binary number. SETON sets the specified bit in the number to "1".

Syntax:
SETON ( single-binary-number-expression, single-integer-expression )
Meaning:
SETON ( binary_number_to_change, bit_to_turn_on )
Returns:
A single binary number

SETON uses the value of bit_to_turn_on to specify the bit of binary_number_to_change that should be set to the value 1. The result is a binary number item of the same size as binary_number_to_change.

Bit_to_turn_on represents the position of the single bit in binary_number_to_change to be set on. (Bits are numbered from left to right, with the leftmost bit being bit 1.) If bit_to_turn_on is less than one or greater than the number of bits of binary_number_to_change, SETON returns binary_number_to_change, unchanged.

## Examples

• SETON ( A , 15 )

In this example, assume A is the two-byte binary value of 1 (which is all zeros except for bit 16). The binary representation of the value in A is 0001.

The function returns the two-byte binary value, 0011, which is the decimal value of 3.

• SETON ( A , 40 )

Returns the two-byte binary value of 1-the original value of A- because bit 40 does not exist in A.