Overview
Digital circuits use the binary number system, while people commonly use the decimal system. It is therefore necessary to provide a conversion mechanism between binary and decimal to facilitate interpretation and analysis of digital systems.
Binary-coded decimal (BCD) is a coding method that represents decimal numbers using binary digits.
What is BCD
BCD stands for "Binary-Coded Decimal". Conceptually it represents decimal numbers. BCD uses four binary bits to represent one decimal digit, with each 4-bit group allowed to range from 2#0000 to 2#1001, i.e. decimal 0 to 9, following the carry-on-ten rule.


Signed BCD and Ranges
BCD can be signed by using the most significant bit as a sign bit: "0" indicates positive, "1" indicates negative. For a four-digit BCD number (16 binary bits), the representable decimal range is -999 to +999. The sign bit consumes the highest position, leaving three decimal digits, each up to 9, hence the range.
Similarly, an eight-digit BCD number (32 binary bits) can represent -9,999,999 to +9,999,999.
PLC Implementations
In Siemens S7-300/400/1200/1500 controllers, BCD16 represents decimal values from -999 to +999. Bit 15 is the sign bit: 0 is positive, 1 is negative. Bits 12 to 14 are unused. BCD32 represents decimal values from -9,999,999 to +9,999,999.
In Schneider PLCs, for example on the Unity Pro XL platform, BCD16 represents decimal values from 0 to 9,999. BCD32 represents values from 0 to 99,999,999.
In Mitsubishi PLCs, for example on the GX Works2 platform, BCD16 represents decimal values from 0 to 9,999. BCD32 represents values from 0 to 99,999,999.

Usage in PLC Systems
PLC internal calculations are generally performed in hexadecimal format. When driving non-intelligent display devices, such as seven-segment displays, PLC internal hexadecimal data is often converted to BCD before output to the display. Conversely, when storing parameters that users enter in decimal form into PLC memory, those decimal values are commonly converted from BCD into hexadecimal format first.
The decimal readings shown on a computer display are produced after the computer software converts internal data to BCD for presentation. Parameters modified through supervisory software are converted into hexadecimal by the software before being written into PLC memory, so no manual conversion is required.

8421 Code
The 8421 code is the most commonly used BCD encoding. In this scheme, each decimal digit is represented by a corresponding 4-bit binary value where each bit weight corresponds to a fixed decimal value. Summing the decimal values represented by the bits yields the represented decimal digit. From left to right, the bit weights are 8, 4, 2, and 1, hence the name 8421 code.
Conversion Tools
Manual conversion methods are shown above, but in practice conversion tools are typically used. For example, the Microsoft Calculator includes conversion functions.
Press Windows key+R, type "calc" and press Enter to open the built-in Calculator.
Open the View menu and choose Programmer mode to perform conversions between number bases.
Note
Note 1: In PLC contexts, binary data is commonly prefixed with "2#", hexadecimal data with "16#", while decimal data is written normally.