FIFO Unload (FFU)
The FFU instruction unloads the value from position 0 (first position) of the FIFO and stores that value in the Destination. The remaining data in the FIFO shifts down one position.
Use the FFU instruction with the FFL instruction to store and retrieve data in a first-in/first-out order.
When enabled, the FFU instruction unloads data from the first element of the FIFO and places that value in the Destination. The instruction unloads one value each time the instruction is enabled, until the FIFO is empty. If the FIFO is empty, the FFU returns 0 to the Destination.
Typically, the destination and the FIFO are the same data type. If the types differ, the instruction converts the unloaded value to the type of the destination tag.
A smaller integer converts to a larger integer by sign-extension.
Available Languages
Ladder Diagram
Operands
There are data conversion rules for mixed data types within an instruction.
Ladder Diagram
Operand | Type | Format | Description |
---|---|---|---|
FIFO | SINT INT DINT REAL String type structure | array tag | FIFO to modify Specify the first element of the FIFO Do Not use CONTROL.POS in the subscript |
Destination | SINT INT DINT REAL String type structure | tag | Value unloaded from the FIFO. |
Control | CONTROL | tag | Control structure for the operation typically use the same CONTROL as the associated FFL |
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 |
---|---|---|
.EU | BOOL | The enable unload bit indicates the FFU instruction is enabled. The .EU bit is set to prevent a false unload when the prescan begins. |
.DN | BOOL | The done bit is set to indicate that the FIFO is full (.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 specifies the maximum number of elements in the FIFO. |
.POS | DINT | The position identifies the end of the data that has been loaded into the FIFO. |
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if: | Fault Type | Fault Code |
---|---|---|
The specified Length 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 FFU Flow Chart (Prescan). |
Rung-condition-in is false | See FFL Flow Chart (False). |
Rung-condition-in is true | See FFU Flow Chart (True) |
Postscan | N/A |
FFU Flow Chart (Prescan)
FFL Flow Chart (False)
FFU Flow Chart (True)
Examples
Example 1
Ladder Diagram
Example 2
Destination array is STRING array or Structure array
Ladder Diagram
Example 3
Data type of FIFO source array mismatch data type of destination array
Ladder Diagram
Provide Feedback