Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 594

Table of Contents

Advertisement

3. Instructions
Flags
Name
Error Flag
Function
LIFO
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.
The stack must be defined in advance with SSET(630).
Stack
pointer
FIFO
FIFO(633) reads the oldest word of data from the stack (TB+4) and outputs that data to D. Next, the
stack pointer (TB+3 and TB+2) is decremented by one, all of the remaining data in the stack is shifted
downward by one word, and the data read from TB+4 is deleted. The data at the end of the stack (the
address that was indicated by the stack pointer) is left unchanged.
The stack must be defined in advance with SSET(630).
Stack
pointer
Hint
LIFO
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.
FIFO
• Use FIFO(633) in combination with PUSH(632). After PUSH(632) has been used to write data into a
stack, FIFO(633) can be used to read data from the stack on a first-in first-out basis.
• FIFO(633) reads the beginning data from the stack and deletes this data to move the next one
forward.
558
Label
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.
PC memory
address
TB
Newest
TB+1
data
TB+2
TB+3
Stack
pointer
m–1
The pointer is
decremented.
PC memory
address
TB
Oldest
TB+1
data
TB+2
TB+3
TB+4
Stack
pointer
First-in first-out
Operation
PC memory
address
TB
TB+1
TB+2
m–1
TB+3
m–1
A is left unchanged.
Reading
PC memory
address
TB
TB+1
TB+2
m–1
TB+3
TB+4
m–1
CS/CJ/NSJ Series Instructions Reference Manual (W474)

Advertisement

Table of Contents
loading

Table of Contents