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.
| Tag | After two scans |
|---|---|
| SQLD1 | LEN 8 POS 1 EN 1 DN 0 |
| SQLD1_Data | [0, 0, 0, 0, 0, 0, 0, 0] |
| SQLD1_Execute | 1 |
| SQLD1_Reset | 0 |
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.
| Bit | Meaning |
|---|---|
| .EN | On while Execute is on. |
| .DN | Done: 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. |
| .LEN | Length: how many steps the sequencer has. It cannot be more than the size of the array. |
| .POS | Position: 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
| Scan | Execute | .EN | .POS |
|---|---|---|---|
| 1 | Off | Off | 0 |
| 2 | On | On | 1 |
| 3 | On | On | 1 |
| 4 | Off | Off | 1 |
| 5 | On | On | 2 |
| 6 | On | On | 2 |
| 7 | On | On | 2 |
| 8 | Off | Off | 2 |
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.
2. Turn Save off. Execute is off. Nothing moves.
3. Save 9. Source 9 is written into step 1. POS becomes 2.
4. Turn Save off. Execute is off. Nothing moves.
5. Save 3. Source 3 is written into step 2, the last. POS returns to 0.
6. Reset. Reset sets POS to 0. The steps keep the values they were given.
| Step | Sensor | Steps | Teach.POS |
|---|---|---|---|
| 1. Save 5 | 5 | [5, 0, 0] | 1 |
| 2. Turn Save off | 5 | [5, 0, 0] | 1 |
| 3. Save 9 | 9 | [5, 9, 0] | 2 |
| 4. Turn Save off | 9 | [5, 9, 0] | 2 |
| 5. Save 3 | 3 | [5, 9, 3] | 0 |
| 6. Reset | 3 | [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
| Operand | What it is for | Data type | Read or write |
|---|---|---|---|
| Execute | A BOOL that makes the instruction act once each time it turns on. | BOOL | Reads |
| Reset | A BOOL that, while on, clears the control tag and starts over. | BOOL | Reads |
| Array | The array whose steps are written. | Array of DINT | Reads and writes |
| Control | The CONTROL tag that tracks the position, length and status. | CONTROL | Reads and writes |
| Mask | Which bits count: only bits that are on in Mask are used. | DINT or a number | Reads |
| Source | The value stored into the current step. | DINT or a number | Reads |
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.