1.
Basic Electronics Notes
Number system
UNIT-VII
Syllabus
1. NUMBER SYSTEMS: Introduction, decimal system, Binary, Octal and Hexadecimal
number systems, addition and subtraction, fractional number, Binary Coded Decimal
numbers.
NUMBER SYSTEM
The human need to count things goes back to the dawn of civilization. To answer the
questions like how much or how many‖, people invented number system. A number system is
any scheme used to count things. The decimal number system succeeded because very large
numbers can be expressed using relatively short series of easily memorized numerals. Decimal or
base 10 number system‘s origin: can be traced to, counting on the fingers with digits. In any
number system, the important term is Base or radix
Base: Base is the number of different digits or symbols or numerals used to represent the number
system including zero in the number system. It is also called the radix of the number system.
Commonly used number systems :
1. Decimal
2. Binary
3. Octal
4. Hexadecimal.
Decimal number system :
The decimal system is composed of 10 numerals or symbols. These 10 symbols are 0, 1, 2, 3, 4,
5, 6, 7, 8, 9. Using these symbols as digits of a number, we can express any quantity. The
decimal system is also called the base-10 system because it has 10 digits.
Binary number system :
In the binary system, there are only two symbols or possible digit values, 0 and 1. This base-2
system can be used to represent any quantity that can be represented in decimal or other base
system
Octal number system :
The octal number system has a base of eight, meaning that it has eight possible digits:
0,1,2,3,4,5,6,7. The octal numbering system includes eight base digits (0-7).After 7, the next
placeholder to the right begins with a “1”
i.e 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13 ...
Hexadecimal number system:
The hexadecimal system uses base 16. Thus, it has 16 possible digit symbols. It uses the digits 0
through 9 plus the letters A, B, C, D, E, and F ,to represent 10 through 16, as the 16 digit
symbols
Digits = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
Rohith.S, Asst. Professor, NCET, Bangalore
Page 1
2.
Basic Electronics Notes
Number system
Conversion of number systems.
Converting from one number system to another is called conversion of number system or code
conversion, like converting from binary to decimal or converting from hexadecimal to decimal
etc.
Procedure for Conversion from One Number system to Other Number systems
Number
system Number
Procedure
(From)
system (To)
Multiply each bit by 2n, where n is the “weight” of the bit
Binary
Decimal
Hexadecimal
Add the results
Group every 4 bits and represent it into Hexadecimal using table
Group every 3 bit and Represent it into octal using table
Binary
Divide by two, keep track of the remainder
Group the remainders from Bottom to Top
Hexadecimal
Repeated division by 16 and Keep track of the Reminder.
Octal
Repeated division by 8 and Keep track of the Reminder.
Binary
Represent each digit by group of 3 bits as given in table
Decimal
Multiply each digit by 8n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
Convert Octal to Binary first.
Regroup the binary number by four bits per group starting from
LSB
Use the table to represent the digit
Binary
Represent each digit by group of 4 bits
Decimal
Multiply each bit by 16n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
Add the results
Convert Hexadecimal to Binary first.
Regroup the binary number by three bits per group starting from
LSB.
Octal
Octal
Decimal
The weight is the position of the bit, starting from 0 on the right
Use the table to represent the digit
Hexadecimal
Hexadecimal
Octal
Rohith.S, Asst. Professor, NCET, Bangalore
Page 2
3.
Basic Electronics Notes
Octal –To- Binary / Binary- To- Octal Conversion
Octal
0
1
2
3
Digit
Binary
000
001
010
011
Equivalent
Number system
4
5
6
7
100
101
110
111
5
6
7
0101
0110
0111
D
E
F
1101
1110
1111
Binary-To-Hexadecimal /Hexadecimal-To-Binary Conversion
Hexadecimal 0
1
2
3
4
Digit
Binary
0000
0001
0010
0011
0100
Equivalent
Hexadecimal 8
9
A
B
C
Digit
Binary
1000
1001
1010
1011
1100
Equivalent
Subtraction Using Number System
Complement method of subtraction
The complement method of subtraction is the method used for subtraction of numbers in
different number systems. This method is useful as it can easily implemented in arithmetic logic
circuits and inverting circuits in computers.
The complement method used in various no. systems discussed above is indicated below:
For decimal system – 9‘s complement method
– 10‘s complement method
For binary system
– 1‘s complement method
-- 2‘s complement method
For octal system
– 7‘s complement method
– 8‘s complement method
For hexadecimal system – 15‘s complement method
– 16‘s complement method
For subtraction of two numbers we have two cases :
1 Subtraction of smaller number from larger number
2 Subtraction of larger number from smaller number
Subtraction Using Binary no. System
The 1‘s complement of a given binary no. is the new no. obtained by changing all the 0‘
to 1, and all 0‘s to 1
Ex : 11010‘s 1‘s complement is 00101
Rohith.S, Asst. Professor, NCET, Bangalore
Page 3
4.
Basic Electronics Notes
Number system
The 2‘s complement of a given binary no. is the new no. obtained by changing all the 0‘
to 1, and all 0‘s to 1 and then adding 1 to the least significant it
Ex : 11010‘s 2‘s complement is 1‘s complement 00101+1=00110
1’s complement method of subtraction
Subtraction of smaller number from larger number
1. Determine the 1‘s complement of the smaller no.
2. Add the first complement to the larger no.
3. Remove the carry and add it to the result. This is called end-around carry.
Subtraction of larger number from smaller number
1. Determine the first complement of the larger no.
2. Add the first complement to the smaller no.
3. Answer is in the 1‘s complement form. To get the answer in true form take the 1‘s
complement and assign –ve sign to the answer.
Advantages of 1’s complement method
1. The first complement subtraction can be accomplished with a binary adder. Therefore,
this method is useful in arithmetic logic circuits.
2. The first complement of a no. is easily obtained by inverting each bit in the no.
2’s complement method of subtraction
Subtraction of smaller number from larger number
1. Determine the 2‘s complement of a smaller no.
2. Add the 2‘s complement to the larger no.
3. Discard the carry.
Subtraction of larger number from smaller number
1. Determine the 2‘s complement of a larger no.
2. Add the 2‘s complement to the smaller no.
3. When there is no carry, answer is in the 2‘s complement form. To get the answer in
the true form take the 2‘s complement and assign –ve sign to the answer
Complement method of subtraction for octal number
7’s complement method of subtraction
The 7‘s complement of an octal no. is found by subtracting each digit from 7
Subtraction of smaller no. from larger no.
Step1 :Find 7‘s complement of subtrahend
Step2: Add two octal numbers (first no. and 7‘s complement of the second no.)
Step3 : I f the carry is produced in addition, add the carry to the least significant bit of the
sum, otherwise find 7‘s complement of the sum and attach –ve sign to it.
Rohith.S, Asst. Professor, NCET, Bangalore
Page 4
5.
Basic Electronics Notes
Number system
Subtraction of larger number from smaller number
Step1 :Find 7‘s complement of subtrahend
Step2: Add two octal numbers (first no. and 7‘s complement of the second no.)
Step3 : I f the carry is not produced in addition then, find 7‘s complement of the sum as a
result and attach –ve sign to the result.
8’s complement method of subtraction
The 8‘s complement of an octal number is found by adding a 1 to the least significant bit of the
7‘s complement of an octal no.
Subtraction of smaller no. from larger no.
The steps for octal subtraction using 8‘s complement method are as given below
Step 1. Find 8‘s complement of subtrahend
Step 2 : Add two octal numbers (first no. and 8‘s complement of second no.)
Step 3 : If carry is produced in the addition, it is discarded., otherwise find 8‘s
complement of the sum as the result with –ve sign.
Subtraction of larger no. from smaller no.
Steps for Octal subtraction using 8‘s complement are as given below :
Step 1 : Find 8‘s complement of subtrahend
Step 2 : Add two Octal numbers (first no. and 8‘s complement of second no.)
Step 3 : If carry is produced in the addition, it is discarded, otherwise find 8‘s
complement of the sum as a result, with a –ve sign.
9’s complement method of subtraction
The 9‘s complement of a decimal no. is found by subtracting each digit from 9.
Subtraction of smaller no. from larger no.
Step 1 : Find 9‘s complement of subtrahend
Step 2 : Add two decimal numbers (first no. and 9‘s complement of second no.)
Step 3 : If carry is produced in the addition, add carry to the least significant bit of the
sum, otherwise find 9‘s complement of the sum as a result with a –ve sign.
Subtraction of larger no. from smaller no.
Step 1 : Find 9‘s complement of subtrahend
Step 2 : Add two hexadecimal numbers (first no. and 9‘s complement of second no.)
Step 3 : If carry is produced in the addition, add carry to the least significant bit of the
sum, otherwise find 9‘s complement of the sum and attach –ve sign to it.
10’s complement method of subtraction
The 10‘s complement of a Decimal no. is found by adding a 1 to the least significant bit of the
9‘s complement of a decimal no.
Subtraction of smaller no. from larger no.
Steps for Decimal subtraction using 10‘s complement are as given below :
Step 1 : Find 10‘s complement of subtrahend.
Step 2 : Add two decimal numbers (first no. and 10‘s complement of second no.)
Rohith.S, Asst. Professor, NCET, Bangalore
Page 5
6.
Basic Electronics Notes
Number system
Step 3 : If carry is produced in the addition, it is discarded, otherwise find 10‘s
complement of the sum as a result, with a –ve sign.
Subtraction of larger no. from smaller no.
Steps for Decimal subtraction using 10‘s complement are as given below :
Step 1 : Find 10‘s complement of subtrahend
Step 2 : Add two Decimal numbers (first no. and 10‘s complement of second no.)
Step3 : If carry is produced in the addition, it is discarded, otherwise find 10‘s
complement of the sum as a result, with a –ve sign.
Complement method of subtraction for Hexadecimal number
15’s complement method of subtraction
The 15‘s complement of a hexadecimal no. is found by subtracting each digit from 15.
Subtraction of smaller no. from larger no.
Step 1 : Find 15‘s complement of subtrahend
Step 2 : Add two hexadecimal numbers (first no. and 15‘s complement of second no.)
Step 3 : If carry is produced in the addition, add carry to the least significant bit of the
sum, otherwise find 15‘s complement of the sum as a result with a –ve sign.
Subtraction of larger no. from smaller no.
Step 1 : Find 15‘s complement of subtrahend
Step 2 : Add two hexadecimal numbers (first no. and 15‘s complement of second no.)
Step 3 : If carry is produced in the addition, add carry to the least significant bit of the
sum, otherwise find 15‘s complement of the sum and attach –ve sign to it.
16’s complement method of subtraction
The 16‘s complement of a hexadecimal no. is found by adding a 1 to the least significant bit of
the 15‘s complement of a hexadecimal no.
Subtraction of smaller no. from larger no.
Steps for Hexadecimal subtraction using 16‘s complement are as given below :
Step 1 : Find 16‘s complement of subtrahend.
Step 2 : Add two hexadecimal numbers (first no. and 16‘s complement of second no.)
Step3 : If carry is produced in the addition, it is discarded, otherwise find 16‘s
complement of the sum as a result, with a –ve sign.
Subtraction of larger no. from smaller no.
Steps for Hexadecimal subtraction using 16‘s complement are as given below :
Step 1 : Find 16‘s complement of subtrahend
Step 2 : Add two hexadecimal numbers (first no. and 16‘s complement of second no.)
Step 3 : If carry is produced in the addition, it is discarded, otherwise find 16‘s
complement of the sum as a result, with a –ve sign
Binary Coded Decimal Numbers - BCD
Rohith.S, Asst. Professor, NCET, Bangalore
Page 6
7.
Basic Electronics Notes
Number system
BCD is an abbreviation for binary coded decimal. BCD is a numeric code in which each digit
of a decimal number is represented by a separate group of bits. The most common BCD code is 8-42-1 BCD, in which each decimal digit is represented by a 4 bit binary number. It is called 8-4-2-1
BCD because the weights associated from right to left are 1-2-4-8.
The table below shows decimal digit and its corresponding code.
Decimal Number
Binary Number
(8421)
1
0001
2
3
0010
0011
4
5
0100
0101
6
0110
7
8
0111
1000
9
1001
The advantage of BCD is that it is easy to convert between it and decimal. The disadvantage
is the arithmetic operations are more complex when compared to binary.
BCD ADDITION
The addition of two BCD nos. can be best understood by considering the following three conditions :
Case1: The sum equals 9 or less with no carry
Case2: The sum equals greater than 9 with no carry
Case3: The sum equals 9 or less with a carry
Case1: The sum equals 9 or less with no carry
Take two numbers 6 and 3 in BCD and add
5 ----- 0101
4 ----- 0100
--------------------9 ----- 1001 The addition is carried out as in normal binary addition and the sum is 1001 which is a
BCD code for 9.
Case2: The sum equals greater than 9 with no carry
Let us consider addition of the numbers 6 and 8 in BCD
6 ----- 0110
8 ----- 1000
--------------------14 ---- 1110 invalid BCD number. This has occurred because the sum of the two digits
exceeds 9. In this case to correct the situation add 6 in BCD i.e 0110 to the invalid BCD no. as shown
below.
Rohith.S, Asst. Professor, NCET, Bangalore
Page 7
8.
Basic Electronics Notes
Number system
6 ----- 0110
8 ----- 1000
--------------------14----- 1110
0110
----------------0001 0100
Observe that after addition of 6 a carry is produced into the second decimal position.
Case3: The sum equals 9 or less with a carry
Let us consider addition of the numbers 8 and 9 in BCD
8 ----- 1000
9 ------1001
--------------------17 0001 0001 In correct BCD No.
0110 Add 6 for correction
--------------------------0001 0111 BCD for 17
BCD Subtraction
A negative BCD no. can be expressed by taking 9‘s complement or 10‘s complement. The9‘s
complement of a decimal number is found by subtracting each digit in the number by 9.The 10‘s
complement is 9‘s complement +1.
Decimal
Number
0
1
2
3
4
5
6
7
8
9
9’s complement
9
8
7
6
5
4
3
2
1
0
10’s
complement
0
9
8
7
6
5
4
3
2
1
Subtraction as follows :
Find the 9‘s or 10‘s complement of a negative no.
Add the two numbers using BCD addition
If carry is generated add carry to the result treating it as end around carry, if it is 9‘s
complement subtraction, discard the carry if it is 10‘s complement. If there is no carry
generated take corresponding 9‘s or 10‘s complement of the result and attach –ve sign to the
result.
Rohith.S, Asst. Professor, NCET, Bangalore
Page 8
Be the first to comment