FFU — FIFO Unload

Description
Section titled “Description”FFU (FIFO Unload) takes the oldest entry off the front of a first-in, first-out queue each time its rung goes from false to true, writes it to Dest, and moves the remaining entries down one place. It pairs with the FFL (FIFO Load) that fills the same queue on the same control tag. Use it at the consuming end of a buffer: the packer, the printer, the station that works jobs off in the order they arrived. Do not unload every scan; the instruction is edge-triggered, and a rung held true takes exactly one entry.
Operands
Section titled “Operands”| Operand | Type | Format | Valid Range | Required | Description |
|---|---|---|---|---|---|
| Control | CONTROL tag | Tag or Tag[n] |
Shared with exactly one FFL | Yes | Holds LEN, POS and the status bits. |
| File | INT or DINT array tag | Tag |
Same as the FFL’s | Yes | The queue. |
| Dest | Writable INT or DINT tag, member or element | Tag |
Any | Yes | Where the unloaded entry is written. |
| Length | Whole number | 4 |
Same as the FFL’s | Yes | Queue capacity. |
| Position | Whole number | 0 |
0 to Length | No | Entries at power-up; normally 0. |
Scan Behavior
Section titled “Scan Behavior”Prescan
Section titled “Prescan”LEN is loaded from Length and POS from Position.
Rung-condition-in is false
Section titled “Rung-condition-in is false”EU is cleared. Nothing is unloaded; Dest holds.
Rung-condition-in is true
Section titled “Rung-condition-in is true”On the scan the rung turns true, if POS is above 0 then File[0] is written to Dest, elements 1 to POS − 1 move down one place, and POS decrements. If POS is 0 nothing happens and Dest holds. EM is set while POS is 0, DN while POS equals LEN.
Postscan
Section titled “Postscan”Nothing.
| Condition | EU | DN | EM | POS | Dest |
|---|---|---|---|---|---|
| Power-up | 0 | 0 | 1 | 0 | holds |
| Rung false | 0 | holds | holds | holds | holds |
| False → true, POS > 0 | 1 | 0 | POS = 0 after | −1 | File[0] |
| False → true, POS = 0 | 1 | 0 | 1 | holds | holds |
| RES on the control | 0 | 0 | 0 | 0 | holds |
Member Bits
Section titled “Member Bits”The control tag is shared with the FFL; the full table is on the FFL page. From the FFU’s side:
| Bit | Mnemonic | Data type | Set by | Cleared by | Operation description |
|---|---|---|---|---|---|
| Enable unload | .EU |
BOOL | The FFU rung being true | The FFU rung being false, or RES | Mirrors the unload rung and holds its edge memory. .EN belongs to the FFL. |
| Done | .DN |
BOOL | POS reaching LEN | An unload, or RES | The queue was full; one unload clears it. |
| Empty | .EM |
BOOL | POS at 0 after an unload | A load, or RES | Nothing left to unload; Dest keeps its last value. |
| Position | .POS |
INT | Each load (+1) | Each unload (−1), RES (to 0) | Entries in the queue. |
Example
Section titled “Example”The FFU shares its example with the FFL; the three frames are on the FFL page. In short: Load_Job pushes New_Job (7) into Jobs, Position 1; then Unload_Job takes it out, Next_Job reads 7, Position 0, EM lit.

An unload on an empty queue leaves Next_Job at its old value, so test XIO Jobs_Ctl.EM before acting on it.
Control Tag Errors and Troubleshooting
Section titled “Control Tag Errors and Troubleshooting”Error definitions
| .ER cause | Condition that sets it | .POS / status value |
Meaning |
|---|---|---|---|
| None | .ER is never set by LadderIDE |
— | A File that is not an INT/DINT array, a Length of array size or more, or a third instruction on the control tag is refused at validation. |
Troubleshooting hints
Symptom: Dest shows a stale value after an unload. Likely cause: The queue was empty; an unload with POS 0 writes nothing. Fix: Gate the consumer with
XIO Jobs_Ctl.EM.
Symptom: The same entry comes out twice. Likely cause: Two unload rungs, or an unload rung that toggles twice per event. Fix: One FFU per queue, driven by a clean rising edge.
See Also
Section titled “See Also”- FFL — FIFO Load (the full member table and the example)
- LFU — LIFO Unload (newest entry first)
- RES — Reset
- Shift/Sequencer Instructions — Category index
Order of rungs. Put the FFL rung before the FFU rung when both can fire on the same scan, so a value pushed and pulled in one scan goes through the queue rather than around it.
The block colours neutral. Watch the rung wire, the Position row and the DN/EM indicators.
Applies to LadderIDE >=1.2.2 · Last reviewed 2026-09-11 · Screenshots verified 2026-09-11