28 shiftl% function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual
Page 99

7Ć11
option defines the change to be made to the bit and may be an
integer or boolean expression.
This function tests the variable as specified by the bit_number.
Based on that value, the bit within the variable will be modified:
0 = Unconditionally clear the bit (set to 0)
1 = Unconditionally set the bit to 1
2 = If the bit is already zero, set it to 1
3 = If the bit is 1, clear the bit (set to 0).
The function itself is a boolean function and not an integer function.
Therefore, the value that it returns is not the updated value of the
variable modified but the status of the bit change operation. The
return status of the function is TRUE if the requested bit change
operation was completed or FALSE if the requested bit change
operation was not completed.
Two conditions will stop a request from being completed. The first is
that the variable is in a forced condition and the bits cannot be
modified. The second is that the requested change is already the
current state of the bit.
If the request is to clear a bit if it is set and the current state of the bit
is already cleared, the function status will be FALSE because the
operation was not completed, i.e., there was no need to make the
change. This tells the user the state of the bit prior to the bit modify
operation. Unless the variable is forced, options 0 and 1 will always
return a TRUE function status since they are unconditional
operations.
Boolean values can be used as the option number for the function.
This will result in an option 0 if the boolean is FALSE or in an option
1 if the boolean is TRUE. This can be used to change the state of a
bit to match another boolean.
For example:
IF NO_FAULTS@ THEN SYSTEM_RUNNING@ = TRUE
BIT_VALS% = 0005H
ąą.
ąą.
ąą.
IF BIT_MODIFY@(BIT_VALS%,2,SYSTEM_RUNNING@) THEN
300
In this example, bit 2 of BIT_VALS% will be given the same value as
the boolean SYSTEM_RUNNING@.
7.28
SHIFTL% Function
Format:
SHIFTL%(variable, shift_count)
where:
variable is a single or double integer variable.
shift_count is the number of bit positions to shift the integer
expression (0 to 15 for single integer; 0 to 31 for double integer).
This function returns an integer value, equal to the integer
expression that was input, shifted the specific number of binary