Using Index Registers - Omron CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION Operation Manual

Function blocks
Table of Contents

Advertisement

Function Block Applications Guidelines
Instance for function block definition A.
&3
2-4-6

Using Index Registers

Note
46
3. Add the unit number offset to the real I/O memory address within the Index
Register (e.g., IR0).
Example 2: Specifying the Designated Bit in the CIO Area (e.g., CIO Word
n+a, Bit b)
Programs: Use either of the following methods.
• Word addresses: Specify the constant offset of the Index Register using
an indirect specification (e.g., +a,IR0).
• Bit addresses: Specify an instruction that can specify a bit address within
a word (e.g., &b in second operand of SETB instruction when writing and
TST instruction when reading).
Example: Special I/O Units
Unit No.
Index Registers IR0 to IR15 function as pointers for specifying I/O memory
addresses. These Index Registers can be used within function blocks to
directly specify addresses using IR0 to IR15 and not the variable names
(Index Register direct specification: IR0 to IR15; Index Register indirect speci-
fication: ,IR0 to ,IR15)
After storing the real I/O memory addresses in the Index Registers using the
MOVR(560) instruction, Index Registers can be indirectly specified using gen-
eral instructions. This enables all I/O memory areas to be specified dynami-
cally.
1) Specify the first CIO Area word n (n = CIO 2000 + unit number × 10)
Used constants:
Unit number (input variable, INT data type)
Offset (internal variable, DINT data type)
Relay (internal variable, WORD data type, 400 array elements, AT
setting = 2000)
Multiplies unit number by
&10
&10 and stores in offset.
Unit No.
Offset
Stores the real I/O memory
MOVR
address for the relay in IR0.
Relay
IR0
Adds offset to IR0.
+L
IR0
Offset
IR0
2) Specify the designated bit in the CIO
Area (e.g., CIO word n+1, bit 02)
Turns ON CIO word n+1,
SETB
bit 02.
+1,IR0
&2
Section 2-4

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-programmer 5.0Sysmac ws02-cxpc1-e-v50Cs1-hCj1-hCj1m

Table of Contents