Omron CJ2 CPU UNIT SOFTWARE User Manual page 244

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

Advertisement

6 I/O Memory Areas
Note The PLC memory addresses are listed in the diagram above, but it isn't necessary to know the PLC memory
addresses when using Index Registers.
Some operands are treated as word data and others are treated as bit data, so the meaning of the
data in an Index Register will differ depending on the operand in which it is used.
• Word Operand:
MOVR(560) 0 IR2
MOV(021) D0 , IR2
When the operand is treated as a word, the contents of the Index Register are used "as is" as the
PLC memory address of a word. In this example MOVR(560) sets the PLC memory address of
CIO 2 in IR2 and the MOV(021) instruction copies the contents of D0 to CIO 2.
• Bit Operand:
MOVR(560) 0.13 ,IR2
SET +5 , IR2
Index registers can also be used to specify bits, like in the SET instruction above. In this example,
MOVR(560) sets the PLC memory bit address of CIO 0.13 in IR2. The SET instruction adds +5 from
bit 13 to this PLC memory address, so it turns ON bit CIO 1.02.
Additional Information
When MOVR(560) is used to set a word address in an index register, the address is stored as
follows:
When MOVR(560) is used to set a bit address in an index register, the address is stored as fol-
lows:
Precautions for Correct Use
Precautions for Correct Use
• Always set the value of an index register (IR) before using the index register. Operation will not
be dependable if an index register is used without first setting its value.
• The value of an index register will not be dependable after an interrupt task is started. When
using an index register in an interrupt task, set the value using MOVR(560) or MOVRW(561)
before using the index register. (MOVRW(561) is used for timer/counter PVs and MOVR(560)
is used for other values.)
Additional Information
• When an Index Register is used as an operand without a "," prefix, the instruction will operate
on the contents of the Index Register itself (a two-word or "double" value). Index Registers can
be directly addressed only in the instructions shown in the following table. Use these instruc-
tions to operate on the Index Registers as pointers.
• The Index Registers cannot be directly addressed in any other instructions, although they can
usually be used for indirect addressing.
6-38
31
Index register
PLC memory address
31
Index register
PLC memory address
0
4 3
0
Bit number
CJ2 CPU Unit Software User's Manual

Advertisement

Table of Contents
loading

Table of Contents