Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
29 Applied Instructions (Data Table Operation)
29.5 DABIN / Decimal ASCII to BIN Conversion
697
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
21
Applied Instructions
(Real Time
Clock Control)
22
Applied Instructions
(External Device)
23
Applied Instructions
(Extension
Function)
24
Applied Instructions
(Others)
25
Applied Instructions
(Block Data
Operation)
26
Applied Instructions
(Character
String Control)
27
Applied Instructions
(Data Operation 3)
28
Applied Instructions
(Data Comparison)
29
Applied Instructions
(Data Table
Operation)
30
Applied Instructions
(External Device
Communication)
2) The numeric range of data stored in the device specified by is from "-2,147,483,648" to
"2,147,483,647".
The high-order byte of + 5 is ignored.
3) As "sign data", "20H (space)" is set when the data to be converted is positive, and "2DH (-)" is set when
the data to be converted is negative.
4) An ASCII code for each digit is within the range from 30H to 39H.
5) When an ASCII code for each digit is "20H (space)" or "00H (NULL)", it is handled as "30H".
Related instructions
Cautions
1) The instruction is provided in the FX3UC PLC Ver. 2.20 or later.
Error
An operation error is caused in the following cases. The error flag M8067 turns ON, and the error code is
stored in D8067.
1) When the sign data is any value other than "20H (space)" or "2DH (-)".
(Error code: K6706)
2) When an ASCII code for each digit stored in to + 2 (5) is any value other than "30H" to "39H",
"20H (space)", or "00H (NULL)".
(Error code: K6706)
3) When the numeric range of to + 2 (5) is outside the following range. (Error code: K6706)
4) When the device specified by exceeds the device range. (Error code: K6706)
Program example
In the program example below, the sign and decimal ASCII codes in five digits stored in D20 to D22 are
converted into a binary value and stored in D0 when X000 turns ON.
Instruction Description
ASCI Converts hexadecimal codes into ASCII codes.
HEX Converts ASCII codes into hexadecimal codes.
STR Converts binary data into a character string (ASCII codes).
VAL Converts a character string (ASCII codes) into binary data.
BINDA Converts binary data into decimal ASCII codes (30H to 39H).
Setting range
16-bit operation -32768 to 32767
32-bit operation -2,147,483,648 to 2,147,483,647
X000
DABINP
EN ENO
d
s
D20
D0
b15 b8 b7 b0
-276
D0
Binary value
36H(6) 37H(7)
20H(space)
32H(2)
2DH(-)
20H(space)
D22
(It is regarded
as "-00276".)
"-
276"
D21
D20
[Structured ladder/FBD]
[ST]
DABINP(X000, D20, D0);