Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 635

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Table Data Processing Instructions
Description
Flags
Precautions
Examples
0.00
SNUM
D0
D300
Stack
Last word
pointer
in stack
602
SNUM(638) counts the number of data words in the specified stack from the
beginning of the data region at TB+4 to the address before the one indicated
by the stack pointer (TB+3 and TB+2). SNUM(638) does not change the data
in the stack or the stack pointer.
Stack
TB
n
TB+1
TB+2
m
TB+3
TB+4
A
Pointer
Last word
in stack
Name
Label
Error Flag
ER
The stack must be defined in advance with SSET(630).
When CIO 0.00 is ON in the following example, SNUM(638) counts the num-
ber of words from the beginning of the data region at D4 to the stack pointer
position - 1 (D6) and outputs the result to D300. (In this case, the stack pointer
indicates D7.) The stack area begins at D0.
D0
PLC memory address of
last word in the stack
D1
D2
Stack pointer
D3
D4
D5
D6
D7
D8
D9
PLC memory
address
Counts the number of words
(N) from the address of the
beginning of the stack (TB+4)
to the pointer position -1.
D
m
n
Operation
ON if the number of words of data in the stack (the value
output to D) is 0.
OFF in all other cases.
PLC memory
address
Counts number of data
words. (3 in this example.)
Section 3-16
N
D:D300
0003Hex

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents