Omron cx-programmer 5.0-function block operation 사용자 설명서

다운로드
페이지 183
49
Precautions for Instructions with Operands Specifying the First or Last of Multiple 
Section 2-5
2-5
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-6 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, specifying +2,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