Chapter 1
Chapter 1
NUMBER SYSTEMS
AND CODES
Objectives
The binary number system is used to represent the voltage levels of a digital
circuit. Only two voltage levels present in a digital circuit, logic High and
logic Low. The high voltage is +5V and the low voltage is +0V. The binary
numbers represent the logic low as a 0 and the logic high as a 1.
2 87
2 43 remainder 1 LSB (right-most bit)
2 21 remainder 1
2 10 remainder 1
2 5 remainder 0
2 2 remainder 1
2 1 remainder 0
0 remainder 1 MSB (left-most bit)
Note that the first remainder becomes the most significant bit (MSB). The
last remainder becomes the least significant bit (LSB).
MSB LSB
6 5 4 3 2 1 0
2 2 2 2 2 2 2 Bit Weights
1 1 0 0 1 1 1 binary number
6 5 2 1 0
= (1 x 2 ) + (1 x 2 ) + (1 x 2 ) + (1 x 2 ) + (1 x 2 )
= 64 + 32 + 4 + 2 + 1
= 103
10
8 266
8 33 remainder 2 LSB (right-most digit)
8 4 remainder 1
0 remainder 4 MSB (left-most digit)
MSB LSB
2 1 0
8 8 8 Octal Digit Weights
3 2 4 Octal Number
= 2
(3 x 8 ) + (2 x 8 ) + (4 x 8 )
1 0
= 192 + 16 + 4
= 212 .
10
4 7 2 Octal number
↓ ↓ ↓
100 111 010 Binary number
The hexadecimal number uses base 16. It uses the digits 0 through 9 plus
the letters A, B, C, D, E and F. The letter A stands for decimal 10, B for 11,
C for 12, D for 13, E for 14 and F for 15.
16 423
16 26 remainder 7 LSB
16 1 remainder 10 A
0 remainder 1 MSB
MSB LSB
2 1 0
16 16 16 Hex Digit Weights
2 B 5 Hex Number
= 2
(2 x 16 ) + (11 x 16 ) + (5 x 16 )
1 0
= 512 + 176 + 5
= 693 .
10
A 2 6
↓ ↓ ↓
1010 0010 0110
Conversions between decimal and binary can become long and complicated
for large numbers. For example, convert 87410 to binary. The answer is
11011010102, but it takes quite a lot of time and effort to make this
conversion. We call this straight binary coding.
8 7 4 decimal number
↓ ↓ ↓
1000 0111 0100 BCD code
BCD is not another number system like binary, octal, decimal and
hexadecimal. It is in fact the decimal system with each digit encoded in its
binary equivalent. A BCD code is not the same as a straight binary number.
For example, the BCD code requires 12 bits, while the straight binary
number requires only 10 bits to represent 87310.
1.5 Exercises