Topic: DMD0464

Help File Version: 2.10.0.636

FIFOUNLOAD - Unload First In / First Out


The Unload First In / First Out (FIFOUNLOAD) instruction is used to retrieve data from a FIFO Queue that was placed there by a corresponding Load First In / First Out (FIFOLOAD)

instruction. This instruction will retrieve the first (oldest) data point that was stored in the User Block, copy that data to the Destination location, clear that memory location in the User Block, then move the Queue's pointer to the next oldest location.

 

 


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 retrieving data from the user data block. This should be the same Queue Control Structure that is used by the FIFOLOAD instruction to load data into the FIFO Queue.

 

User Block is the user-created data block that contains the FIFO Queue's data.

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 selected 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.


Destination is the memory location where the data retrieved from the FIFO will be stored. This should be the same type as the data in the user block.

Note: if the FIFO is unloading Strings from a User Block of strings, the maximum length of the destination 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 retrieve the data from the User Block and place it in the Destination location and clear that memory location in the User Block then move the Queue's pointer to the next location in the queue.

     
  • Power flow enabled means that each scan the input ladder logic is ON, the instruction will retrieve the Value from the User Block and place it in the Destination location and delete that data from the User Block then move the Queue's pointer to the next location in the queue. 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.

 


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: