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
FFU
FFU parameters
Parameter
Parameter Type
Data Type
Description
Execute
Input
BOOL
Instruction block enable.
  • TRUE: If rising edge is detected, start FFU operation.
  • FALSE: Rising edge is not detected.
Dest
Input
ANY_ELEMENTARY
Holds the value that exists in the FIFO stack.
Elementary data types supported for Dest:
  • DWORD, REAL, TIME, DATE, LWORD, ULINT, LINT, LREAL, BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT.
  • String is not supported.
  • Only supports one-dimensional arrays such as Array[1] or Array[Index].
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.
  • Elementary data types supported for FIFO:
    DWORD, REAL, TIME, DATE, LWORD, ULINT, LINT, LREAL, BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT.
  • String is not supported.
  • Only one-dimensional array is supported for FIFO.
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.
  • TRUE: Operation completed successfully.
  • FALSE: Operation encountered an error condition or the FFU instruction is not executing.
Full
Output
BOOL
Indicates when the FIFO stack is full.
  • TRUE: When Length is equal to Position.
  • FALSE: When Position is greater than zero and less than Length.
Empty
Output
BOOL
Indicates when the FIFO stack is empty.
  • TRUE: When Position equals 0.
  • FALSE: When Position is not equal to 0.
Error
Output
BOOL
Indicates the existence of an error condition.
  • TRUE: Operation encountered an Error.
  • FALSE: Operation completed successfully or the instruction is not executing.
ErrorID
Output
USINT
A unique numeric that identifies the error. The errors are defined in FFU error codes.
FF_LF_CON Data Type
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.
  • Example 1:
    User configured array, arr[0..5]. Initial position is configured as 1. Data is pushed into arr[1] and position increments by position + 1.
  • Example 2:
    User configured one-dimensional array as arr[1..5]. Initial position is configured as 1. Data is pushed into arr[2] and position increments by position + 1.
FFU error codes
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 function block diagram example
FFU ladder diagram example
FFU ladder diagram example
FFU structured text example
FFU structured text example
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal