Topic: DMD0466

Help File Version: 2.9.4.37

LIFOUNLOAD - Unload Last In / First Out


The Unload Last In / First Out (LIFOUNLOAD) instruction used to retrieve data from a LIFO Queue that was placed there by a corresponding Load Last In / First Out (LIFOLOAD)

instruction. This instruction will retrieve the last (newest) 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 newest location.

 

 


Parameters:

Note: Use the F9 key 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 LIFOLOAD instruction to load data into the LIFO Queue.

 

User Block is the user-created data block that contains the LIFO 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 bytes 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 LIFO will be stored. This should be the same type as the data in the user block.

If the User Block contains structures (either built-in type or a user data type (UDT), you can click the Create Heap Item button to make a new heap item of the same type as is stored in the user block and use this newly-created new heap item for this parameter.


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 delete that data from 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 LIFO Queue contains more then 7 items the status display of this instruction will show the first 3 and the last 3 locations.

 

 

If the LIFO 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 LIFO 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:

LIFOLOAD - Load Last In / First Out

 

LIFOUNLOAD - Unload Last In / First Out

 

LIFORESET - Reset LIFO Queue

 


Related Topics:

FIFOLOAD - Load First In / First Out

 

FIFOUNLOAD - Unload First In / First Out

 

FIFORESET - Reset FIFO Queue

 


Example: