602
Table Data Processing Instructions Section 3-16
Description 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.
Flags
Precautions The stack must be defined in advance with SSET(630).
Examples 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.
A
TB
TB+1
TB+2
TB+3
TB+4
N
m
n
D
n
m
Stack
PLC memory
address
Pointer
Counts the number of words
(N) from the address of the
beginning of the stack (TB+4)
to the pointer position -1.
Last word
in stack
Name Label Operation
Error Flag ER ON if the number of words of data in the stack (the value
output to D) is 0.
OFF in all other cases.
SNUM
D0
D300
0.00
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
D:D300
0003Hex
PLC memory
address
Last word
in stack
Stack
pointer
PLC memory address of
last word in the stack
Stack pointer
Counts number of data
words. (3 in this example.)