Mitsubishi Electric MELSEC-Q Structured Programming Manual page 137

Hide thumbs Also See for MELSEC-Q:
Table of Contents

Advertisement

FXCPU Structured Programming Manual
[Device & Common]
2. Indexing of operands in a 32-bit operation
In a 32-bit instruction, it is also necessary to
specify a 32-bit index register in the instruction.
When handling 32-bit data in a structured
program, however, direct specification of 16-bit
devices is not available, different from a simple
project. Use a label when handling 32-bit data.
(32-bit counters can be specified directly because
they have 32-bit data length.)
When an index register Z (Z0 or later) is specified
in a 32-bit instruction, the specified Z and its
counterpart V (V0 or later) work together as a 32-
bit register.
The right figure shows an example of the indexing
operation in which the transfer destination C235
(32-bit counter) in the DMOV instruction is indexed
with the index registers V4 and Z4.
Transfer K0 or k10 to the index registers V4 and
Z4 in advance.
When X003 is set to ON and if V4 and Z4 are "0",
K69000 is transferred to C235 (C (235+0) =
C235).
When X003 is set to ON and if V4 and Z4 are "10",
K69000 is transferred to C245 (C (235+10) =
C245).
Cautions
1) Even if a numeric value written to index registers does not exceed the 16-bit numeric range (0 to 32767),
make sure to overwrite both V and Z using a 32-bit instruction. If only Z is overwritten and another
numeric value remains in V, the resulting numeric value will be extremely large and an operation error will
occur.
2) It is not allowed to index 16-bit counters and use them as 32-bit counters.
When 32-bit counters are required as the result of indexing, add Z0 to Z7 to counters C200 and later.
3) It is not allowed to index V and Z themselves.
4) Direct specification of buffer memory in special function blocks/units
In the direct specification of buffer memory "U \G ", the buffer memory number can be indexed with
index registers.
The unit number cannot be indexed with index registers.
("U0\G0Z0" is valid, but "U0Z0\G0" is invalid.)
5) Indexing in bit digit specification
It is not allowed to index "n" in "Kn" used for digit specification.
("K4M0Z0" is valid, but "K0Z0M0" is invalid.)
6) Indexing in I/O relays (octal device numbers)
When the octal device number of X, Y, KnX or
KnY is indexed with an index register, the
contents of the index register are converted
into octal, and then added to the device
number.
The right figure shows an example of the
indexing operation in which Y000 to Y007 are
output by the MOV instruction and inputs are
switched by indexing to "X007 to X000", "X017
to X010" or "X027 to X020".
When the index value is overwritten by "K0",
"K8" and "K16", the device number converted
into octal is added in the way "X000 + 0 =
X000", "X000 + 8 = X010" and "X000 + 16 =
X020", and the input terminal working as the
source is changed accordingly.
3 How to Specify Devices and Constants in Instructions
DMOVP
X002
EN
s
K0
DMOVP
X002
EN
s
K10
DMOVP
X003
EN
s
K69000
V4,Z4=0 : K69000
C235 (C235+0)
V4,Z4=10 : K69000
C245 (C235+10)
MOVP
X030
EN
s
K0
MOVP
X031
EN
s
K8
MOVP
X032
EN
s
K16
MOV
X033
EN
s
K2X0V3
V3=0 : X7 to X0
Y7 to Y0
V3=8 : X17 to X10
Y7 to Y0
V3=16 : X27 to X20
Y7 to Y0
3.7 Indexing
ENO
K0
V4, Z4
d
Z4
ENO
K10
V4, Z4
d
Z4
ENO
d
C235Z4
ENO
K0
V3
d
V3
ENO
K8
V3
d
V3
ENO
K16
V3
d
V3
ENO
d
K2Y0
135
1
2
3
4
5
6
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec-lMelsec-fFx3sFx3gFx3gcFx3u ... Show all

Table of Contents