4
4-43GFK-0804B Chapter 4 The Micro PLC Instruction Set
Shift Register Left
Each scan, the Shift Register Left function shifts all the bits in a register to the left (that is,
toward the most significant bit). The number of positions to be shifted is provided in the
function’s second register (R2 in the example above).
The data is copied to the register specified (R3 in the example above). The original data is
not altered. In the copied data, the specified number of bits is “shifted out” on the left,
and a corresponding number of zeros is moved in on the right.
Example
For this example, if the second register (R2) contained the value 1, the bits would be
shifted left by 1 position:
0 0 0 0 0 0 0 0 1 1 1 1 1 0 1 0
R1
(250)
SHL
R3
0 0 0 0 0 0 0 1 1 1 1 1 0 1 0 0
(500)
46151
Entering the Number of Positions to Shift
The best way to enter the number of positions for the shift into the second register is
with a Move command in the application program. Alternatively, you could use the
programmer to manually place the number into a retentive register.
Programming Software Instructions
1. Select Logic (F7)
2. Select SH–REG LEFT (F6) from the Logic function keys.
3. Enter the register location of the data to be shifted left. Press the Enter key.
4. Enter the register location for the number of bits to shift. Press the Enter key.
5. Enter a register for shifted data to be placed in. Press the Enter key.
Example and HHP Instructions
Ladder Diagram Hand-held Programmer
START
LOGIC
OUT
F1
More MENU
F3
F1
I1
R1
R2
R3
[ R1 H R2! R3]
L
S
I1
"
46152