FFU (FIFO unload)
The FFU instruction unloads 8-bit, 16-bit, 32-bit, or 64-bit data from a user-created one-dimensional array called a FIFO (first in first out) stack in the same order data was loaded using the FFL instruction.
Operation details:
- FFU instruction - Non executing mode to executing mode:
- When Execute changes from FALSE to TRUE:
- FFU error conditions are verified.
- Unloads the contents of the FIFO stack at the zero position if Position is greater than zero and less than or equal to Length.
- Remaining elements shift one position towards zero and the highest element of the FIFO stack is set with zero, Position is decremented by one.
- Empty is set to TRUE if Position equals zero.
- Done is set when the instruction executes successfully.
- When Execute changes from TRUE to FALSE:
- Error, Done, and ErrorID are set to FALSE.
- Empty is set to TRUE if Position is equal to zero.
- Full is set to TRUE if Length equals Position. Full is set to FALSE if Position is less than or equal to zero and less than Length.
- The FFU error conditions are not verified.
- When Execute changes from TRUE to TRUE:
- No unload operation performed.
- Empty is set to TRUE if Position is equal to zero.
- Full is set to TRUE if Length equals Position.
- The FFU error conditions are not verified.
- When Execute changes from FALSE to FALSE:
- Error, Done, and ErrorID are set to FALSE.
- Empty is set to TRUE if Position is equal to zero.
- Full is set to TRUE if Length equals Position. Full is set to FALSE if Position is less than or equal to zero and less than Length.
- The FLU error conditions are not verified.
- FFU instruction - Executing mode to non-executing mode:
- Error, ErrorID, Done, Empty, and Full retain the Execute mode state.
- To create a single element for the FIFO parameter:
- Non-array:
- Variable-based address such as Fifo1 is allowed for FIFO.
- Length should be configured as 1.
- One-dimensional array:
- Variable based address such as Fifo1 or Fifo1[0] is allowed for FIFO.
- Length should be configured as 1.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the L20E, L50E, and L70E controllers.
FFU

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
Execute | Input | BOOL | Instruction block enable.
|
Dest | Input | ANY_ELEMENTARY | Holds the value that exists in the FIFO stack. Elementary data types supported for Dest:
|
DestOffset | Input | UINT | Destination element offset. Element offset if destination is of one-dimensional array data type, otherwise offset should be set to 0. For array data type, to unload to the first element, the offset should be set as 0. |
FIFO | Input | ANY_ELEMENTARY | The starting address of the stack. FIFO must be configured the same in the FFL and FFU instructions.
|
FIFOCon | Input | FF_LF_CON | FIFO configuration and control. The same configuration must be configured for FFL and FFU instructions. Use the FF_LF_CON data type to configure Position and Length. |
Done | Output | BOOL | Indicates when the FFU operation is complete.
|
Full | Output | BOOL | Indicates when the FIFO stack is full.
|
Empty | Output | BOOL | Indicates when the FIFO stack is empty.
|
Error | Output | BOOL | Indicates the existence of an error condition.
|
ErrorID | Output | USINT | A unique numeric that identifies the error. The errors are defined in FFU error codes. |
Parameter | Data Type | Description |
---|---|---|
Length | UINT | Number of elements used for FIFO operation. Maximum limit is 1024. |
Position | USINT | Determines the next available location in the FIFO for the Src entry or removal. Position is the offset of the array.
|
Error code | Error description |
---|---|
0 | No error. |
1 | FFL Src data type is not supported. |
2 | FFU Dest data type is not supported. |
3 | FIFO data type is not supported. |
4 | Src and Dest data type mismatch with the FIFO data type. Corrective Action: FFL Src parameter and FFU Dest parameter data type should match with the FIFO array data type. |
5 | FIFO: Array dimension is not supported. Corrective Action: FIFO only supports one-dimensional arrays. |
6 | FIFOCon control Length exceeds FIFO array size. Corrective Action: FIFOCon control Length cannot exceed the FIFO array size. |
7 | FIFOCon Length exceeds the max length. |
8 | FIFOCon Length is zero. |
9 | FIFOCon Position exceeds the FIFOCon Length. |
10 | FFL control Length and Position are equal. |
11 | FFU control Position is zero. |
12 | FFL or FFU array dimension is not supported. Corrective Acton: FFL and FFU only support one-dimensional arrays. |
13 | FFL or FFU DestOffset exceeds Dest array size. |
FFU examples
FFU function block diagram example

FFU ladder diagram example

FFU structured text example

Results

Provide Feedback