Chapter 1
Number System and Codes
Chapter Objectives
Understand the number system used in Digital
Circuits
Understand the types of complements:
1’s complement
2’s complement
9’s complement
10’s complement
Understand the types of codes in digital
systems
2
Number System
Number system is used to represent the
numbers.
The different types of number systems are:
Decimal number
Binary number
Octal numbers
Hexadecimal numbers
3
Decimal Number
It uses digits from 0 to 9 for representing the
numbers.
It is represented with base 10.
A decimal number can be represented using
positional weights.
Example:
(198)10 = 1 X 102 + 9 X 101 + 8 X 100
4
Binary Number
It consists of only two digits, 0 and 1.
It is represented with base 2.
A binary number can be represented using positional
weights.
Example:
(198)10 = (11000110)2
= 1 X 2 7 + 1 X 26 + 0 X 25 + 0 X 24 + 0 X 23 + 1 X 22 + 1 X 2 1
+ 0 X 20
= 128 + 64 + 0 + 0 + 0 + 4 + 2 + 0
= 198
5
Octal Number
It uses digits from 0 to 7 for representing the
numbers.
It is represented with base 8.
An octal number can be represented using positional
weights.
Example:
(237)8 = 2 X 82 + 3 X 81 + 7 X 80
= 2 X 64 + 3 X 8 + 7 X 1
= 128 + 24 + 7
= (159)10
6
Hexadecimal Number
It uses 16 symbols, 0 to 9 and A to F for representing
the numbers.
It is represented with base 16.
A hexadecimal number can be represented by using
positional weights.
Example:
A3BH = (A3B)16 = A X 162 + 3 X 161 + B X 160
= 10 X 162 + 3 X 161 + 11 X 160
= 2560 + 48 + 11
= (2619)10
7
Arithmetic Operations
Arithmetic operations are performed in
arithmetic unit of the digital systems by using
binary numbers.
The various types of arithmetic operations are:
Binary addition
Binary subtraction
Binary multiplication
Binary division
8
Complements
Complements are the binary representation of
negative numbers in digital systems.
The various types of complements are:
1’s complement: It is obtained by changing all 0’s to 1’s
and all 1’s to 0’s, of a binary number.
2’s complement: It is obtained by adding 1 to the 1’s
complement.
9’s complement: It is obtained by subtracting each digit in
the number by 9.
10’s complement: It is obtained by adding 1 to the 9’s
complement.
9
Binary Coded Decimal
Binary Coded Decimal (BCD) is the
combination of four digits, 8241, which
represent the binary numbers.
Example:
BCD equivalent of 1 is 0001
BCD equivalent of 2 is 0010
BCD equivalent of 5 is 0101
BCD equivalent of 9 is 1001
10
Codes
Code is the symbolic representation of discrete
information, which can be represented in the form of
numbers and letters.
Codes are classified in five groups:
Weighted binary codes: These codes follow the positional
weighting principle in which the position of the numbers
represent the weight. The different types of weighted codes
are:
8421 code
2421 code
Reflective code
Sequential code
11
Codes (contd..)
Non-weighted codes: These codes are not positionally
weighted. Each position within the binary number is not
assigned a fixed value. The different types of non-weighted
codes are:
Excess-3 code
Gray code
Error detecting codes: These codes are used to detect errors
in the decimal numbers. The different types of error
detecting codes are:
Check sum
Parity check
12
Codes (contd..)
Error correcting codes: These codes are used to
correct the errors in the decimal numbers. The
different types of error correcting codes are:
Hamming codes
Alphanumeric codes: These codes represent
numbers, letters and special symbols. The different
types of alphanumeric codes are:
ASCII codes
EBCDIC code
Hollerith code
13