BCD is an acronym for binary-coded decimal, and means that each digit of a decimal number is expressed as a binary number.
Decimal number |
6 |
4 |
5 |
¯ |
¯ |
¯ |
¯ |
BCD (binary-coded decimal) |
0110 |
0100 |
0101 |
When inputting data from a digital switch to the PLC or outputting data to a 7-segment display (with a decoder), the data must be in BCD format. In such cases, use a data conversion instruction as shown in the examples at below.
BCD arithmetic instructions (F40 to F58) allow BCD data to be used directly. However, since PLCs compute in binary format, BIN operation instructions (F20 to F38) are more convenient.
Input from a digital switch
Use the BCD to BIN conversion instruction F81_BIN.
Output to a 7-segment display (with decoder)
Use the BIN to BCD conversion instruction F80_BCD.