Bit Operation Functions Rotate Bits Right, Rotate Bits Left - GE VersaMax PLC User Manual

Table of Contents

Advertisement

Input/ Output
enable
IN
N
B1
B2
Q
Instruction Set Reference
For public disclosure
The function passes power flow to the right, unless the number of bits specified to be
shifted is zero. Output Q is the shifted copy of the input string. If you want the input
string to be shifted, the output parameter Q must use the same memory location as the
input parameter IN. The entire shifted string is written on each scan that power is
received. Output B2 is the last bit shifted out. For example, if four bits were shifted, B2
would be the fourth bit shifted out.
10.1.6.1 Parameters of the Shift Right / Left Functions
Choices
flow
I, Q, M, T, S, G, R, AI, AQ
I, Q, M, T, G, R, AI, AQ,
constant
flow
flow, none
I, Q, M, T, SA, SB, SC, G,
R, AI, AQ
10.1.7 Bit Operation Functions Rotate Bits Right,
Rotate Bits Left
The Rotate Left function rotates all the bits in a string a specified number of places to the
left. When rotation occurs, the specified number of bits is rotated out of the input string to
the left and back into the string on the right.
The Rotate Right function rotates the bits in the string to the right. When rotation occurs,
the specified number of bits is rotated out of the input string to the right and back into the
string on the left.
A length of 1 to 256 words can be selected for either function. The number of places to
rotate must be more than zero and less than the number of bits in the string.
The Rotate Bits function passes power flow to the right, unless the number of bits
specified to be rotated is greater than the total length of the string or is less than zero. 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.
Enable
Word to be rotated
Number of bits
Description
When the function is enabled, the shift is
performed.
IN contains the first word to be shifted.
N contains the number of places (bits) that the
array is to be shifted.
B1 contains the bit value to be shifted into the
array.
B2 contains the bit value of the last bit shifted out
of the array.
Output Q contains the first word of the shifted
array.
ROL
OK
WORD
Output
IN
Q
N
GFK-1503E User Manual 129

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents