Programmable Logic Controllers: Shift and Sequencer Instructions
Programmable Logic Controllers: Shift and Sequencer Instructions
Controllers
Shift and Sequencer Instructions
9-1
Status Bits
Status bits of the control element may be addressed by
mnemonic (UL, ER, DN, EN). They include:
Unload Bit UL (bit 10) stores the status of the bit exited from
the array each time the instruction is enabled.
Error Bit ER (bit 11), when set, indicates the instruction
detected an error such as entering a negative number for the
length or position. Avoid using the output bit when this bit is
set.
Done Bit DN (bit 13), when set, indicates the bit array has
shifted one position.
Enable Bit EN (bit 15) is set on a false-to-true transition of the
rung and indicates the instruction is enabled.
When the register shifts and input conditions go false, the
enable, done, and error bits are reset.
9-2
9-3
Using BSL
When the rung goes from false-to-true, the
processor sets the enable bit (EN bit 15) and
the data block is shifted to the left (to a
higher bit number) one bit position.
The specified bit at the bit address is shifted
into the first bit position.
The last bit is shifted out of the array and
stored in the unload bit (UL bit 10).
For wraparound operation, set the position of
the bit address to the last bit of the array or
to the UL bit.
Electrical & Computer Engineering
9-4
BSR Example
Sequencer Instructions
These instructions transfer 16-bit data to
word addresses for the control of sequential
machine operations
Essentially these instructions provide a
capability for implementing multi-bit state
machines
An example use is in the traffic control light
problem
9-5
Sequencer Parameters
Entering Parameters
File is the address of the sequencer file. You must use the file
indicator (#) for this address.
Mask (SQO, SQC) is a hexadecimal code or the address of the
mask word or file through which the instruction moves data.
Set mask bits to pass data and reset mask bits to mask data.
If the mask is a file, its length will be equal to the length of the
sequencer file.
The two files track automatically.
Source is the address of the input word or file for a SQC from
which the instruction obtains data for comparison to its
sequencer file.
Destination is the address of the output word or file for a SQO
to which the instruction moves data from its sequencer file.
9-6
Sequencer Control
Control (SQO, SQC) is the control structure that stores the
status byte of the instruction,
the length of the sequencer file,
and the instantaneous position in the file.
You should not use the control address for any other
instruction.
9-7
POSITION
The position is the word location or step the sequencer file
from/to which the instruction moves data (A run time major
error occurs if the position value points past the end of the
programmed file)
Electrical & Computer Engineering
Using SQO
This output instruction steps through the sequencer
file whose bits have been set to control various
output devices
When the rung goes from false-to-true, the
instruction increments to the next step (word) in the
sequencer file
Data stored there is transferred through a mask to
the destination address specified in the instruction
Current data is written to the corresponding
destination word every scan that the rung remains
true
The done bit is set when the last word of the
sequencer file is transferred. On the next false-totrue rung transition, the instruction resets the
position to step one
Electrical & Computer Engineering
9-8
The bits mask data when reset and pass data when
set
The instruction will not change the value in the destination
word unless you set mask bits
SQO Example
9-9
SQC Instruction
Applications of the SQC
instruction include machine
diagnostics.
SQC FD bit is set when the
instruction detects that an
input word matches (through
mask) its corresponding
reference word.
The FD bit R6:21/FD is set in
this example, since the input
word matches the sequencer
reference value using the
mask value.
9-10
SQL Operation
9-11