9953330565 Low Rate Call Girls In Rohini Delhi NCR
Lect09
1. 9-1
Dr. D. J. Jackson Lecture 9-1Electrical & Computer Engineering
Programmable Logic
Controllers
Shift and Sequencer Instructions
Dr. D. J. Jackson Lecture 9-2Electrical & Computer Engineering
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)
2. 9-2
Dr. D. J. Jackson Lecture 9-3Electrical & Computer Engineering
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.
Dr. D. J. Jackson Lecture 9-4Electrical & Computer Engineering
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.
3. 9-3
Dr. D. J. Jackson Lecture 9-5Electrical & Computer Engineering
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.
Dr. D. J. Jackson Lecture 9-6Electrical & Computer Engineering
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.
4. 9-4
Dr. D. J. Jackson Lecture 9-7Electrical & Computer Engineering
Bit Shift Left Instruction
Dr. D. J. Jackson Lecture 9-8Electrical & Computer Engineering
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.
5. 9-5
Dr. D. J. Jackson Lecture 9-9Electrical & Computer Engineering
BSR Example
Dr. D. J. Jackson Lecture 9-10Electrical & Computer Engineering
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
6. 9-6
Dr. D. J. Jackson Lecture 9-11Electrical & Computer Engineering
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
Dr. D. J. Jackson Lecture 9-12Electrical & Computer Engineering
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.
7. 9-7
Dr. D. J. Jackson Lecture 9-13Electrical & Computer Engineering
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.
Dr. D. J. Jackson Lecture 9-14Electrical & Computer Engineering
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 false-
to-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.
8. 9-8
Dr. D. J. Jackson Lecture 9-15Electrical & Computer Engineering
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)
Dr. D. J. Jackson Lecture 9-16Electrical & 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-to-
true rung transition, the instruction resets the
position to step one
9. 9-9
Dr. D. J. Jackson Lecture 9-17Electrical & Computer Engineering
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
Dr. D. J. Jackson Lecture 9-18Electrical & Computer Engineering
SQO Example
10. 9-10
Dr. D. J. Jackson Lecture 9-19Electrical & Computer Engineering
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.
Dr. D. J. Jackson Lecture 9-20Electrical & Computer Engineering
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.
11. 9-11
Dr. D. J. Jackson Lecture 9-21Electrical & Computer Engineering
SQL Operation