Lifo Write - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

4.9.6

LIFO Write

The Last-In-First-Out (LIFO) Write (LIFO_WRT) function increments
the table pointer by one and then adds an entry at the new pointer
location in a table. Values are always moved in at the top of the
table. If the pointer reaches the last location and the table becomes
full, LIFO_WRT cannot add further values. LIFO_RD must then be
used to remove the entry at the pointer location and decrement the
pointer by one.
1. LIFO_WRT increments the table pointer by one.
2. LIFO_WRT copies data from input parameter IN to the position in the table indicated by the
pointer. (It writes over any value currently at that location.) Additional program logic must then
be used to place the data in the input reference.
3. Steps 1 and 2 are repeated each time LIFO_WRT is executed, until the table is full (PTR=LEN).
The pointer does not wrap around when the table is full.
When LIFO_WRT receives power flow, the pointer increments by 1; then the new data is written at
the pointer location. If the pointer was already at the last location in the table, no data is written and
LIFO_WRT does not pass power to the right. The pointer always indicates the last item entered into
the table. If the table is full, it is not possible to add more entries to it.
LIFO_WRT passes power to the right after a successful execution (PTR < LEN).
Note: A LIFO table is a stack. A FIFO table is a queue.
Operands for LIFO Write
Note: For each mnemonic, use the corresponding data type for the TB and IN operands. For
example, LIFO_WRT_DINT requires TB and Q to be DINT variables.
Parameter
Description
1  Length  32,767.
Length (??)
TB (must be the
The elements in the table
same type as IN)
PTR
Pointer. Index of the next element to
write.
IN (must be the
The element to write to the table
same type as TB)
FL
Energized when IN is written to the
last element of the table
Example for LIFO Write
PRODUCT is a LIFO table with 100 word-sized elements. When the
enabling input STORE is ON, a data item from NEW_ITEM is copied
to the table location pointed to by the value in STK_PTR. Output FL
passes power when PTR = LEN, firing the FULL coil. No further data
from NEW_ITEM can be added to the table without first copying
data out, using the LIFO_RD function.
GFK-2950C
Chapter 4. Ladder Diagram (LD) Programming
Allowed Operands
Constants
All except constants, S, data flow. SA -
SC allowed only for WORD, DWORD.
All except constants, S - SC, and data
flow
All. S – SC allowed only for WORD,
DWORD
All
February 2018
Mnemonics:
LIFO_WRT_DINT
LIFO_WRT_DWORD
LIFO_WRT_INT
LIFO_WRT_UINT
LIFO_WRT_WORD
Optional
No
No
No
No
No
183

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents