5 - 23 5 - 23
5 MELSEC FUNCTIONS
5.6 Data Conversion
5.6.1 BIN BCD conversion BCD_M
The specified BIN 16-bit data (0 to 9999) is converted into BCD 4-digit data.
Function definition
BOOL BCD_M (BOOL EN, ANY16 S1, ANY16 D);
Argument Name
IN/OUT
Description
EN IN
Execution condition (Function is executed only when the
result is TRUE)
S1 IN
Data to be converted (BIN 16-bit data)
D
OUT
Conversion result (BCD 4-digit data)
Return Value
Description
BOOL Execution
condition
Example of use
(* When execution condition X0 turns ON, the BIN data stored in D0 is
*)
(* converted into BCD, and the result is stored into D100.
*)
BCD_M (X0, D0, D100);
Corresponding MELSEC command
BCD (Conversion from BIN data to 4-digit BCD data)
5.6.2 32-bit BIN BCD conversion DBCD_M
The specified BIN 32-bit data (0 to 99999999) is converted into BCD 8-digit data.
Function definition
BOOL DBCD_M (BOOL EN, ANY32 S1, ANY32 D);
Argument Name
IN/OUT
Description
EN IN
Execution condition (Function is executed only when the
result is TRUE)
S1 IN
Data to be converted (BIN 32-bit data)
D OUT
Conversion result (BCD 8-digit data)
Return Value
Description
BOOL Execution
condition
Example of use
(* When execution condition X0 turns ON, the BIN data stored in dwData1 is
*)
(* converted into BCD, and the result is stored into Result.
*)
DBCD_M (X0, dwData1, Result);
Corresponding MELSEC command
DBCD (Conversion from BIN data to 8-digit BCD data)
For the usable data type, refer to "3.2.2
About ANY type".
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......