
16-6
Ladder Logic (LAD) for S7-300 and S7-400
C79000-G7076-C504-02
A signal state of 1 at the Enable (EN) input activates the Shift Right Double
Word instruction. This instruction shifts bits 0 to 31 of input IN bit by bit to
the right. Input N specifies the number of bits by which to shift. If N is larger
than 32, the command writes a 0 in output 0 and resets the CC 0 and OV bits
of the status word to 0. The bit positions at the left are padded with zeros.
The result of the shift operation can be scanned at output OUT.
The operation triggered by this instruction always resets the OV bit of the
status word to 0. If the box is executed (EN = 1), ENO shows the signal state
of the bit shifted last (same as CC 1 and RLO in the status word). The result
is that other functions following this box that are connected by the ENO
(cascade arrangement) are not executed if the bit shifted last had a signal
state of 0.
Certain restrictions apply to the placement of the Shift Right Double Word
box (see Section 6.1).
1 1 1
31... ...16 15... ...0
1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1
0 1 0 1
0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1
3 places
The vacated places
are filled with zeros.
The signal state of the bit that is
shifted out last is stored in bit
CC 1 of the status word (same
as the signal state of ENO).
These two
bits are lost.
IN
N
OUT
Parameters:
Figure 16-4 Shifting Bits of Input IN Three Bits to the Right
Table 16-4 Shift Right Double Word Box and Parameters
LAD Box
Parameter Data Type Memory Area Description
EN BOOL I, Q, M, D, L Enable input
_
EN ENO
ENO BOOL I, Q, M, D, L Enable output
IN
T
IN DWORD I, Q, M, D, L Value to shift
N
N WORD I, Q, M, D, L Number of bit positions by which to shift
OUT DWORD I, Q, M, D, L Result of shift operation
Shift Right Double
Word
Shift and Rotate Instructions
Comentarios a estos manuales