Shift and Rotate Instructions
Statement List (STL) for S7-300 and S7-400 Programming
11-18
A5E00706960-01
Examples
Contents ACCU1-H ACCU1-L
Bit 31 . . . . . . . . . . 16 15 . . . . . . . . . . 0
before execution of RRD 4
0101 1111 0110 0100 0101 1101 0011 1011
after execution of RRD 4
1011 0101 1111 0110 0100 0101 1101 0011
Example 1
STL Explanation
L MD2 //Load value into ACCU 1.
RRD 4
//Rotate bits in ACCU 1 four places to the right
.
T MD8 //Transfer result to MD8.
Example 2
STL Explanation
L +3 //Load value +3 into ACCU 1.
L MD20 //Load contents of ACCU 1 into ACCU 2. Load value of MD20 into ACCU 1.
RRD //Rotation number is value of ACCU 2- L- L => Rotate bits in ACCU 1 three places
to the right
.
JP NEXT //Jump to NEXT jump label if the bit rotated out last (CC 1) = 1.
Comments to this Manuals