Program instructions
7.14 Shift and rotate
S7-200 SMART
360 System Manual, V2.3, 07/2017, A5E03822230-AF
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.
Non-fatal errors with ENO = 0
• 0006H Indirect address
• 0091H Operand out of range
• 0092H Error in count field
• SM1.1 Overflow (last bit shifted out)
I, Q, V, M, SM, S, T, C, L
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
Use the following equation to compute the address of the most significant bit of the Shift
Register (MSB.b):
MSB.b =
[(Byte of S_BIT) + ([N] - 1 + (bit of S_BIT)) / 8]
.
[remainder of the division by 8]
For example: if S_BIT is V33.4 and N is 14, the following calculation shows that the MSB.b is
V35.1.
- 1 +4)/8
= V33 + 2 with a remainder of 1