Omron CJ - PROGRAMMING MANUAL 08-2008 Programming Manual page 325

Programmable controllers
Hide thumbs Also See for CJ - PROGRAMMING MANUAL 08-2008:
Table of Contents

Advertisement

Index Registers
Range speci-
fied in the
instruction
ON for 1 cycle when
operation starts.
P_First_Cycle
Execution condition
a
Execution condition
b
=
&0
D100
<>
&0
D100
Table Processing (Range Instructions)
The range instructions act on a range of words, which can be considered a
table of one-word records. These instructions perform basic operations such
as finding the maximum value or minimum value in the range, search for a
particular value in the range, or calculating the sum or FCS.
The PLC memory address of the result word (word containing the max. value,
min. value, search data, etc.) is automatically stored in IR0. The Index Regis-
ter (IR0) can be used as an operand in later instructions such as MOV(021) to
read the contents of the word or perform other processing.
Max. value
Min. value
When the First Cycle Flag is ON,
SSET
SSET(630) defines a stack in words
D00000
D00000 to D00014.
&14
· When execution condition "a" goes ON
SNUM
(upwardly differentiated condition),
D00000
SNUM(638) determines the number of
W100
words stored in the stack and writes that
number in W100.
· MOV(021) writes the initial offset (&1) to
MOV
W101. The offset is used to search the
&1
stack data.
W101
· The following FOR-NEXT loop is not
executed unless execution condition "a"
is upwardly differentiated (OFF→ON).
JMP
&1000
Start loop.
FOR
W100
SREAD
D00000
W101
D00100
· If execution condition "a" is ON,
SDEL
SREAD(639) reads the data from the
D00000
calculated stack address (stack pointer -
W101
offset value in W101) and writes that
D00100
data to D00100.
· If the value read from the stack is 0, that
data is deleted from the stack.
++
· If the value read from the stack is not 0,
W101
W101 (the offset value) is incremented.
Return to FOR and repeat loop.
NEXT
Jump destination when execution
JME
condition "a" is not upwardly
&1000
differentiated (OFF→ON).
Data
SUM calculation
Search
FCS calculation
Section 6-2
287

Advertisement

Table of Contents
loading

Table of Contents