Sequencer Load SQLD

At the right of a rung in a program's ladder routine. Not in a Logic Class. Placing it creates its control tag.

TagAfter two scans
SQLD1LEN 8 POS 1 EN 1 DN 0
SQLD1_Data[0, 0, 0, 0, 0, 0, 0, 0]
SQLD1_Execute1
SQLD1_Reset0

How it works

Each time Execute turns on, copies the bits selected by Mask from Source into the step at POS. Bits outside Mask keep their values in that step. POS then moves to the next step. After the last step, POS returns to 0.

Status bits

The Control tag holds the state. Read a bit with the tag name and a dot, such as Control.DN.

BitMeaning
.ENOn while Execute is on.
.DNDone: on when Execute takes the sequencer past its last step. POS returns to 0, and DN stays on until Execute turns off or Reset is on.
.LENLength: how many steps the sequencer has. It cannot be more than the size of the array.
.POSPosition: the step the next Execute uses, from 0 to LEN - 1. Reset sets it to 0.

Rules

  • Source is written into the step at POS. POS then moves on at every Execute and returns to 0 after the last step.
  • It acts once when Execute turns on, not on every scan.
  • Reset sets POS to 0 and does not clear the steps.
  • A sequencer has no EU, EM or FU bits.

Over time

A FIFO Load with Execute on for scans 2 and 3, off at scan 4, then on for scans 5 to 7. POS moves one step at scan 2 and one at scan 5, each time Execute turns on. Holding Execute on adds no steps.Scan12345678Execute.EN.POS011122222 Execute turns on: one step3 Held on: no step5 Turns on again: next step
ScanExecute.EN.POS
1OffOff0
2OnOn1
3OnOn1
4OffOff1
5OnOn2
6OnOn2
7OnOn2
8OffOff2

The chart shows a FIFO Load; the others act on Execute the same way. One step happens on the scan where Execute turns on. Holding Execute on does nothing more, so turn it off and on for the next step.

How it's used

Use SQLD to teach a pattern: each Execute stores the current input as the next step.

1. Save 5. Source 5 is written into step 0. POS becomes 1.

StepSensorStepsTeach.POS
1. Save 55[5, 0, 0]1
2. Turn Save off5[5, 0, 0]1
3. Save 99[5, 9, 0]2
4. Turn Save off9[5, 9, 0]2
5. Save 33[5, 9, 3]0
6. Reset3[5, 9, 3]0

Steps went [0, 0, 0] to [5, 0, 0] to [5, 9, 0] to [5, 9, 3]. POS went 1, 2, 0: each Execute stored Source in a step, and after the last step it returns to 0. Reset then set POS to 0 and left the steps as they were.

Operands

OperandWhat it is forData typeRead or write
ExecuteA BOOL that makes the instruction act once each time it turns on.BOOLReads
ResetA BOOL that, while on, clears the control tag and starts over.BOOLReads
ArrayThe array whose steps are written.Array of DINTReads and writes
ControlThe CONTROL tag that tracks the position, length and status.CONTROLReads and writes
MaskWhich bits count: only bits that are on in Mask are used.DINT or a numberReads
SourceThe value stored into the current step.DINT or a numberReads

Common mistakes

  • Expecting Position to stay putPosition moves to the next step after every load, and wraps after the last one.
  • Rung already true on the first scanA rung that is already true on the first scan after a reset acts once, the same as any other scan where Execute turns on.

Related