3 how to use subscripts i, j, 1) bit type attached with a subscript, 2) integer type attached with a subscript – Yaskawa MP2000 Series: User's Manual for Motion Programming User Manual
Page 87

6.3 How to Use Subscripts i, j
6-15
6
Variables (Registers)
6.3 How to Use Subscripts i, j
Two type of registers (i, j) are available as dedicated registers to modify the relay and register numbers. Both i
and j have the same function. They are used when you want to handle a register number as a variable.
An example for each register data type is given as explanation.
(1) Bit Type Attached with a Subscript
(2) Integer Type Attached with a Subscript
(3) Long Integer or Real Type Attached with a Subscript
Program example using subscript is as follows.
The result is a register number added with i or j
value.
For example, MB000000i for i=2 is the same
as MB000002. Also, MB000000j for j=27 is
the same as MB00001B.
I=2;
DB000000=MB000000i;
DB000000=MB000002;
Equivalent
Equivalent
The result is a register number added with i
or j value.
For example, MW00010i for i=3 is the same
as MW00013. Also, MW00001j for j=30 is
the same as MW00031.
DW00000=MW00031;
DW00000=MW00001j;
J=30;
The result is a register number with an added i or j
value.
For example, “ML00000j for j=1” is the same as
ML00001. Also, “MF00000j for j=1” is the same as
MF00001.
For double integer registers and real number regis-
ters, one word of register number and one word of
one added register number are used. Be careful to
avoid overlapping one with the other when using
subscripts. For ML00000j when j = 0 and
ML00000j when j = 1, for example, one word of
MW00001 will be overlapped.
ML00000j for j = 0: ML00000
ML00000j for j = 1: ML00001
Upper word
Long integer type
MW00001
Lower word
MW00000
MW00002
MW00001
MF00000j for j = 0: MF00000
MF00000j for j = 1: MF00001
Upper word
Real type
MW00001
Lower word
MW00000
MW00002
MW00001
EXAMPLE
:
:
ML00200 = 0 ;
J = 0 ;
WHILE J < 100 ;
ML00200 = ML00200 + ML00100j ;
J = J + 2 ;
WEND ;
:
:
The left program uses a subscript j and calculates the
total amount of 50 registers from ML00100 to
ML00198, and stores the total amount in ML00200.