6-70
6.3 Data Conversion Instructions
6.3.2 4-/8-digit BCD data to BIN data conversion
BIN, DBIN
(2) In the following program, the BCD data in X10 to X37 are converted to BIN data when X8 turns
ON, and the result is stored to Var_D0.
(Addition of the BCD data in X20 to X37 converted to BIN data and the BCD data in X10 to
X1F converted to BIN data.)
[Structured ladder]
[ST]
IF X8 THEN
DBINP(TRUE,K6X20,Var_D9);
Var_D5:=Var_D9*10000;
BIN(TRUE,K4X10,Var_D3);
INT_TO_DINT_E(TRUE,Var_D3,Var_D4);
Var_D0:=Var_D5[0];
END_IF;
If a BCD value which exceeds 2147483647 is specified for X10 to X37, the value of Var_D0
becomes a negative value, because it exceeds the range of numeric values that can be
handled by a 32-bit device.
Programma
bl
e
contro
ll
er
out
p
ut
modu
l
e
I
n
p
ut
p
o
w
er
su
ppl
y
BCD
d
i
g
i
ta
l
s
wi
tc
h
X1
3
to
X1
0
X1
7
to
X14
X1
B
to
X1
8
X1F
to
X1
C
X2
3
to
X2
0
X2
7
to
X24
X2
B
to
X2
8
X2F
to
X2
C
X
33
to
X
30
X
37
to
X
3
4
Содержание MELSEC Q Series
Страница 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Страница 2: ......
Страница 14: ...A 12 MEMO ...
Страница 340: ...6 178 MEMO MTR ...
Страница 708: ...7 368 MEMO ...
Страница 776: ...8 68 MEMO ...
Страница 796: ...9 20 MEMO ...
Страница 804: ...App 8 MEMO ...
Страница 812: ...Index 8 MEMO ...
Страница 815: ......