280 Programmable Logic Controllers: Hardware and Programming
Figure 13-8 displays the ladder diagram of a bit shift left instruc-
tion for the Allen-Bradley SLC 500 series PLC. When a bit shift left
(BSL) instruction is energized, it shifts a bit to the left for every pro-
gram scan. In this example, the input pushbutton is used to energize
the bit shift left instruction. Therefore, the pushbutton must be pressed
to energize the BSL instruction.
The B3 or B10 file can be used to contain the bits to be shifted. In
Figure 13-8, bit data file B3 contains the bits. The bit address for a BSL
instruction is the bit in the starting position. The number of bits that
are shifted determines the length. The bit where the last shifted bit
exits is called the unload bit.
In Figure 13-8, the bit address is B3/0 or B3:0/0 and the length is
seven. Therefore, bits B3/0, B3/1, B3/2, B3/3, B3/4, B3/5, and B3/6 are
shifted to the left. The last bit (the bit address) exits and can reenter
at the bit on the beginning of the length (B3:0/0). This is done if you
have instructions similar to that in rung 0002 of the ladder logic dia-
gram in Figure 13-8. Note that the unload bit (R6:0/UL) is placed onto
bit B3:0/0.
0000
0001 End
XOR
Bitwise exclusive OR
Source A I:1.0
C717h
Source B I:2.0
658Eh
Dest O:3.0
A299h
Example 13-1
Figure 13-6. PLC ladder logic diagram for Example 13-1.
Figure 13-7. Input and output files for Example 13-1.
Bit shift left (BSL)
instruction:
Instruction that shifts the
bits in the data file to the
left once for every low-
to-high transition on its
input.
Bit address:
Parameter in the BSL
and BSR instructions
that indicate the starting
bit position.
Length:
Parameter in the BSL
and BSR instructions
that indicate the number
of bits to be shifted.
Previous Page Next Page