Omron CJ2 CPU - REV 10-2010 User Manual page 181

Cj2 cpu unit software
Table of Contents

Advertisement

Application Example for Index Registers
The data in D0 to D99 (augend data) is added to the data in D100 to D199 (addend data) and the addi-
tion results are output to D200 to D299. The operands of a single addition instruction are specified by
index registers and the addition operations are performed by incrementing the index registers and
repeatedly executing the addition instruction.
MOVR(560) sets the PLC memory addresses of D0, D100, and D200 in
index registers IR0, IR1, and IR2.
The augend data (indirectly addressed by IR0+) is added to the addend
data (indirectly addressed by IR1+) with the SIGNED BINARY ADD
WITHOUT CARRY instruction (+(400)) and the result is output to the word
indirectly addressed by IR2+.
Index registers IR0+, IR1+, and IR2+ are automatically incremented after
being referenced in the +(400) instruction.
Execution condition
a
Execution condition
a
Additional Information
Index Registers can be directly addressed only in the instructions shown in the following table.
CJ2 CPU Unit Software User's Manual
5 Understanding Programming
Repeated 100 times.
When execution condition "a" goes ON
MOVR
(upwardly differentiated condition), the
D0
PLC memory addresses of D0, D100,
IR0
and D200 are set in index registers IR0,
IR1, and IR2.
The following FOR-NEXT loop is not
MOVR
executed unless execution condition "a"
is upwardly differentiated (OFF→ON).
D100
IR1
MOVR
D200
IR2
JMP
&1000
FOR
Start loop.
&100
If execution condition "a" is ON, the
+
word indirectly addressed by IR0
,IR0+
(auto-incremented) and the word
,IR1+
indirectly addressed by IR1
(auto-incremented) are added as 4-digit
,IR2+
signed hexadecimal values and the
result is output to the word indirectly
addressed by IR2 (auto-incremented).
Return to FOR and repeat loop.
NEXT
JME
Jump destination when execution
condition "a" is not upwardly
&1000
differentiated (OFF→ON).
5
5-89

Advertisement

Table of Contents
loading

Table of Contents