Program instructions
7.14 Shift and rotate
S7-200 SMART
System Manual, 09/2015, A5E03822230-AC
317
Example: Shift and Rotate instructions
LD I4.0
RRW AC0, 2
SLW VW200, 3
The Shift Register Bit instruction shifts a bit value into the Shift Register. This instruction
provides an easy method for sequencing and controlling product flow or data. Use this
instruction to shift the entire register one bit, once per scan.
S_bit, N
The shift register bit instruction shifts the bit value of DATA into the Shift Register.
S_BIT assigns the location of the least significant bit of the shift register. N assigns
the length of the Shift Register and the direction of the shift (Shift Plus = N, Shift
Minus = -N).
Each bit value shifted out by the SHRB instruction is copied to the overflow memory
bit SM1.1.
The shift register bits are defined by both the least significant bit S_BIT location and
the number of bits assigned by the length N.