EasyManua.ls Logo

Mitsubishi Electric MELSEC iQ-R Series - Converting STRING to BCD

Mitsubishi Electric MELSEC iQ-R Series
2110 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
1874
25 TYPE CONVERSION FUNCTIONS
25.58 Converting STRING to BCD
25.58 Converting STRING to BCD
STRING_TO_BCD(_E)
These functions convert a value from STRING data type to BCD data type.
Setting data
Description, type, data type
Processing details
Operation processing
These functions convert the value input to (s) from STRING data type to BCD (WORD) data type, and output the converted
value from (d).
The ASCII code 20H (space) that exists in the the string is ignored.
The ASCII codes 20H (space) and 30H (0) that exist in the string are counted as one character as well.
Input a STRING data type value to (s) within the following range.
If the string input has less than four characters, the string will be supplemented with zero(s). (Zero(s) is/are added at the
end of the string.) For this reason, if a string shorter than four characters is to be converted, input a character string padded
with 0s (e.g. '0001' for '1').
If the string length exceeds 4 characters, the four left characters are regarded as the targets to convert.
WORD or DWORD data type can be specified for (d). BOOL data type cannot be specified.
Ladder, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=STRING_TO_BCD(s);
[With EN/ENO]
d:=STRING_TO_BCD_E(EN,ENO,s);
Argument Description Type Data type
EN Execution condition (TRUE: Executed, FALSE: Not executed) Input variable BOOL
s (IN) Input Input variable STRING(8)
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d Output Output variable ANY_BIT
ASCII code: 30H to 39H, 20H, 00H
Input string Conversion target string Output (BCD data type)
'1' '1000' 1000H (4096D)
'12' '1200' 1200H(4608D)
'123' '1230' 1230H(4656D)
'1234' '1234' 1234H(4660D)
'12345' '1234' 1234H(4660D)
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
sd
EN ENO
ds
(s)
(d)
9999H9999
BCD (WORD)STRING

Table of Contents

Other manuals for Mitsubishi Electric MELSEC iQ-R Series

Related product manuals