Topic: DMD0463

Help File Version: 2.10.0.636

FIFOLOAD - Load First-In / First-Out


The Load First In / First Out (FIFOLOAD) instruction will store data values into a user-created data block (with the intention of using the Unload First In / First Out (FIFOUNLOAD) to retrieve them from the user block in the same order in which they were stored. Data that is managed this way is commonly referred to as a Queue. The user data block can consist of any of the simple types (Byte, Word, DWord, Real), or any user-defined structures.

 

This instruction will use an associated Queue Control Structure (the structure's fields shown below). The fields in this structure are used in the ladder logic program to add data to the FIFO Queue and monitor its current state. Use the Reset FIFO Queue (FIFORESET) instruction to clear the Queue Control Structure's state data and optionally clear the data from the FIFO's associated data block.


Parameters:

Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Queue Control Structure is the data structure this instruction will use to manage the process of adding data in the user data block. The associated FIFOUNLOAD instruction should use the same Queue Control Structure. Different Queues should use different Queue Control Structures with different user data blocks.

 

User Block is the user-created data block this instruction will use to store the data. This must be a user created block, and the entire block will be used as the FIFO Queue. You cannot use a portion of an existing user-created or built-in data block.

Click the Create Block... button to open the editor shown below where a new data block of the appropriate type can be created.

 

Data Block Name (1 to 16 letters) must be unique and consist of 1 to 16 characters (A-Z, a-z; no numbers, no spaces).

 

Number of Elements specifies the number of elements of the specified type in the data block. The data blocks must be created on a DWord (4-byte) boundary. Data Block Range displays the first and last element of the block that will be created based on the current entries for Data Block Name and Number of Elements.

 

Data Type selects the type of data that the block will consist of. This can be any of the simple data types, or any of the built-in structure types, or any user data types (UDTs).

 

Enable the Make Data Block Retentive (retain values after power loss) option to have the block retain its contents through a power cycle or a Program-to-Run mode transition. Any block of memory NOT marked as retentive will be cleared at power up and during a Program-to-Run mode transition.

The Variable Length Structure Settings field is enabled if the structure type selected is a String. This field specifies how long the Strings will be in the data block.


Value to Load into User Block contains the data to store in the data block. This should be the same type as the data in the user block.

Note: if the FIFO is loading Strings into a User Block of strings, the maximum length of the source String must match the maximum length of the User Block of Strings.


Load on Input Leg selects which power-flow conditions will cause this instruction to load the value:

 

  • Edge Triggered means that each time the input ladder logic transitions from OFF to ON, the instruction will load the Value into the User Block.
     
  • Power flow enabled means that each scan the input ladder logic is ON, the instruction will load the Value into the User Block. This is the proper selection if this instruction is used within a loop (e.g. For / Next) because instructions inside loops cannot detect rising edges.

 

Note: if the FIFO User Block is full (the .Full bit is ON) when a FIFOLOAD is executed, the system status bit $QueueFull (ST156) will turn ON, and no change will be made to the User Block's data.

 


Status Display:

If the FIFO Queue contains more then 7 items the status display of this instruction will show the first 3 and the last 3 locations.

 

 

If the FIFO Queue's User Block contains one of the simple types (Bit, Byte, Word, DWord, Real) or contains only Strings, the Memory View is a convenient way to see the contents of the User Block.

 

 

If the FIFO Queue's User Block contains structures the Data View can be used to view the contents of each element in the block.

 

 


Queue Control Structure Fields:

 

.Depth is the number of data values stored in the Queue.

 

.Head is the location in the Queue where the data will be stored when a Load FIFO or Load LIFO instruction is executed, and where data will be read from when an Unload LIFO instruction is executed.

 

.Tail is the location in the Queue where the data will be read from when the Unload FIFO instruction is executed.

 

.Empty will be ON when none of the locations in the Queue are being used. An attempt to unload a value when the Queue is empty will not be processed and so this will not generate a Warning message.

 

.Full will be ON when all of the locations in the Queue have been used. Any attempt to load a value when the Queue is full will fail; no data in the user data block will be overwritten, but a Warning message will be generated.

 


See Also:

FIFOLOAD - Load First In / First Out

 

FIFOUNLOAD - Unload First In / First Out

 

FIFORESET - Reset FIFO Queue

 


Related Topics:

LIFOLOAD - Load Last In / First Out

 

LIFOUNLOAD - Unload Last In / First Out

 

LIFORESET - Reset LIFO Queue

 


Example: