Shift Register Bit - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

Program instructions
7.14 Shift and rotate
7.14.2

Shift register bit

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

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents