0% found this document useful (0 votes)
29 views11 pages

Programmable Logic Controllers: Shift and Sequencer Instructions

The document discusses programmable logic controller instructions for bit shifting and sequencing. It describes: 1) Bit shift instructions (BSL, BSR) that allow basic shift and rotate operations on bit arrays up to 2048 bits. 2) Sequencer instructions (SQO, SQC, SQL) that are useful for outputting or comparing a sequence of data on a recurring basis through files of up to 255 words. 3) Parameters for the instructions including file addresses, control structures, status bits, bit/word positions, and lengths. Examples are provided for using the BSL, SQO, and SQC instructions.

Uploaded by

احمدميدو
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views11 pages

Programmable Logic Controllers: Shift and Sequencer Instructions

The document discusses programmable logic controller instructions for bit shifting and sequencing. It describes: 1) Bit shift instructions (BSL, BSR) that allow basic shift and rotate operations on bit arrays up to 2048 bits. 2) Sequencer instructions (SQO, SQC, SQL) that are useful for outputting or comparing a sequence of data on a recurring basis through files of up to 255 words. 3) Parameters for the instructions including file addresses, control structures, status bits, bit/word positions, and lengths. Examples are provided for using the BSL, SQO, and SQC instructions.

Uploaded by

احمدميدو
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Programmable Logic

Controllers
Shift and Sequencer Instructions

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-1

Application Specific Instructions


Bit Shift Instructions Allows for basic
shift and rotate operations
Bit Shift Left (BSL)
Bit Shift Right (BSR)

Sequencer Instructions Useful for


outputting or comparing a sequence of
data on a recurring basis
Sequencer Output (SQO)
Sequencer Compare (SQC)
Sequencer Load (SQL)

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-2

9-1

Bit Shift Instructions Overview


Entering Parameters
File is the address of the bit array you want to manipulate. You
must use the file indicator (#) in the bit array address.
Control is the control element that stores the status byte of the
instruction and the size of the array (in number of bits).
Note that the control address should not be used for any other
instruction.
The control element is shown below.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-3

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.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-4

9-2

Bit Address and Array Length


Bit Address is the address of the source bit that the
instruction inserts in the first (lowest) bit position
(BSL) or the last (highest) bit position (BSR).
Length (size of bit array) is the number of bits in
the bit array, up to 2048 bits.
A length value of 0 causes the input bit to be
transferred to the UL bit.
For SLC processors, the length is 2048.
For MicroLogix 1000 series controllers, this length is 1680.

A length value that points past the end of the


programmed file causes a runtime major error to
occur.
Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-5

Bit Shift Left (BSL) and Bit Shift


Right (BSR)
BSL and BSR are output
instructions that load
data into a bit array one
bit at a time.
The data is shifted
through the array, then
unloaded one bit at a
time.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-6

9-3

Bit Shift Left Instruction

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-7

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

Dr. D. J. Jackson Lecture 9-8

9-4

BSR Example

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-9

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

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-10

9-5

Sequencer Output and Compare


When the rung transfers from
false-to-true the instruction is
incremented to the next step in
the sequencer file.
Data from the sequencer file is
then transferred through a mask
and into the destination address
specified in the command.
The data is updated during each
scan that the rung remains true.
When the last word in the
sequencer file is transferred the
done bit is set.
On the next transition from
false-to-true for the rung the
instruction is reset to step one

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-11

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.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-12

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.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-13

Sequencer Status Bits


CONTROL

The control parameter is a structure to store the: status byte


of the instruction, length of the sequencer file, and the
instantaneous position in the file. The control address can
not be used for any other instruction.
Error Bit ER (11)

This bit is set when the processor detects a negative position


value, or a negative or zero length value. This results in a major
error if not cleared before the END or TND instruction is
executed.

Done Bit DN (bit 13)

The done bit is set by SQO instruction after it has operated on


the last word in the sequencer file. It is reset on the next falseto-true rung transition after the rung goes false.

Enable EN (bit 15)

The enable bit is set by a false-to-true rung transition and


indicates the SQO instruction is enabled.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-14

9-7

Sequencer Status Bits (continued)


LENGTH
The length is the number of steps of the sequencer file
starting at position 1
The maximum number of words is 255 (in MicroLogix 1000
controllers the maximum is 104 words)
The zero position is the startup position
At the end of each cycle the instruction resets to position 1
(A run time major error will occur if the length value points
past the end of the programmed file)

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

Dr. D. J. Jackson Lecture 9-15

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

Dr. D. J. Jackson Lecture 9-16

9-8

Using SQO (continued)


If the position is equal to zero at startup, when you
switch the processor from the program mode to the
run mode instruction operation depends on whether
the rung is true or false on the first scan
If true, the instruction transfers the value in step zero
If false, the instruction waits for the first rung transition
from false-to-true and transfers the value in step one

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

The mask can be a constant or taken from an


address
Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-17

SQO Example

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-18

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.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-19

Sequencer Load (SQL)


The SQL instruction
stores 16-bit data into a
sequencer load file at
each step of sequencer
operation. The source of
this data can be
an I/O or storage word
address,
a file address,
or a constant.

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-20

9-10

SQL Operation

Electrical & Computer Engineering

Dr. D. J. Jackson Lecture 9-21

9-11

You might also like