LIFO Load (LFL)

This table lists the controllers and applications that support this instruction.
Architecture
Standard applications
Safety applications
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers
Yes
No
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Yes
Yes
The LFL instruction copies the Source value to the LIFO.
Use the LFL instruction with the LFU instruction to store and retrieve data in a last-in/first-out order. When used in pairs, the LFL and LFU instructions establish an asynchronous shift register.
Typically, the Source and the LIFO are the same data type.
When enabled, the LFL instruction loads the Source value into the position in the LIFO identified by the .POS value. The instruction loads one value each time the instruction is enabled, until the LIFO is full.
IMPORTANT: You must test and confirm that the instruction does not change data that you don’t want it to change.
The LFL instruction operates on contiguous data memory.
Available Languages
Ladder Diagram
Operands
There are data conversion rules for mixed data types within an instruction.
Ladder Diagram
Operand
Type
Format
Description
Source
SINT
INT
DINT
REAL
String type
structure
immediate
tag
Data to be stored in the LIFO.
LIFO
SINT
INT
DINT
REAL
String type
structure
array tag
LIFO to modify
Specify the first element of the LIFO
Control
CONTROL
tag
Control structure for the operation
Typically use the same CONTROL as the associated LFU
Length
DINT
immediate
Maximum number of elements the LIFO can hold at one time
Position
DINT
immediate
Next location in the LIFO where the instruction loads data
Initial value is typically 0
CONTROL Structure
Mnemonic
Data Type
Description
.EN
BOOL
The enable bit indicates the LFL instruction is enabled.
.DN
BOOL
The done bit is set to indicate that the LIFO is full (.POS = .LEN). The .DN bit inhibits loading the LIFO until .POS < .LEN.
.EM
BOOL
The empty bit indicates the LIFO is empty. If .LEN < or = to 0 or .POS < 0, the .EM bit and .DN bits are set.
.LEN
DINT
The length specifies the maximum number of elements the LIFO can hold at one time.
.POS
DINT
The position identifies the location in the LIFO where the instruction will load the next value.
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if:
Fault Type
Fault Code
If (starting element + .POS) is past the end of LIFO array
4
20
See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
See LFL Flow Chart (Prescan)
Rung-condition-in is false
See LFL Flow Chart (False)
Rung-condition-in is true
See LFL Flow Chart (True)
Postscan
N/A.
LFL Flow Chart (Prescan)
LFL Flow Chart (False)
LFL Flow Chart (True)
Examples
Example 1
Ladder Diagram
Example 2
Source array is STRING array or Structure array.
Ladder Diagram
Example 3
Data type of source mismatch data type of LIFO array.
Ladder Diagram
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.