0% found this document useful (0 votes)
25 views

Chapter 1

Uploaded by

2022745055
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Chapter 1

Uploaded by

2022745055
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CHAPTER ONE

NUMBER SYSTEMS
AND CODES

Objectives

 Binary, octal, hexadecimal and BCD number system.


 Number Conversion
2 Number Systems and Codes

1.1 Binary Numbers

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.

A calculator is an example of a digital system. Decimal numbers are pressed


on the keypad, where the input values are converted to binary for
processing, then converts the answers to a decimal value before displaying
them. Number conversion occurs extensively in a digital circuit. In this
chapter, you will learn numbers systems and codes used in digital circuit.
You will also learn how to perform conversion from one number system to
another.

A decimal number can be converted to a binary number by successively


dividing the number by 2 as follows:

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)

Therefore 8710 = 10101112

Note that the first remainder becomes the most significant bit (MSB). The
last remainder becomes the least significant bit (LSB).

A binary number is converted to a decimal number by summing together the


weights of various positions in the binary number which contain a 1. For
example, 11001112 = 10310.
3 Number Systems and Codes

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

1.2 Octal Number

A decimal number can be converted to an octal number by successively


dividing the number by 8 as follows:

8 266
8 33 remainder 2 LSB (right-most digit)
8 4 remainder 1
0 remainder 4 MSB (left-most digit)

Therefore 26610 = 4128

To convert an octal number to a decimal number, multiply each octal value


by the weight of the digit and sum the results. For example, 3248 = 21210.

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

Each octal digit can be represented by a 3-bit binary number as shown


below:

Octal Digits 3-bit Binary number


0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
4 Number Systems and Codes

Conversion from octal to binary is very straightforward. Each octal digit is


replaced by 3-bit binary number. For example, 4728 = 1001110102.

4 7 2 Octal number
↓ ↓ ↓
100 111 010 Binary number

A binary number is converted into an octal number by taking groups of 3


bits, starting from LSB, and replacing them with an octal digit. For example,
110101102 = 3268.

11 010 110 Binary number


↓ ↓ ↓
3 2 6 Octal number

1.3 Hexadecimal 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.

Hexadecimal Decimal Binary


0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111

A decimal number can be converted to hex number by successively dividing


the number by 16 as follows:
5 Number Systems and Codes

16 423
16 26 remainder 7 LSB
16 1 remainder 10 A
0 remainder 1 MSB

Therefore 42310 = 1A716

To convert a hex number to a decimal number, multiply each hex value by


the weight of the digit and sum the results. For example, 2B5 = 693 .
16 10

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

Each hex digit can be represented by a 4-bit binary number as shown


above. Conversion from hex to binary is very straightforward. Each hex digit
is replaced by 4-bit binary number. For example, A2616 = 1010001001102.

A 2 6
↓ ↓ ↓
1010 0010 0110

A binary number is converted into a hexadecimal number by taking groups


of 4 bits, starting from LSB, and replacing them with a hex digit.
For example, 101111110101102 = 2FD616.

10 1111 1101 0110


↓ ↓ ↓ ↓
2 F D 6

1.4 BCD Code

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.

The Binary-Coded-Decimal (BCD) code makes conversion much easier. Each


decimal digit, 0 through 9, is represented with a 4-Bit BCD code as shown
below. The BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are not used.
6 Number Systems and Codes

Decimal Digit BCD Code


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

Conversion between BCD and decimal is accomplished by replacing a 4-bit


BCD for each decimal digit. For example, 87410 = 1000 0111 0100BCD.

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.

87410 = 11011010102 binary


87410 = 1000 01110100BCD BCD

A BCD code is converted into a decimal number by taking groups of 4 bits,


starting from LSB, and replacing them with a decimal number. For
example, 1100101111000BCD = 197810

1 1001 0111 1000 BCD code


↓ ↓ ↓ ↓
1 9 7 8 decimal number
7 Number Systems and Codes

1.5 Exercises

1. Convert decimal 742310 to


a. binary
b. BCD
c. octal
d. hexadecimal

2. Convert binary 111001101012 to


a. decimal
b. octal
c. hexadecimal
d. BCD

3. Convert hexadecimal 5EA416 to


a. decimal
b. binary
c. octal
d. BCD

4. Convert BCD 100111100100110101BCD to


a. decimal
b. octal
c. hexadecimal
d. binary

5. Convert number octal 32548 to


a. decimal
b. BCD
c. hexadecimal
d. binary

You might also like