FFL (FIFO load)

The FFL instruction loads 8-bit, 16-bit, 32-bit, or 64-bit data into a user-created one-dimensional array called a FIFO stack.
Operation details: FFL instruction changes from non-executing mode to executing mode.
  • When Execute changes from FALSE to TRUE:
    • Error conditions are verified.
    • The contents of Src are loaded into the FIFO stack in the available position and Position increments by one if Position is less than or equal to zero and less than Length.
    • Full is set to TRUE if Length equals Position. Full is FALSE if Position is less than or equal to zero and less than Length.
    • 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 when Length equals Position. Full is FALSE if Position is less than or equal to zero and less than Length.
    • The FFL error conditions are not verified.
  • When Execute changes from TRUE to TRUE:
    • No load operation is performed.
    • Empty is set to TRUE if Position is equal to zero.
    • Full is set to FALSE if Position is less than or equal to zero and less than Length. Full is set to TRUE if Length equals Position.
    • The FFL error conditions are not verified.
  • When Execute changes from FALSE to FALSE:
    • Error, Done, and ErrorID bits are set to FALSE.
    • Full and Empty bits retain values from previous execution state.
  • Empty is set to TRUE if Position is equal to zero.
    • Full is set to TRUE if Length equals Position. Full is FALSE if Position is less than or equal to zero and less than Length.
    • FLL error conditions are not verified.
    • FFL 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.
FFL
FFL
FFL parameters
Parameter
Parameter Type
Data Type
Description
Execute
Input
BOOL
Instruction block enable.
  • TRUE: If rising edge is detected, start the FFL operation.
  • FALSE: Rising edge is not detected.
Src
Input
ANY_ELEMENTARY
The Src operand is the address of the value used to fill the currently available position in the FIFO stack.
Elementary data types supported for Scr: 
  • DWORD, REAL, TIME, DATE, LWORD, ULINT, LINT, LREAL, BOOL, SINT, USINT, BYTE, INT, UINT, WORD, DINT, UDINT.
  • String is not supported.
  • Variables and one-dimensional arrays such as Array[1] or Array[Index] are supported.
FIFO
Input
ANY_ELEMENTARY
The starting address of the stack. FIFO must be configured the same for 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.
Empty
Output
BOOL
Indicates when the FIFO stack is empty.
  • TRUE: When Position equals 0.
  • FALSE: When Position is not equal to 0.
Full
Output
BOOL
Indicates when the FIFO stack is full.
  • TRUE: When Length is equal to Position.
  • FALSE: When Position is greater than or equal to zero and less than Length.
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 FFL 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 one-dimensional 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.
FFL 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.

FFL examples

FFL function block diagram example
FFL function block diagram example
FFL ladder  diagram example
FFL ladder  diagram example
FFL structured text example
FFL structured text example
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal