Mitsubishi Electronics FX3G Manuel D’Utilisation

Page de 964
161
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
5 How to Specify Devices and Constants to Instructions
5.7 Indexing
1
Introdu
ction
2
Ov
ervi
ew
3
Instruction 
Li
st
4
D
evices 
in Det
ai
l
5
Specifi
ed the
De
vice
 &
 
C
onst
ant
6
Bef
ore
 
Pr
og
ra
mmi
ng
7
Bas
ic 
Instruction
8
FN
C00-FN
C0
9
Program Fl
ow
9
FNC
10-FN
C19
Mov
e & Com
pare
10
FNC
20-FNC
29
Arith. & Lo
gi
Operati
on
5.7
Indexing
The functions and structures of index registers are explained in detail in "4.11 Index Register [V and Z]".  
Refer to Section 4.11 in advance.
5.7.1
Indexing in basic instructions
In the case of bit devices
Bit devices [X, Y, M (except special auxiliary relays), T, and C (C0 to C199)] used in LD, LDI, AND, ANI, OR, ORI,
OUT, SET, RST, PLS, and PLF instructions can be indexed with index registers.
The figure shown on the right explains an indexing operation with the
index register Z(0) for X000 and M0 in the LD instruction.
Transfer K5 or K10 to the index register Z(0) in advance.
If Z(0) is "5", "X(0+5) = X005".  When X005 turns ON, Y000 turns ON and
"M(0+5) = M5".  When M5 turns ON, Y001 turns ON.
If Z(0) is "10", "X(0+10) = X012
*1
". When X012
*1
 turns ON, Y000 turns ON
and "M(0+10) = M10". When M10 turns ON, Y001 turns ON.
*1.
Refer to the caution 3) below.
• The index registers Z0 to Z7 and V0 to V7 can be used for indexing.
• In OUT instruction for a timer or counter, the timer number (or counter 
number) and the device specified for the set value can be indexed.
Cautions
1) 32-bit counters and special auxiliary relays cannot be indexed with
index registers.
2) It is not permitted to use 16-bit counters as 32-bit counters by
executing indexing.
3) When an octal device number of X or Y is indexed with an index
register, the contents of the index register are converted into octal, and then added to the device number.
For example, when the value of an index register added to the input X000 is changed in the order "K0 
→ K8 →
K16", the device number converted into octal is added to the input X000 and the input number is changed in the
order "X(000+0) = X000 
→ X(000+8) = X10 → X(000+16) = X20".
In the case of word devices and constants
The set value of word devices used in OUT instruction of T and C(0~199) can be indexed with index registers.
The indexing operation is explained in an example in which the set value
D0 of T0 used in the index register V2 indexes OUT instruction (as shown
in the right figure).
Transfer K0 or K10 to the index register V2 in advance.
When X001 is set to ON, "D(0+0) = D0" if V2 is "0", and T0 operates with
the set value D0.
When X001 is set to ON, "D(0+10) = D10" if V2 is "10", and T0 operates
with the set value D10.
Caution
1) When a 32-bit counter is used in OUT instruction, the set value
cannot be indexed with an index register.
X030
FNC 12
MOVP
K5
Z(0)
K5 
→ Z(0)
X030
K10
Z(0)
K10 
→ Z(0)
X000Z(0)
Z(0)=5 : X005=ON 
→ Y000=ON
M5=ON 
→ Y001=ON
Z(0)=10 : X012
*2
=ON 
→ Y000=ON
M10=ON 
→ Y001=ON
FNC 12
MOVP
Y000
M0Z(0)
Y001
*2  Refer to the caution 3).
X030
FNC 12
MOVP
K0
V2
K0 
→ V2
X030
K10
V2
K10 
→ V2
X001
V2 = 0 : The set value of T0 is the
present value of D0.
V2 = 10 : The set value of T0 is the
present value of D10.
FNC 12
MOVP
T 0
D0V2