Docsity

Understanding Bit Shift and Sequencer Instructions in PLCs, Slides of Programmable Logic Controllers

Toggle sidebar
bg1
9-1
Programmable Logic
Controllers
Application Specific Instructions
Dr. D. J. Jackson Lecture 9-1Electrical & 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
Dr. D. J. Jackson Lecture 9-2Electrical & Computer Engineering
–Sequencer Output (S
Q
O)
–Sequencer Compare (SQC)
–Sequencer Load (SQL)
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Understanding Bit Shift and Sequencer Instructions in PLCs and more Slides Programmable Logic Controllers in PDF only on Docsity!

Programmable Logic

Controllers

Application Specific Instructions

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

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

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

  • Sequencer Output (SQO)
  • Sequencer Compare (SQC)
  • Sequencer Load (SQL)

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.
  • • ControlControl is the control element that stores the status byte of theis 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-

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 ththe array each time the instruction is enabled. h ti th i t ti i bl d
  • 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

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

rung and indicates the instruction is enabled.

  • When the register shifts and input conditions go false, the enable, done, and error bits are reset.

Bit Shift Left Instruction

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

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 athe 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).

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

• For wraparound operation, set the position of

the bit address to the last bit of the array or

to the UL bit.

BSR Example

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

Sequencer Instructions

• These instructions transfer 16-bit data to

word addresses for the control of sequential

machine operationsh

• Essentially these instructions provide a

capability for implementing multi-bit state

machines

• An example use is in the traffic control light

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

problem

Sequencer Control

  • Control (SQO, SQC) is the control structure that stores the
    • status byte of the instruction,
    • the length of the sequencer file,g q ,
    • 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-

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 fileinstantaneous position in the file. The control address can 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

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

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.

Sequencer Status Bits (continued)

  • LENGTH
    • The length is the number of steps of the sequencer file starting at position 1starting 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

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

  • 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)

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

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

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

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 d h h

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

word matches the sequencer reference value using the mask value.

Sequencer Load (SQL)

  • The SQL instruction

stores 16-bit data into a

sequencer load file atsequencer 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,

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-

  • or a constant.

SQL Operation

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 9-