CM Binary Codes-Part1
CM Binary Codes-Part1
- In digital logic circuits, numbers, letters or symbols are represented by a combination of binary digits. This is called
digital coding or representation using binary codes.
-Codes that represent numbers are called numeric codes while those that represent both numbers and letters or
symbols are called alphanumeric codes.
(a) Security i.e. coding information so that others may not be able to read the message if it is intercepted.
(b) To enable efficient processing of information i.e. information is represented using fewer bits.
(d) Using code simplifies and reduces the circuitry required to process the information. By limiting the switching
circuitry, reliability of the digital system is increased.
(e) Error detection or correction i.e. codes enable the computers to determine whether the information that was
coded and transmitted is received correctly and, if there is an error, to correct it.
BCD
Excess-3
Gray code
ASCII
- It is a numeric code in which each decimal digit is represented by a group of four binary bits.
- Since the right-to-left weighting of the 4-bit positions is 8-4-2-1, it is also called an 8421 code.
- Any decimal number can be expressed in BCD code by replacing each decimal digit by the appropriate 4-bit
combination.
- Conversely, a BCD number can be easily converted into a decimal number by grouping the coded number into
groups of four bits (starting with LSB) and then writing down the decimal digit represented by each four- bit group.
Decimal BCD
0 0000
6 0110
7 0111
8 1000
9 1001
26 0010 0110
1
i
ng
Ba
Worked examples
3 6 9
2) Find the equivalent decimal value for the BCD code number 0001010001110101
Sol
1 4 7 5 hence 147510
0101 = 510
0111 = 710
Exercise
1) Convert the following binary numbers into their equivalent hexadecimal numbers:
(i) 1101 0111
(ii) 1010 0110
2) Find the decimal values for the BCD-coded numbers.
(i) 0110 1000
(ii) 0111 0100 1001
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.
2
i
ng
Ba
3
Ba
ng
i
4
Ba
ng
i
BCD Subtraction
Either packed or unpacked BCD numbers can be subtracted. BCD subtraction follows the same rules as binary
subtraction. However, if the subtraction causes 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.
For example,
37 - 12 = 25 65 - 19 = 46 41 - 18 = 23
5
i
ng
Ba
Exercise
(a) 23+20
(b) 67+33
(c) 1001+0100
(a) 1011
(b) 1010
(c) 1001
(d) 1100
6
i
ng
Ba