5-100
5.1 Type Conversion Functions
5.1.32 String type
→
BCD type conversion
STR_TO_BCD(_E)
Operation Error
An operation error occurs in the following cases.
• The input character string is outside the range of ASCII code '30
H' to '39H'.
(Error code 4100)
• The input character string is within the range of ASCII code '30
H' to '39H' and exceeding
'9999'. (Error code 4100)
Program Example
The program which converts string type data input to into BCD type data, and outputs the
operation result from .
(a) Function without EN/ENO (STR_TO_BCD)
[Structured ladder]
[ST]
g_word1 := STR_TO_BCD (g_string1);
(b) Function without EN/ENO (STR_TO_BCD_E)
[Structured ladder]
[ST]
g_bool3 := STR_TO_BCD_E (g_bool1, g_string1, g_word1);
s
d