577
Table Data Processing Instructions Section 3-16
Description LIFO(634) reads the data from the address indicated by the stack pointer (the
newest word of data in the stack), decrements the stack pointer by one, and
outputs the data to D. The word that was read is left unchanged.
Use LIFO(634) in combination with PUSH(632). After PUSH(632) has been
used to write data into a stack, LIFO(634) can be used to read data from the
stack on a last-in first-out basis. After data is stored by PUSH(632), the stack
pointer indicates the address next to the last data.
Flags
Precautions The stack must be defined in advance with SSET(630).
Examples When CIO 0.00 is ON in the following example, LIFO(634) reads the content
of the word indicated by the stack pointer (D6) and writes that data to D300.
TB
TB+1
TB+2
TB+3
TB
TB+1
TB+2
TB+3
m–1 m–1
m–1
Reading
A is left unchanged.
Stack
pointer
PLC memory
address
PLC memory
address
Newest
data
Stack
pointer
The pointer is
decremented.
Name Label Operation
Error Flag ER ON if the contents of the stack pointer (TB+3 and TB+2) is
less than or equal to the PLC memory address of first
word in the data region of the stack (TB+4).
(This is a stack underflow error.)
OFF in all other cases.
–1
TB:
0.00
D0
D300
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
Last word
in stack
Stack
pointer
Stack pointer
PLC memory address
of last word in stack