Omron CJ2 CPU UNIT SOFTWARE User Manual page 179

Cj2 cpu unit software
Hide thumbs Also See for CJ2 CPU UNIT SOFTWARE:
Table of Contents

Advertisement

• Instructions for Direct Addressing of Index Registers:
BINARY ADD (+L), BINARY SUBTRACT (−L), DOUBLE INCREMENT BINARY (++L),
DOUBLE DECREMENT BINARY (−−L)
Example:
Instruction A m
Instruction A m+1
Instruction A m+n
The example given above shows how an Index Register in a program loop can replace a long series of
instructions. In this case, instruction A is repeated n+1 times to perform some operation such as read-
ing and comparing a table of values.
Precautions for Correct Use
Precautions for Correct Use
The following instructions are executed even when the input conditions are OFF. Therefore, when indi-
rect memory addresses are specified using auto-incrementing or auto-decrementing (,IR+ or ,IR-) in an
operand of any of these instructions, the value in the Index Register (IR) is refreshed each cycle regard-
less of the input condition (increases or decreases one every cycle). This must be considered when
writing a program.
Classification
Sequence input instructions
Sequence output instructions
Sequence control instructions
Timer and counter instructions
Comparison instructions
Single-precision floating-point math
instructions
Double-precision floating-point math
instructions
Block programming instructions
Text string processing instructions
The following ladder programming examples show how the index registers are treated.
Example 1
Ladder Program:
LD P_Off
OUT, IR0+
Operation: When the PLC memory address CIO 0.13 is stored in IR0.
CJ2 CPU Unit Software User's Manual
5 Understanding Programming
MOVR(560) m IR0
Instruction A ,IR0+
Instructions
LD, LD NOT, AND, AND NOT, OR, OR NOT, LD TST(350), LD
TSTN(351), AND TST(350), AND TSTN(351), OR TST(350), OR
TSTN(351)
OUT, OUT NOT, DIFU(013), DIFD(014)
JMP(004), FOR(512)
TIM/TIMX(550), TIMH(015)/TIMHX(551), TMHH(540)/TMHHX(552),
TIMU(541)/TIMUX(556), TMUH(544)/TMUHX(557),
TTIM(087)/TTIMX(555), TIML(542)/TIMLX(553),
MTIM(533)/MTIMX(554), CNT/CNTX(546), CNTR(012)/CNTRX(548)
Symbol comparison instructions (LD, AND, OR =, etc.(function codes:
300, 305, 310, 320, and 325))
Single-precision floating-point data comparison (LD, AND, OR = F,
etc.(function codes: 329 to 334))
Double-precision floating-point data comparison (LD, AND, OR = D,
etc.(function codes: 335 to 340))
BPPS(811), BPRS(812), EXIT(806), EXIT(806) NOT, IF(802), IF(802)
NOT, WAIT(805), WAIT(805) NOT, TIMW(813)/TIMWX(816),
CNTW(814)/CNTWX(818), TMHW(815)/TMHWX(817), LEND(810),
LEND(810) NOT
STRING COMPARISON (LD, AND, OR = $, etc. (function codes: 670
to 675))
Stores the PLC memory
address of m in IR0.
Repeats the process
in a loop such as
FOR-NEXT.
5
5-87

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CJ2 CPU UNIT SOFTWARE and is the answer not in the manual?

Questions and answers

Thomas
January 16, 2025

How do I retrieve fault codes from plc: CJ2M-CPU35

Table of Contents

Save PDF