25 bit_set@ function, 26 bit_clr@ function, 27 bit_modify@ function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 98

7Ć10
7.25
BIT_SET@ Function
Format:
BIT_SET@(variable,bitĆnumber)
where:
variable is a single or double integer variable
bitĆnumber is the bit number within the variable to test (0 to 15
for single integer; 0 to 31 for double integer).
This function tests the value of a bit within the variable as specified
by the bitĆnumber. If the bit is set to a value of one (1), the boolean
result of the function is TRUE. If the value of the bit is zero (0), the
result of the function is FALSE. This function does not change the
state of a bit; it simply tests it.
BIT_VALS% = 012A2H:!ăăă(BIT_VALS% = 0001 0010 1010
0010)
IF BIT_SET@(BIT_VALS%,1) THEN 250
In this example, the `IF' statement will take the branch to line 250
because the condition is TRUE. The value of bit 1 of
BIT_VALS% is TRUE or 1.
7.26
BIT_CLR@ Function
Format:
BIT_CLR@(variable, bit_number)
where:
variable is a single or double integer variable.
bit_number is the bit number within the variable to test (0 to 15
for single integer; 0 to 31 for double integer).
This function tests the value of a bit within the variable as specified
by the bitĆnumber. If the bit is clear or a value of zero (0), the
boolean result of the function is TRUE. If the value of the bit is one
(1), the result of the function is FALSE. This function does not
change the state of a bit; it simply tests it.
BIT_VALS% = 1128H:! ăă(BIT_VALS% = 0001 0001 0010 1000)
IF BIT_CLR@(BIT_VALS%,2) THEN 250
In this example, the `IF' statement will take the branch to line 250
because the condition of the bit test was TRUE. (The bit was clear or
equal to zero.) The value of bit 2 of BIT_VALS% is FALSE; however,
the entire function is TRUE if the value of the bit is zero, so the
function is TRUE.
7.27
BIT_MODIFY@ Function
Format:
BIT_ MODIFY@(variable, bit_number,option)
where:
variable is a single or double integer variable.
bit_number is the bit number within the variable to test.
(0 to 15 if single integer; 0 to 31 if double integer variable).