FIFO Load (FFL)
The FFL instruction copies the Source value to the FIFO.
Use the FFL instruction with the FFU instruction to store and retrieve data in a first-in/first-out order. When used in pairs, the FFL and FFU instructions establish an asynchronous shift register.
Typically, the Source and the FIFO are the same data type.
When enabled, the FFL instruction loads the Source value into the position in the FIFO identified by the .POS value. The instruction loads one value each time the instruction is enabled, until the FIFO is full.
IMPORTANT:
You must test and confirm that the instruction does not change data that you don’t want it to change.
The FFL instruction operates on contiguous memory.
The data is constrained by the specified member.
If the instruction tries to read past the end of an array, the instruction generates a major fault.
Typically, the Source and the FIFO are the same data type. If Source and FIFO data types mismatch, the instruction converts the Source value to the data type of the FIFO tag.
A smaller integer converts to a larger integer by sign-extension.
Available Languages
Ladder Diagram
Operands
Conversion only occurs if the type of the source operand does not match the type of the FIFO.
Ladder Diagram
Operand | Type | Format | Description |
---|---|---|---|
Source | SINT INT DINT REAL String type structure | immediate tag | Data to be stored in the FIFO |
FIFO | SINT INT DINT REAL String type structure | array tag | FIFO to modify Specify the first element of the FIFO |
Control | CONTROL | tag | Control structure for the operation Typically use the same CONTROL as the associated FFU |
Length | DINT | immediate | Maximum number of elements the FIFO can hold at one time |
Position | DINT | immediate | Next location in the FIFO where the instruction loads data initial value is typically 0 |
CONTROL Structure
Mnemonic | Data Type | Description |
---|---|---|
.EN | BOOL | The enable bit indicates the FFL instruction is enabled. |
.DN | BOOL | The done bit is set to indicate that the FIFO is full. The .DN bit inhibits loading the FIFO until .POS < .LEN. |
.EM | BOOL | The empty bit indicates the FIFO is empty. If .LEN is < or = to 0 or .POS < 0, the .EM bit and .DN bits are set. |
.LEN | DINT | The length word specifies the maximum number of elements in the FIFO. |
.POS | DINT | The position word identifies the location in the FIFO where the instruction loads the next value. |
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if: | Fault Type | Fault Code |
---|---|---|
The (starting element + .POS) is past the end of FIFO array | 4 | 20 |
See Common Attributes for operand-related faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | See the FFL Flow Chart (Prescan). |
Rung-condition-in is false | See FFL Flow Chart (False) |
Rung-condition-in is true | See FFL Flow Chart (True) |
Postscan | N/A |
FFL Flow Chart (Prescan)
FFL Flow Chart (False)
FFL 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 FIFO array.
Ladder Diagram
Provide Feedback