Chapter 4. Ladder Diagram (LD) Programming
GFK-2950C
February 2018
81
4.2.9
Rotate Bits
Mnemonics:
ROL_DWORD
ROL_WORD
ROR_DWORD
ROR_WORD
When receiving power flow, the Rotate Bits Right (ROR_DWORD and ROR_WORD) and Rotate Bits
Left (ROL_DWORD and ROL_WORD) functions rotate all the bits in a string of WORDs or DWORDs N
positions respectively to the right or to the left. When rotation occurs, the specified number of bits is
rotated out of the input string respectively to the right or to the left and back into the string on the
other side.
The Rotate Bits function passes power flow to the right, unless the number of bits to rotate is less
than 0, or is greater than the total length of the string. The result is placed in output string Q. If you
want the input string to be rotated, the output parameter Q must use the same memory location as
the input parameter IN. The entire rotated string is written on each scan that power is received.
A string length of 1 to 256 words or double words can be specified.
Operands for Rotate Bits
Parameter Description
Allowed Operands
Optional
Length (??) The number of WORDs or DWORDs in the
string to be rotated. 1
Length
256.
Constant
No
IN
The string to rotate
All. Constants are legal when Length is 1
No
N
The number of positions to rotate. 0
≤
N
≤
Length.
All except variables in %S - %SC memories No
Q
The resulting rotated string
All except constants and variables in %S
memory
No
Example
Whenever input V_I0001 is set, the input bit string in
location
%R0001 is rotated left 3 bits and the result is placed
in
%R00002. The actual input bit string %R0001 is left
unchanged.
If the same reference had been used for IN and Q, a
rotation
would have occurred in place.
MSB
%R0001
MSB
%R0002 (after %I00001 is set)
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...