Omron SYSMAC CS Series Instruction & Reference Manual page 505

Hide thumbs Also See for SYSMAC CS Series:
Table of Contents

Advertisement

Flags
Name
Error Flag
Note The minimum value for the number of words in the stack (N) is 5 because N includes the four words that contain the
pointer to the last word in the stack and the stack pointer.
Function
SSET(630) secures a stack with N words
beginning at TB and ending at TB+(N-1). The
first two words of the stack (TB+1 and TB)
contain the 8-digit hexadecimal PLC memory
address of the last word in the stack. The
next two words (TB+3 and TB+2) contain the
stack pointer. The stack pointer is the PLC
memory address of the next word in the stack
that will be overwritten by PUSH(632); its
initial value is the address of TB+4.
SSET(630) automatically initializes the data
region of the stack (TB+4 through TB+(N-1))
to zeroes. The following diagram shows the
basic structure of a stack.
Hint
SSET(630) just establishes and initializes a stack. Use the following instructions to store in the stack
and read data from the stack.
1. PUSH(632) stores data in the stack one word at a time.
2. FIFO(633) and LIFO(634) read data from the stack. FIFO(633) reads the first word that was stored;
LIFO(634) reads the last word that was stored.
3. The stack pointer value in the stack control word is automatically updated when PUSH(632),
FIFO(633), or LIFO(634) is executed. Normally, users need not be concerned about the stack
control word. When accessing the contents of the stack other than by using the above instructions,
set the stack pointer value using the Index Register (IR) for indirect referencing.
Related instructions
• PUSH (stack data store) instruction: Stores data in the specified stack area.
• FIFO (first in, first out) instruction: Reads the first data word that was stored in the specified stack
area.
• LIFO (last in, first out): Reads the last data word that was stored in the stack.
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Label
ER
• ON if N is not within the specified range of 0005 to FFFF.
• OFF in all other cases.
Operation
TB
m+(N–1)
TB+1
TB+2
Last word
TB+3
in stack
Stack
pointer
3. Instructions
PC memory
address
N words
in stack
3
m+(N–1)
471

Advertisement

Table of Contents
loading

Table of Contents