5 Applied Functions
5.1 Type Conversion Functions
110
FXCPU Structured Programming Manual
(Application Functions)
Error
1) When the sign data (low-order byte) of the 1st word stored in a device specified in is any other than
"20H (space)" or "2DH (-)"
(Error code: K6706)
2) When the ASCII code for each place (digit) stored in to +2 is any other than "30H" to "39H",
"20H (space)" or "00H (NULL)"
(Error code: K6706)
3) When the value stored in to +2 is outside the following range:
-32768 to +32767
(Error code: K6706)
4) When any of devices to +2 exceeds the device range
(Error code: K6706)
Program example
In this program, string data stored in a device specified in is converted into word [signed] data, and the
data obtained by conversion is output to a device specified in .
1) Function without EN/ENO(STR_TO_INT)
2) Function with EN/ENO(STR_TO_INT_E)
[Structured ladder]
[ST]
[Structured ladder]
[ST]
s
s s
s s
s s
s
d
g_int1=-12345
STR_TO_INT
g_string1="-12345"
_STRING
g_int1 := STR_TO_INT(g_string1);
STR_TO_INT_E
EN ENO
g_int1
g_bool1
g_string1 _STRING
g_bool3
g_bool3 := STR_TO_INT_E(g_bool1, g_string1, g_int1);