6-90
6.3 Data Conversion Instructions
6.3.10 Gray code to 16-/32-bit BIN data conversion
GBIN, DGBIN
DGBIN(P)
Converts Gray code data in the device specified for
to 32-bit BIN data and stores the result to
the device specified for
.
Values between 0 and 2147483647 can be specified for
.
O
p
erat
i
on
E
rror
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The value of
is outside the range of 0 to 32767 for the GBIN(P) instruction.
(Error code: 4100)
• The value of
is outside the range of 0 to 2147483647 for the DGBIN(P) instruction.
(Error code: 4100)
Program
E
xam
pl
e
(1) In the following program, the Gray code in Var_D100 is converted to the BIN value when
X10 turns ON, and the result is stored to Var_D200.
[Structured ladder]
[ST]
GBINP(X10,Var_D100,Var_D200);
(2) In the following program, the Gray code in Var_D10 is converted to the BIN value when X1C
turns ON, and the result is stored to Var_D0.
[Structured ladder]
[ST]
DGBINP(X1C,Var_D10,Var_D0);
s
d
s
0
BIN 30
5
4
1
989
6
0
0
1
0 0
1
0 0 0
1 1
0
1
0 0 0
1
0
1
0
1 1
0 0
1 1 1 1
0 0 0
0
Gray code 30
5
4
1
989
6
0
0
1 1
0
1 1
0 0
1
0
1 1 1
0 0
1 1 1 1 1
0
1
0
1
0 0 0
1
0 0
b
3
1
b16
b
0
b15
b
3
1
b16
b
0
b15
s
d
s
d
(
Upp
er
16
b
its)
(Lo
w
er
16
b
its)
s
s
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......