Skip to content

FFL — FIFO Load

Category
Shift / Sequencer
Type
Output
Availability
All platforms

FFL instruction block: Source New_Job, File Jobs, Length 4, Position, with DN and EM indicators


FFL (FIFO Load) pushes a value onto the end of a first-in, first-out queue each time its rung goes from false to true. The queue is an array tag; the control tag’s position counts how many entries it holds. FFL always pairs with an FFU (FIFO Unload) on the same control tag and array, which takes the oldest entry off the front. Use the pair to buffer part numbers, job codes or readings between a station that produces them and a station that consumes them at a different rate. Do not use a FIFO for the most recent value; LFL/LFU give last-in, first-out.


Operand Type Format Valid Range Required Description
Control CONTROL tag Tag or Tag[n] Shared with exactly one FFU Yes Holds LEN, POS and the status bits.
Source INT or DINT tag, member, element or literal Tag, 7 Any Yes The value pushed.
File INT or DINT array tag Tag At least Length + 1 elements Yes The queue. Entries occupy elements 0 to POS − 1.
Length Whole number 4 1 to array size − 1 Yes Queue capacity.
Position Whole number 0 0 to Length No Entries at power-up; normally 0.

Give the FFU the same Control, File and Length.


LEN is loaded from Length and POS from Position. EM is set once the pair has run its first scan with POS at 0.

EN is cleared. Nothing is pushed.

On the scan the rung turns true, if POS is below LEN the Source is written to File[POS] and POS increments. DN is set while POS equals LEN, so a push against a full queue is ignored. EM is set while POS is 0.

Nothing.

Condition EN DN EM POS File
Power-up 0 0 1 0 holds
Rung false 0 holds holds holds holds
False → true, POS < LEN 1 POS = LEN after 0 +1 File[POS] = Source
False → true, POS = LEN 1 1 0 holds holds
RES on the control 0 0 0 0 holds

Bit Mnemonic Data type Set by Cleared by Operation description
Enable .EN BOOL The FFL rung being true The FFL rung being false, or RES Mirrors the load rung, and is the load half’s edge memory.
Enable unload .EU BOOL The FFU rung being true The FFU rung being false, or RES Mirrors the unload rung, and is the unload half’s edge memory. Two bits, so the two rungs never disturb each other’s edge.
Done .DN BOOL POS reaching LEN An unload, or RES The queue is full; further loads are ignored.
Empty .EM BOOL POS at 0 after a load or unload The first load, or RES The queue is empty; an unload does nothing.
Error .ER BOOL Never RES Reserved. Bad operands are refused at validation.
Unload .UL BOOL Never RES Not used by FIFO.
Inhibit .IN BOOL Never RES Reserved.
Found .FD BOOL Never RES Not used by FIFO.
Length .LEN INT Length at power-up Never (RES preserves it) Queue capacity.
Position .POS INT Each load (+1) and unload (−1) RES (to 0) Number of entries in the queue.

Scenario: A labeller hands job codes to a downstream packer. Codes arrive in bursts and are worked off one at a time, so they queue.

Tags:

  • Load_Job — New job available, BOOL
  • New_Job — Job code from the labeller, INT
  • Jobs — The queue, INT[8]
  • Jobs_Ctl — Control, CONTROL, Length 4
  • Unload_Job — Packer ready, BOOL
  • Next_Job — Job code for the packer, INT

Rungs 1 and 2:

—] [Load_Job———[FFL Jobs_Ctl New_Job Jobs 4]———
—] [Unload_Job———[FFU Jobs_Ctl Jobs Next_Job 4]———

Scan 1 — both rungs false. New_Job reads 7. Position 0, EM lit on both blocks, Next_Job 0.

Figure 1 — FFL and FFU rungs false: New_Job 7, Position 0, EM lit, Next_Job 0

Scan 2 — Load_Job = 1. The code is pushed: Jobs[0] becomes 7, Position 1, EM goes dark.

Figure 2 — FFL rung true after one edge: Position 1, EM dark, FFL rung lit

Scan 3 — Unload_Job = 1. The FFU takes the oldest entry: Next_Job reads 7, Position back to 0, EM lit again.

Figure 3 — FFU rung true after one edge: Next_Job 7, Position 0, EM lit, FFU rung lit

Four loads without an unload fill the queue and light DN; a fifth is ignored until the packer takes one.


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: Loads are lost. Likely cause: The queue is full; .DN is set and a load against a full queue is ignored. Fix: Increase Length (and the array), or block the producer with XIO Jobs_Ctl.DN.

Symptom: .POS climbs and never falls. Likely cause: The FFU rung never sees an edge, or it uses a different control tag. Fix: Check that both instructions name the same control tag and array, and that the unload rung goes false between unloads.

Symptom: .EM is clear right after a RES although the queue is empty. Likely cause: RES clears every bit including EM; EM is recomputed on the next load or unload edge. Fix: Test EQU Jobs_Ctl.POS 0 if you need “empty” on the scan after a reset.



Array size. Length may be at most one less than the array size, the same rule as the sequencers, so a queue of 4 needs INT[5] or larger.

Old entries linger. An unload shifts the queue down but does not clear the vacated element. Only elements below POS are meaningful.

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