Omron CJ - REFERENCE MANUAL 10-2009 Reference Manual page 588

Table of Contents

Advertisement

3. Instructions
Flags
Name
Error Flag
Function
PUSH(632) writes the content of S to the address indicated by the stack pointer (TB+3 and TB+2) and
increments the stack pointer by one.
The stack must be defined in advance with SSET(630).
D
D+1
D+2
D+3
Pointer
Hint
• After data is stored with this instruction, the stack pointer specifies the next address after the last data
word.
• After PUSH(632) has been used to write data into a stack, FIFO(633) and LIFO(634) can be used to
read data from the stack.
Sample program
When CIO 0.00 is ON in the following example, PUSH(632) copies the content of D200 to the stack
beginning at D0. In this case, the stack pointer indicates D7.
0.00
Last word
in stack
Last word
in stack
550
Label
ER
• ON if the address specified by the stack pointer (TB+3 and TB+2) exceeds the last word in the stack.
(This is a stack overflow error.)
• OFF in all other cases.
PLC memory
address
n
m
Write A.
S
A
m
n
D0
D200
D0
PC memory address
of last word in stack
D1
D2
Stack pointer
D3
Stack
D4
pointer
D5
D6
D7
D8
D9
D0
PC memory address
D1
of last word in stack
D2
Stack pointer
D3
D4
D5
D6
D7
D8
D9
Operation
D
D+1
D+2
D+3
A
Pointer
Increment
pointer by 1.
PC memory address
Write A.
PC memory address
After the data is written to
D7, the stack pointer is
incremented by one.
A
CS/CJ/NSJ Series Instructions Reference Manual (W474)
PLC memory
address
n
m+1
A
m
m+1
n
D200

Advertisement

Table of Contents
loading

Table of Contents