Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 593

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
Table of Contents

Advertisement

3. Instructions
Flags
Name
Error Flag
Equal Flag
Function
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.
The stack must be defined in advance with SSET(630).
TB
TB+1
TB+2
TB+3
TB+4
Pointer
Last word
in stack
Hint
As an example, this instruction is used to count the number of work pieces currently on a conveyor belt.
Sample program
When CIO 0.00 is ON in the following example, SNUM(638) counts the number 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.)
0.00
SNUM
D0
D300
Last word
Stack
in stack
pointer
556
Label
ER
OFF
=
• 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
Stack
address
n
m
A
Counts the number of words
(N) from the address of the
beginning of the stack (TB+4)
to the pointer position 1.
m
n
D0
PLC memory address of
last word in the stack
D1
D2
Stack pointer
D3
D4
D5
D6
D7
D8
D9
Operation
D
N
PLC memory
address
Counts number of data
words. (3 in this example.)
CS/CJ/NSJ Series Instructions Reference Manual (W474)
D:D300
3Hex

Advertisement

Table of Contents
loading

Table of Contents