LFU — LIFO Unload

Description
Section titled “Description”LFU (LIFO Unload) pops the newest entry off a last-in, first-out stack each time its rung goes from false to true and writes it to Dest. It pairs with the LFL (LIFO Load) that fills the same stack on the same control tag. Use it to step back through recorded positions or undo the most recent change. Do not unload every scan; the instruction is edge-triggered and a rung held true pops 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 LFL | Yes | Holds LEN, POS and the status bits. |
| File | INT or DINT array tag | Tag |
Same as the LFL’s | Yes | The stack. |
| Dest | Writable INT or DINT tag, member or element | Tag |
Any | Yes | Where the popped entry is written. |
| Length | Whole number | 4 |
Same as the LFL’s | Yes | Stack 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 popped; 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 POS decrements and File[POS] is written to Dest. If POS is 0 nothing happens. 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[POS] after the decrement |
| 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 LFL; the full table is on the LFL page. From the LFU’s side:
| Bit | Mnemonic | Data type | Set by | Cleared by | Operation description |
|---|---|---|---|---|---|
| Enable unload | .EU |
BOOL | The LFU rung being true | The LFU rung being false, or RES | Mirrors the unload rung and holds its edge memory. .EN belongs to the LFL. |
| Done | .DN |
BOOL | POS reaching LEN | A pop, or RES | The stack was full; one pop clears it. |
| Empty | .EM |
BOOL | POS at 0 after a pop | A push, or RES | Nothing left to pop; Dest keeps its last value. |
| Position | .POS |
INT | Each push (+1) | Each pop (−1), RES (to 0) | Entries on the stack. |
Example
Section titled “Example”The LFU shares its example with the LFL; the three frames are on the LFL page. In short: Push records Push_Val (9) on Stack, Position 1; then Pop returns it, Pop_Val reads 9, Position 0, EM lit.

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 a pop. Likely cause: The stack was empty; a pop with POS 0 writes nothing. Fix: Gate the consumer with
XIO Stack_Ctl.EM.
Symptom: The popped value is the one pushed first, not last. Likely cause: An FFU was placed instead of an LFU, or the loads went through an FFL. Fix: Both halves must be the LIFO pair on one control tag.
See Also
Section titled “See Also”- LFL — LIFO Load (the full member table and the example)
- FFU — FIFO Unload (oldest entry first)
- RES — Reset
- Shift/Sequencer Instructions — Category index
Popped entries stay in the array. Only POS changes; the element keeps its value until the next push overwrites 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