What is Binary Coded Decimal (BCD) and How is it Used in Automation?
In the vast and complex world of industrial automation, understanding various data representations is crucial for efficient system design, programming, and troubleshooting. Among these, Binary Coded Decimal (BCD) stands out as a unique and historically significant method for representing numerical data. While pure binary is the fundamental language of computers, Binary Coded Decimal (BCD) offers a bridge between the binary world of machines and the decimal world of humans, playing a vital role in many automation applications, particularly in legacy systems and human-machine interfaces (HMIs).
This comprehensive guide will delve deep into what BCD is, how it works, its historical context in automation, its practical applications in modern and legacy PLC systems, and why it remains a relevant concept for industrial professionals today. By the end of this article, you'll have a clear understanding of BCD and its indispensable role in keeping our industrial processes running smoothly.
Understanding Binary Coded Decimal (BCD): The Basics
At its core, Binary Coded Decimal (BCD) is a system where each decimal digit (0-9) is represented by its own 4-bit binary code. This differs significantly from pure binary representation, where an entire decimal number is converted into a single binary value.
Let's break down how BCD works:
- Decimal Digits: We use ten decimal digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
- 4-Bit Binary Representation: Each of these decimal digits is assigned its corresponding 4-bit binary code. Since 24 = 16, a 4-bit nibble can represent 16 distinct values (0000 to 1111). In BCD, however, only the first ten of these (0000 to 1001) are used. The binary codes 1010 through 1111 (decimal 10 through 15) are considered invalid BCD digits.
Here’s the mapping:
| Decimal Digit | BCD (4-bit binary) |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
How BCD Differs from Pure Binary
To grasp BCD fully, it's essential to compare it with pure binary representation. Consider the decimal number 123:
- Pure Binary: The decimal number 123 is converted as a whole into its binary equivalent.
- 123 (decimal) = 01111011 (8-bit binary)
- Binary Coded Decimal (BCD): Each digit of the decimal number is converted individually into its 4-bit BCD code.
- 1 (decimal) = 0001 (BCD)
- 2 (decimal) = 0010 (BCD)
- 3 (decimal) = 0011 (BCD)
- Therefore, 123 (decimal) = 0001 0010 0011 (12-bit BCD)
As you can see, BCD often requires more bits to represent the same decimal number compared to pure binary. While this makes BCD less efficient in terms of storage and processing for internal computations, its simplicity in converting to and from decimal makes it incredibly useful for applications that directly interface with human operators.

Why Binary Coded Decimal (BCD) Found Its Niche in Industrial Automation
The prevalence of BCD in industrial automation, particularly in older systems, is rooted in several practical advantages that align perfectly with the needs of early digital control systems:
Human Readability and Interface Simplicity
Engineers, technicians, and operators think in decimal. When a machine needs to display a count, a setpoint, or a measured value, presenting it in decimal format is intuitive and reduces the chance of misinterpretation. Early digital displays, such as 7-segment LED displays, were much simpler and cheaper to design if they directly processed BCD inputs rather than converting complex pure binary numbers to decimal for display.
Legacy Equipment Compatibility
Many older Programmable Logic Controllers (PLCs), dedicated timers, counters, digital readouts, and Human-Machine Interface (HMI) devices were designed to operate natively with BCD. This was largely due to the limited processing power of early microprocessors, which made on-the-fly binary-to-decimal or decimal-to-binary conversions computationally expensive and slow for every display update or input scan.
Reduced Conversion Errors
By using BCD, the hardware logic required to convert between the digital system's internal representation and the human-readable decimal format was significantly simplified. This reduced the complexity of circuits and the potential for conversion errors, especially in systems where reliability was paramount.
Direct Input Mechanisms
Components like thumbwheel switches, which allow operators to directly dial in a decimal number, often output their value in BCD format. This direct input method eliminates the need for an analog-to-digital converter or a complex binary encoder, simplifying the hardware design and programming.
Practical Applications of BCD in PLC Systems
Even in modern automation, BCD continues to appear in various forms, especially when dealing with legacy integration or specific types of human-machine interaction. Here are some key practical applications of Binary Coded Decimal in PLC systems:

1. Timers and Counters
One of the most common applications for BCD is in PLC timers and counters. Many older PLC platforms and even some contemporary ones allow the preset values (PV) and accumulated values (ACC) of timers and counters to be stored in BCD format. This makes it straightforward to display these values directly on older HMI panels or dedicated digital displays without complex programming to convert them. For instance, if a timer's preset is 100 seconds, it might be stored as 0001 0000 0000 BCD in a 16-bit register.
2. Thumbwheel Switches and DIP Switches
Thumbwheel switches are physical input devices that allow an operator to set a numerical value by rotating individual digits. Each digit of a thumbwheel typically outputs its value in BCD. For example, a three-digit thumbwheel set to "123" would output three 4-bit BCD values: 0001, 0010, and 0011. PLCs can directly read these BCD inputs, making them ideal for setting parameters like batch sizes, speed limits, or recipe numbers.
3. Older HMIs and Display Units
Many legacy Human-Machine Interfaces (HMIs) and dedicated digital display modules were designed to directly interpret and display BCD data. This simplified the communication protocol between the PLC and the display, reducing the processing overhead required to update values on screen. While modern HMIs are more flexible, understanding BCD is crucial when integrating with or maintaining systems that still use these older display technologies.
4. BCD-to-7-Segment Decoders
These are common hardware components that take a 4-bit BCD input and convert it into the appropriate signals to drive a 7-segment LED or LCD display. This direct conversion capability is a prime example of BCD's design for human readability at the hardware level.
5. Digital Readouts and Panel Meters
Various industrial instruments and process control systems, such as flow meters, temperature controllers, and weigh scales, historically used BCD outputs to communicate their measured values to external systems or for local display. Integrating these devices with a PLC often involves reading BCD data.
6. Interfacing with Legacy Devices
In brownfield sites, it's common to find modern PLCs needing to interface with older sensors, actuators, or control panels that communicate using BCD. Understanding BCD is essential for correctly interpreting these signals and ensuring proper data exchange between new and old components. This often involves specific industrial communication protocols or direct I/O connections configured for BCD.
Working with BCD in PLC Programming
When programming PLCs, you'll encounter BCD primarily in two scenarios: reading input from BCD devices or preparing data for output to BCD displays/devices. PLCs, for the most part, perform arithmetic operations in pure binary. Therefore, conversion between BCD and binary is a frequent requirement.
Data Types and Instructions
Most PLC programming environments provide specific instructions for handling BCD data:
- BIN to BCD (Binary to BCD): This instruction converts a pure binary number into its BCD equivalent. You would use this when a calculation result (in binary) needs to be displayed on a BCD-compatible device or sent to a BCD output.
- BCD to BIN (BCD to Binary): This instruction converts a BCD number into its pure binary equivalent. This is crucial when you read a BCD value from an input device (like a thumbwheel) and need to perform mathematical operations or comparisons with it, as most PLC arithmetic instructions operate on binary numbers.
Different PLC manufacturers (e.g., Siemens, Rockwell Automation, Omron, Mitsubishi) will have their own mnemonics and syntax for these instructions (e.g., BCD_TO_INT, DCD_TO_INT, FRD, TOD, etc.), but their function remains the same. You might find these instructions under "Data Conversion" or "Math Functions" in the PLC's instruction set.
Example Scenario in PLC Logic
Imagine a scenario where an operator sets a target production count using a three-digit thumbwheel switch, and the PLC needs to compare this target with an actual count from a sensor:
- The PLC reads the input from the thumbwheel switch, which provides a BCD value (e.g., 0001 0010 0011 for 123).
- This BCD value is then converted to pure binary using a "BCD to BIN" instruction. So, 0001 0010 0011 BCD becomes 01111011 BIN.
- The PLC's internal counter (which operates in binary) increments based on sensor pulses.
- The PLC can now directly compare the binary target value from the thumbwheel with the binary actual count value.
- If the PLC needs to display the actual count on an older BCD display, the binary count value would first be converted back to BCD using a "BIN to BCD" instruction.
Understanding data types in PLC programming is critical here, as misinterpreting a BCD value as a binary integer (or vice versa) can lead to unexpected and incorrect system behavior.
Advantages and Disadvantages of Binary Coded Decimal
While BCD has played a significant role in automation, it comes with its own set of pros and cons:
Advantages of BCD:
- Ease of Human Interaction: The primary advantage is the straightforward conversion between decimal (how humans think) and BCD (how machines can easily represent decimal digits). This simplifies the design of user interfaces and display hardware.
- Simpler Display Hardware: Driving 7-segment displays directly from BCD is much simpler than from pure binary, requiring less complex decoding logic.
- No Rounding Errors for Exact Decimal Representation: For applications where exact decimal representation is critical (e.g., financial calculations, or very precise measurement displays), BCD prevents the minor rounding errors that can sometimes occur when converting decimal fractions to binary and back. While less common for integers in automation, it highlights a fundamental characteristic.
- Compatibility with Legacy Systems: Essential for integrating with and maintaining older industrial equipment that natively uses BCD.
Disadvantages of BCD:
- Inefficiency in Storage: BCD is less efficient than pure binary in terms of memory usage. For example, a 16-bit word can represent 0-65,535 in pure binary, but only 0-9,999 in BCD (as it stores four 4-bit BCD digits). This means more bits are required to store the same range of numbers.
- Complex Arithmetic Operations: Performing arithmetic operations (addition, subtraction, multiplication, division) directly on BCD numbers is significantly more complex than on pure binary numbers. This requires specialized BCD arithmetic circuits or complex software routines. Most PLCs convert BCD to binary for calculations and then convert the result back to BCD if needed.
- Reduced Data Range per Word: As mentioned, a given word size can represent a much smaller range of numbers in BCD compared to pure binary.
- Less Common in Modern Internal Logic: With powerful microprocessors and abundant memory, modern PLC internal logic and communication protocols predominantly use pure binary, integers, or floating-point numbers for efficiency and computational ease.
BCD in the Modern Automation Landscape: Still Relevant?
In an era dominated by high-speed processors, vast memory capacities, and advanced communication protocols, one might wonder if Binary Coded Decimal still holds relevance. While modern PLCs, Distributed Control Systems (DCS), and HMIs primarily operate using pure binary, integer, and floating-point representations internally, BCD is far from obsolete.
Its relevance continues in several key areas:
- Legacy System Integration: This is perhaps the strongest argument for BCD's continued importance. Many industrial facilities operate with equipment that is decades old. Integrating new control systems with existing machinery often means dealing with devices that communicate or expect data in BCD format. Automation professionals must be proficient in BCD to ensure seamless communication and data exchange in these mixed environments.
- Niche Applications and Specialized Hardware: Certain specialized industrial sensors, actuators, or dedicated controllers might still utilize BCD for specific functionalities, especially where direct decimal representation is paramount, or in applications requiring very high immunity to noise on individual bit lines where a 4-bit BCD group is more robust than a full binary word that could be corrupted by a single bit error.
- Foundational Knowledge: Understanding BCD provides valuable insight into the evolution of digital control systems and the trade-offs involved in data representation. It helps automation engineers appreciate why certain design choices were made in the past and how to effectively bridge the gap between human-centric decimal systems and machine-centric binary systems.
- Education and Training: BCD is often included in fundamental courses on digital logic and PLC programming. It serves as an excellent example of how different number systems are employed in practical applications and reinforces the concepts of binary representation.
In essence, while BCD may not be the primary internal data format for computations in new systems, its role in bridging the gap between digital electronics and human interaction, coupled with the need for legacy system integration, ensures its continued presence in the automation engineer's toolkit.
Practical Tips & FAQs about Binary Coded Decimal (BCD)
Working with BCD in automation requires a careful approach. Here are some practical tips and answers to frequently asked questions:
Practical Tips:
- Always Convert for Arithmetic: This cannot be stressed enough. If you read a BCD value from an input and need to perform any mathematical operation (addition, subtraction, scaling, comparison for range), you must convert it to pure binary (or integer/floating point) first. Perform the arithmetic, then convert the result back to BCD only if it needs to be output to a BCD-compatible device or display.
- Understand Your PLC's BCD Handling: Each PLC manufacturer and platform might have slightly different ways of handling BCD data and specific instructions for conversion. Always consult the programming manual for your specific PLC (e.g., Siemens TIA Portal, Rockwell Studio 5000, Omron CX-Programmer). Be aware of whether a register is implicitly treated as BCD or if explicit conversion is always necessary.
- Watch for Data Type Mismatches: Incorrectly assuming a memory register holds a BCD value when it's actually an integer (binary), or vice-versa, can lead to incorrect readings, unexpected program behavior, and system malfunctions. Always double-check the data type expected by your instructions and devices.
- Consider Communication Protocols: When integrating devices, be mindful of the data format specified by the communication protocol. Some protocols might specify BCD for certain data points.
- Debug Carefully: When troubleshooting BCD-related issues, pay close attention to the raw bit patterns. A value of 0x1A (hexadecimal) in a register might look like decimal 26 in a binary interpretation, but if it's meant to be BCD, it's an invalid BCD digit (1010).
Frequently Asked Questions (FAQs):
Q1: Is BCD a standard data type in all PLCs?
A1: While BCD conversion instructions (e.g., BIN to BCD, BCD to BIN) are almost universally available across all major PLC brands, BCD itself is not always a native, explicitly declared "data type" in the same way an INT or REAL is. Some older PLCs might implicitly treat certain input/output registers or specific memory areas as BCD by default, but modern PLCs typically require explicit conversion instructions.
Q2: Can I perform arithmetic directly on BCD numbers in a PLC?
A2: Generally, no. Most PLC arithmetic instructions (ADD, SUB, MUL, DIV) are designed to operate on pure binary integer or floating-point numbers. Attempting to perform arithmetic directly on BCD numbers without conversion will lead to incorrect results. Always convert BCD to binary for calculations.
Q3: What's the maximum value a typical BCD word can hold?
A3: A standard 16-bit word in a PLC can typically hold four BCD digits (4 bits per digit). This means it can represent any decimal number from 0000 to 9999. If you need to represent larger numbers in BCD, you would typically use a 32-bit double word, which can hold eight BCD digits, allowing for numbers from 0 to 99,999,999.
Q4: Why don't modern systems just use pure binary everywhere?
A4: Modern systems *do* primarily use pure binary (and floating-point) internally for computational efficiency. However, BCD persists for compatibility with legacy equipment and in specific scenarios where the ease of direct human-decimal interaction at the hardware level outweighs the binary's computational efficiency. It's about finding the right tool for the job.
Conclusion
Binary Coded Decimal (BCD) is more than just a historical footnote in digital electronics; it's a practical and enduring method of numerical representation that continues to play a significant role in industrial automation. By acting as a crucial bridge between the binary world of digital logic and the decimal world of human operators, BCD has simplified human-machine interfaces, supported legacy equipment, and ensured reliable data display in countless industrial applications.
While modern PLCs and control systems leverage pure binary for internal processing efficiency, understanding BCD is an essential skill for any automation professional. It empowers you to effectively integrate with existing systems, troubleshoot data interpretation issues, and appreciate the foundational concepts that underpin industrial control. As industries continue to evolve, the ability to work with diverse data formats like BCD remains a testament to a well-rounded and adaptable engineering skillset.
Discussion 0
Start the conversation! Be the first to share your thoughts on this article.