These functions convert from integer values to BCD:
| Function Name | Description |
|---|---|
| SINT_TO_BCD_BYTE | Convert a small integer (SINT) to two BCD digits encoded in a BYTE. |
| INT_TO_BCD_WORD | Convert an integer (INT) to four BCD digits encoded in a WORD. |
| DINT_TO_BCD_DWORD | Convert a double integer (DINT) to eight BCD digits encoded in a DWORD. |
| LINT_TO_BCD_LWORD | Convert a long integer (LINT) to sixteen BCD digits encoded in a LWORD. |
SINT_TO_BCD_BYTE( 69 )
The function call returns 16#69. The bit pattern 0100 0101 is converted to 0110 1001.
INT_TO_BCD_BYTE( 1000 )
The function call returns 16#1000. The bit pattern 0000 0011 1110 1000 is converted to 0001 0000 0000 0000.
IEC 61131-3 Second Edition: Table 22.4.
IEC 61131-3 Third Edition: Table 22.4.
To learn about converting BCD to Integers.
Conversion FunctionsTo learn about other conversion functions.
For the meaning of terms used in Fernhill SCADA.