# Binary Coded Decimals - Programmable Logic controllers

Because the external world tends to deal mainly with numbers in the denary system and computers with numbers in the binary system, there is always the problem of conversion.

There is, however, no simple link between the position of digits in a denary number and the position of digits in a binary number. An alternative method that is often used is the binary coded decimal system (BCD). With this system, each denary digit is coded separately in binary. For example, the denary number 15 has the 5 converted into the binary number 0101 and the 1 into 0001:

1 5 Denary number

0001 0101 Binary number

to give the number 0001 0101 in BCD. With the BCD system, the largest decimal number that can be displayed is a 9, and so the four binary digits are 1001.

To convert a BCD number to a denary number, each group of four binary numbers is separately converted to a denary number. For example, the BCD number 0011 1001 has adenary number of 3 for 0011 and 9 for 1001, and so the denary number is 39.

0011 1001 BCD number

3 9 Denary number

Numeric data is often entered into PLCs by rotary or thumb-wheel switches with a 0 to 9 range. Thus there may be a bank of such switches, one giving, say, the hundreds, one the tens, and one the ones. The output from each switch is then converted, independently, into binary to give the overall result of a binary coded decimal number. Some PLCs have a function that can be called up to convert such BCD numbers to binary numbers; in other PLCs it has to be done by programming.

Programmable Logic controllers Topics