![Omron SYSMAC CX-Programmer 9 Operation Manual Download Page 91](http://html1.mh-extra.com/html/omron/sysmac-cx-programmer-9/sysmac-cx-programmer-9_operation-manual_744241091.webp)
65
Precautions for Instructions with Operands Specifying the First or Last of Multiple Words
Section 2-6
2-6
Precautions for Instructions with Operands Specifying the
First or Last of Multiple Words
When using ladder programming to create function blocks with instruction
operands specifying the first or last of a range of words, the following precau-
tions apply when specifying variables for the operand.
When the operand specifies the first or last word of multiple words, the
instruction operates according to the internally allocated address for AT set-
ting (or external variable setting). Therefore, the variable data type and num-
ber of array elements are unrelated to the operation of the instruction. Either
specify a variable with an AT setting, or an array variable with a size that
matches the data size to be processed by the instruction.
For details on whether an AT setting (or external variable setting) or an array
setting for a number of elements is required to specify the first address of a
range of words in the instruction operand, refer to
2-7 Instruction Support and
Operand Restrictions
.
Note
To specify the first or last of multiple words in an instruction operand, always
specify a variable with AT setting (or an external variable), or a variable with
the same size as the data size to be processed in the instruction. The follow-
ing precautions apply.
1,2,3...
1.
If a non-array variable is specified without AT setting and without a match-
ing data size, the CX-Programmer will output an error when compiling.
2.
The following precautions apply to when an array variable is specified.
2) Specifying constant offset of Index Register (Specifying a bit between
CIO n+0 to n+24)
The real I/O memory address for CIO 1500
+ (
UnitNo
×
&25) is stored in Index Register
IR0 by the processing in step 1 above.
Therefore the word address is specified
using the constant offset from IR0.
For example, spec2,IR0 will specify
CIO 1500 + (
UnitNo
×
&25) + 2.
Note
CIO 1500 + (
UnitNo
×
&25) + 2 can
also by specified by specifying
SCPU_relay [2]
using the array set-
ting with
SCPU_relay
.
Specify bit addresses using instructions that
can specify bit addresses within words
(e.g., second operand of TST(350/351)/
SETB(532) instructions).
Example: Variable
NodeSelf_OK
turns ON
when
NetCheck_OK
(internal variable,
BOOL data type) is ON and bit 15 of the
word at the +6 offset from IR0 (CIO 1500 +
UnitNo
×
&25 +6) is ON.
Returning the Index Register to the Prior Value
The Index Register returns to the original
value after this function block is completed
(or after the Index Register has been used).
Example: The value for variable
SaveIR[0]
that was saved is stored in Index Register
IR0, and the value is returned to the con-
tents from when this function started (or
prior to using the Index Register).
Example
Details
Check local node data link participation
Restore data to IR0 from temporary backup buffer
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......