You are on page 1of 3

EXPERIMENT NO.

Objective: To study & perform BCD Addition and subtraction operation

Theory:

Binary Coded Decimal In computing and electronic systems, binary-coded decimal (BCD)
(sometimes called natural binary-coded decimal, NBCD or 8-4-2-1 code) or, in its most common
modern implementation, packed decimal, is an encoding for decimal numbers in which each digit is
represented by its own binary sequence. Its main virtue is that it allows easy conversion to decimal
digits for printing or display and allows faster decimal calculations. Its drawbacks are a small increase
in the complexity of circuits needed to implement mathematical operations. Uncompressed BCD is
also a relatively inefficient encoding—it occupies more space than a purely binary representation.

Although uncompressed BCD is not as widely used as it once was, decimal fixed-point and floating-
point are still important and continue to be used in financial, commercial, and industrial computing.

Recent decimal floating-point representations use base-10 exponents, but not BCD encodings. Current
hardware implementations, however, convert the compressed decimal encodings to BCD internally
before carrying out computations. Software implementations of decimal arithmetic typically use BCD
or some other 10n base, depending on the operation.

BCD in Electronics: BCD is very common in electronic systems where a numeric value is to be
displayed, especially in systems consisting solely of digital logic, and not containing a
microprocessor. By utilizing BCD, the manipulation of numerical data for display can be greatly
simplified by treating each digit as a separate single sub-circuit. Therefore, in cases where the
calculations are relatively simple working throughout with BCD can lead to a simpler overall system
than converting to binary.

The same argument applies when hardware of this type uses an embedded microcontroller or other
small processor. Often, smaller code results when representing numbers internally in BCD format,
since a conversion from or to binary representation can be expensive on such limited processors.

Definition: BCD represents each of the digits of an unsigned decimal as the 4-bit binary equivalents.
In BCD, a digit is usually represented by four bits which, in general, represent the decimal digits 0
through 9. Other bit combinations are sometimes used for a sign or for other indications (e.g., error or
overflow).

 Invalid BCD Numbers These binary numbers are not allowed in the BCD code: 1010, 1011,
1100, 1101, 1110, 1111.
 Thus, for example the BCD encoding for the number 127 would be:

0001 0010 0111

Whereas the pure binary number would be

0111 1111
BCD Addition & Subtraction

BCD Addition

Either packed or unpacked BCD numbers can be summed. BCD addition follows the same rules as
binary addition. However, if the addition produces a carry and/or creates an invalid BCD number, an
adjustment is required to correct the sum. The correction method is to add 6 to the sum in any digit
position that has caused an error.

Example:
BCD Subtraction

Either packed or unpacked BCD numbers can be subtracted. BCD subtraction follows the same rules
as binary subtraction. However, if the subtraction needs a borrow and/or creates an invalid BCD
number, an adjustment is required to correct the answer. The correction method is to subtract 6 from
the difference in any digit position that has caused an error

You might also like