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
Содержание CX-PROGRAMMER V8.1
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ......
Страница 15: ...xvi...
Страница 19: ...xx...
Страница 25: ...xxvi Application Precautions 4...
Страница 26: ...Part 1 Function Blocks...
Страница 27: ......
Страница 153: ...128 Procedures Section 3 2...
Страница 154: ...Part 2 Structured Text ST...
Страница 155: ......
Страница 159: ...134 CX Programmer Specifications Section 4 2...
Страница 205: ...180 Procedures Section 6 1...
Страница 207: ...182 System defined external variables supported in function blocks Appendix A...
Страница 229: ...204 Revision History...
Страница 230: ......