What is Binary Coded Decimal (BCD) and How is it Used in Automation?


As computers evolved from very
early transistor based models to the desktop personal
computers using microchips, memory and instruction registers
were 8 bits in length with computing, having to adapt to the
standard decimal based system. Specific instructions used
by programmers early on were designed with 8 bits in length
to facilitate all of computing and these instructions have been maintained
throughout the years of computer development and will most likely continue
to be used in the future. Within computers, each of the 8 bits have only two values for
representing either a logic “1” or True and a logic “0” or False. This is what is referred to as
Boolean in computer science. Boolean logic and expressions make the system of using binary
numbers perfect for use in digital or electronic circuits and systems. At RealPars, we love helping you learn so, if you enjoy this video as
much as we enjoyed making it, Click the like button. subscribe and click the bell and you’ll receive notifications
of new RealPars videos. so, you’ll never miss another one! The BCD system offers
relative ease of conversion between machine readable
and human readable numerals. An advantage of the Binary
Coded Decimal system is each decimal digit is denoted
by a group of 4 binary digits and that it allows easy
conversion between decimal a base 10 system and
binary a base 2 system. A disadvantage is BCD code does not
use all the states between binary 1010 for the decimal 10 and binary 1111 for the decimal 15. Binary coded decimal has specifically important
applications using digital displays. Now let’s talk about the binary
numbering system used in computers, this system is a Base 2 numbering system which follows the same set of rules used
with decimal or base 10 number system. Base 10 uses powers of ten, for example 1, 10, 100, 1000 and so on, where binary numbers use powers of two, effectively doubling the
value of each sequential bit, for example 1, 2, 4, 8, 16, 32 and so on. This conversion between
binary and decimal values is called Binary coded decimal and allows for easy conversion
between decimal and binary numbers. Binary coded decimal or BCD is a code
using a series of binary digits or bits that when decoded
represents a decimal digit. A decimal number contains 10
digits, zero to nine. So, each decimal digit 0 through 9 is represented by a
series of four binary bits where the numerical value when decoded
is equivalent to a decimal digit. In BCD we will use binary
numbers from 0000 to 1001, which are equivalent to decimal 0 to 9. Using the decimal number 5 for example, 5 in BCD is represented by 0101 and 2 in BCD is represented by 0010 and 15 in BCD is represented by 0001 0101. Let’s look a bit closer on
how this conversion works. The weighted binary coded decimal
representation of a decimal number and the comparison to the
decimal weighted representation. As we can see the decimal weight
of each decimal digit to the left increases by a factor of 10. With BCD number system, the binary weight of each digit
increases by a factor of 2. The first digit has a weight
of 1 or 2 to the power of 0, the second digit has a weight
of 2 or 2 to the power of 1, the third digit has a weight
of 4 or 2 to the power of 2, and the fourth digit has a weight
of 8 or 2 to the power of 3. Now with the basic understanding
of the binary weighted system, the relationship between decimal numbers
and weighted binary coded decimal digits for decimal values of 0 through 15 are provided as a truth table for BCD. Keep in mind, Binary coded decimal is not
the same as binary to decimal conversion. For example, if I would represent
the decimal number 72 in both forms, the bit formation would be like this: When we use a table to explain and expand
out the weighted values, using 16 bits, we can convert the
following decimal numbers: 9620, 120 and 4568 into
their binary equivalents. By adding together all
the decimal number values from right to left from each of the bit
positions that are represented by a “1” gives us the decimal equivalent. However, for the same decimal number, the BCD form representation
will be like this: 9620 equals this BCD value, 120 equals this BCD value, 4568 equals this BCD value. Electronic circuits and systems can
be divided into two types of circuits, analog and digital. Analog Circuits amplify
varying voltage levels that can alternate between a positive
and negative value over a period of time and Digital Circuits produce distinct
positive or negative voltage levels representing either a logic
level 1 or a logic level 0 state. Voltages used in digital
circuits could be any value, however in digital and computer
systems they are below 10 volts. In digital circuits voltages
are called logic levels and typically one voltage level
will represent a “HIGH” state, and the lower voltage level
will represent a “LOW” state. A binary number system will
use both of these two states. Digital signals consist
of discrete voltage levels that change between these
two “HIGH” and “LOW” states. BCD was commonly used for
displaying alpha-numeric in the past but in modern day BCD is still
used with real time clocks or RTC chips to keep
track of wall clock time and it’s becoming more common for embedded
microprocessors to include an RTC. It’s very common for RTCs to
store the time in BCD format. A binary clock might use LEDs
to express binary values. With this clock each column of LEDs
displays a binary coded decimal numeral. Back in the days, before touchscreens, seven segment displays,
and thumbwheel switches were used for a numerical
interface between PLCs and humans. Even before the PLC, these BCD type devices were the
only graphical way to interface with system circuits numerically. Some PLCs for example, Siemens S7
standard timer and counter data types use Binary Coded Decimal
in their data structures because these structures go back to
when engineers had to deal with things like these thumbwheels
and 7 segment displays. In fact, the S7 timer setpoints
are still entered as “S5T#2S” for a two second setpoint because this is inherited
from the S5 PLC platform. These timers use three BCD digits or 12 bits and two extra
bits for the time base. This is true for counters in which
they only count from 0 to +999. This concludes the video, “What is Binary Coded Decimal or BCD
and how is it used in Automation”. Here at RealPars our team
of experts is on hand to answer your questions
and respond to your feedback. If you’d like to learn more about any
of the topics covered in this video head over to our website at RealPars.com. We’d love to hear your suggestions
for topics you want our team to cover. Also, be sure to download the RealPars app. When you download the app, you’ll be able to watch an entire
free course on PLC Hardware. Just like this video, the lessons are all high quality
and also very easy to follow. By downloading the RealPars app, you have access to a wealth
of practical knowledge as an automation engineer
right in your pocket and you will also receive new fresh out
of the oven videos each and every week.

14 Comments

  1. Is it possible to have access to all videos by subscribing on the website or app? Because on the website, there are packs of videos with their specific price labels and it confuses me.
    I'm not sure whether I should pay for packs or just subscribe.

  2. This is really awesome! It is an easy topic, but because we sometimes mix up between decimal to BCD conversions and Decimal to Binary conversions, it seems challenging! This video really cleared it up. Thanks Real Pars

  3. BCD is used extensively in the OMRON CP and CJ series PLCs as well, in fact many of the instructions in CX-Programmer have a BCD and Binary version. Their more modern NJ/NX series use tag based data types that obscure the binary coding.

Leave a Reply

Your email address will not be published. Required fields are marked *