PLC Programming HandbooksPopular ArticlesNavigationUser login |
The ABCs of BCDBinary Coded Decimal (BCD) is a number code that makes all those 1s and 0s in the computer easier for humans to read. In BCD the digits 0 through 9 are stored as 4 bits (a.k.a. a nibble). Thus in a 16-bit word you can have four digits (16 bit word / 4 BCD bits = 4 digits). The figure below demonstrates how to convert a binary number to it's BCD equivalent.
The astute student will see that this is a lot like converting from binary to hexadecimal. In this case though there are no letters like A through F which is part of making it easier to read.  In a pure binary sense the 16-bit word can have a value of 0 to 65535 but BCD limits us from 0 to 9999. What is BCD good for?Most modern control system components like PLCs and HMIs (for example AutomationDirect) make the use of BCD seamless. That is, you use them like you would decimal numbers without knowing the difference. There comes a time though when you'll need to know the difference (for instance when setting up an I/O card). The real use of BCD comes in older types of controls like thumbwheel switches, 7-segment data displays and absolute encoders. For example, the thumbwheel switch will have (at least) four outputs for one digit which represent the binary numbers of that digit. Ganging the thumbwheel switches together then makes a word in BCD format.
|