Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
26 Applied Instructions (Character String Control)
26.1 STR / BIN to Character String Conversion
621
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)
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 number of all digits stored in is outside the following range (error code: K6706).
2) When the number of digits of the decimal part stored in + 1 is outside the following range (error
code: K6706).
3) When the relationship between the number of all digits stored in and the number of digits of the
decimal part stored in + 1 does not satisfy the following (error code: K6706).
(Number of all digits - 3) number of digits of decimal part
4) When the number of all digits stored in including the digit for sign and the digit for decimal point is
smaller than the number of digits of the binary data stored in (error code: K6706).
5) When the devices and later storing a character string exceed the corresponding device range (error
code: K6707).
Program examples
In the program below, the 16-bit binary data stored in D10 is converted into a character string in accordance
with the digit specification by D0 and D1 when X000 is set to ON, and then stored in D20 to D23.
Setting range
16-bit operation 2 to 8
32-bit operation 2 to 13
Setting range
16-bit operation 0 to 5
32-bit operation 0 to 10
[Structured ladder/FBD] [ST]
X000
Data to be converted
is set.
The number of all
digits is set.
The number of digits
of the decimal part is set.
STRP
EN ENO
d
s1
s2
MOVP
EN
s
ENO
d
D10
K12672
MOVP
EN
s
ENO
d
D0
K6
MOVP
EN
s
ENO
d
D1K0
D10
D0
D20
MOVP(X000,K12672,D10);
MOVP(X000,K6,D0);
MOVP(X000,K0,D1);
STRP(X000,D0,D10,D20);
12672
6
0
D10
D0
D1
Number of all digits
Number of digits of decimal part
16-bit binary data
12672"
"
b15 b8 b7 b0
D20 31H(1)
36H(6)
0000H
20H(Space)
34H(2)
32H(2) 37H(7)
D21
D22
D23