1. ODD
SEMESTER
12
BASIC
ELECTRONICS-‐1-‐CLASS
NOTES
–
UNIT7
Shivoo
Koteshwar
Professor,
E&C
Department,
PESIT
SC
Number
Systems
• Introduction
• Decimal
System
• Binary,
Octal
and
Hexadecimal
Number
systems
• Additions
and
Subtraction
• Fractional
Number
• Binary
Coded
Decimal
Numbers
Reference
Books:
• Basic
Electronics,
RD
Sudhaker
Samuel,
U
B
Mahadevaswamy,
V.
Nattarsu,
Saguine-‐Pearson,
2007
UNIT
7:
NUMBER
SYSTEMS:
Introduction,
decimal
system,
Binary,
Octal
and
Hexadecimal
number
systems,
addition
and
subtraction,
fractional
number,
Binary
Coded
Decimal
Numbers
7
Hours
P e o p l e s
E d u c a t i o n
S o c i e t y
S o u t h
C a m p u s
( w w w . p e s . e d u )
2. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Decimal System:
When we write decimal (base 10) numbers, we use a positional
notation system. Each digit is multiplied by an appropriate power
of 10 depending on its position in the number.
For example:
843 = 8 x 102 + 4 x 101 + 3 x 100
= 8 x 100 + 4 x 10 + 3 x 1
= 800 + 40 + 3
In a positional notation system, the number base is called the
radix. Thus, the base ten system that we normally use has a radix
of 10. The term radix and base can be used interchangeably.
843 = 843(10) = 84310
Other Number Systems:
• Binary
System
• Octal
System
• Hexadecimal
System
Shivoo
Koteshwar’s
Notes
2
shivoo@pes.edu
3. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Binary to Decimal:
Conversion of Decimal to Binary:
Shivoo
Koteshwar’s
Notes
3
shivoo@pes.edu
4. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Octal to Decimal:
Conversion of Decimal to Octal
Shivoo
Koteshwar’s
Notes
4
shivoo@pes.edu
5. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Hexadecimal to Decimal:
Conversion of Decimal to Hexadecimal:
Shivoo
Koteshwar’s
Notes
5
shivoo@pes.edu
6. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Binary to Hexadecimal:
Converting binary to hexadecimal can be done in two steps:
1. Convert binary to decimal
2. Convert decimal to hexadecimal
Or you can use this short cut!
• Divide into groups for 4 digits
• Write the equivalent hexadecimal number
Examples:
• 101101012 = 1011 0101 = B 5
101101012 = B516
• 0110101110001100 = 0110 1011 1000 1100 = 6 B 8 C
01101011100011002 = 6B8C16
• 11101101012 = 11 1011 0101 = 3 B 5
11101101012 = 3B516
Conversion of Hexadecimal to Binary:
Converting hexadecimal to binary can be done in two steps:
1. Convert hexadecimal to decimal
2. Convert decimal to binary
Or you can use this short cut!
• Convert each hexadecimal digit into a group of 4 binary
digits
• Concatenate all
Examples:
• 374F16 = 3 7 4 F = 0011 0111 0100 1111
374F 16 = 00110111010011112
• 3B516 = 3 B 5 = 0011 1011 0101
3B5 16 = 0011101101012
Shivoo
Koteshwar’s
Notes
6
shivoo@pes.edu
7. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Binary to Octal:
Converting binary to octal can be done in two steps:
1. Convert binary to decimal
2. Convert decimal to octal
Or you can use this short cut!
• Divide into groups for 3 digits
• Write the equivalent hexadecimal number
Examples:
• 1.1101101012 = 110 110 101 = 6 6 5
1101101012 = 6658
• 101101012 = 10 110 101 = 2 6 5
101101012 = 2658
Conversion of Octal to Binary:
Converting octal to binary can be done in two steps:
1. Convert octal to decimal
2. Convert decimal to binary
Or you can use this short cut!
• Convert each octal digit into a group of 3 binary digits
• Concatenate all
Examples:
• 6658 = 6 6 5 = 110 110 101
6658 = 1101101012
• 2658 = 2 6 5 = 010 110 101
2658 = 0101101012
Shivoo
Koteshwar’s
Notes
7
shivoo@pes.edu
8. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Conversion of Octal/Hexa to Hexa/Octal:
Converting octal/hexa to hexa/octal can be done in two steps:
1. Convert octal/hexa to decimal
2. Convert decimal to hexa/octal
Or you can use this short cut!
• Conversion from Octal to Hexa
o Convert to Binary, regroup 4 bits and write the
equivalent Hexa
o 2658 = 010 110 101 = 0101101012 = 0 1011 0101 =
B516
• Conversion from Hexa to Octal
o Convert to Binary, regroup 3 bits, write the equivalent
Octal
o B516 = 1011 0101 = 101101012 = 10 110 101 = 2658
SUMMARY
Shivoo
Koteshwar’s
Notes
8
shivoo@pes.edu
9. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Binary Addition:
Binary Subtraction:
Shivoo
Koteshwar’s
Notes
9
shivoo@pes.edu
10. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Octal Addition:
Hexadecimal Addition:
Shivoo
Koteshwar’s
Notes
10
shivoo@pes.edu
11. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Subtraction using Complement:
NOTATION
• A complement is a number that is used to represent the
negative of a given number
• When two numbers are to be subtracted, the subtrahend*
can either be subtracted directly from the minuend (as we
are used to doing in decimal subtraction) or, the complement
of the subtrahend can be added to the minuend to obtain the
difference.
• When the latter method is used, the addition will produce a
high-order (leftmost) one in the result (a "carry"), which
must be dropped.
• This is how the computer performs subtraction: it is very
efficient for the computer to use the same "add" circuitry to
do both addition and subtraction; thus, when the computer
"subtracts", it is really adding the complement of the
subtrahend to the minuend
Example: Subtract 4589 - 322, using complements
Shivoo
Koteshwar’s
Notes
11
shivoo@pes.edu
12. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Binary Subtraction using compliment:
• Match the bit size of the minuend and subtrahend before
finding out its complement
• Compute the one's complement of the subtrahend by
subtracting each digit of the subtrahend by 1. A shortcut for
doing this is to simply reverse each digit of the subtrahend -
the 1's become 0's and the 0's become 1’s
• Add 1 to the one's complement of the subtrahend to get the
two's complement of the subtrahend
• Add the two's complement of the subtrahend to the minuend
and drop the high-order 1. This is your difference
Example:
• 1012 -112 (5 – 3 = 2)
• Here make sure you add a 0 to subtrahend 11 and make it 011
• 11 011
• Find 1’s complement: 011 100
• Find 2’s complement = 1’s complement +1: 100 101
• 101 +101 = 1010
• Ignore MSB, so answer is 102 = 2
Shivoo
Koteshwar’s
Notes
12
shivoo@pes.edu
13. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Note:
• When you are using 2’s complement’s methods note that 2’s
complement is a signed representation. So when you get a 1
at the MSB after subtracting, it just means that it is a
negative number.
o So when you want to find the equivalent number, don’t
use MSB as a value bit. Use it as an indicator for a
negative number
o Equivalent positive number would be a 2’s complement
of the same with a negative sign attached to it
Example:
Shivoo
Koteshwar’s
Notes
13
shivoo@pes.edu
14. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Octal Subtraction using compliment:
Shivoo
Koteshwar’s
Notes
14
shivoo@pes.edu
15. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Hexadecimal Subtraction using compliment:
Shivoo
Koteshwar’s
Notes
15
shivoo@pes.edu
16. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Fractions: Binary to Decimal
Decimal representation:
• 953.78 = 9 x 102 + 5 x 101 + 3 x 100 + 7 x 10-1 + 8 x 10-2
= 900 + 50 + 3 + .7 + .08 = 953.78
Similarly, binary also can be represented as above with the right
base considered:
• 1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2
= 8 + 0 + 2 + 1 + 0.5 + 0.25
= 11.75
Fractions: Decimal to Binary
• No change in the integer part of the number conversion
• Multiply the fractional part with the base, 2 . Note the integer
part of this product and multiply the fractional part with the
base, 2 …repeat the steps until you get a repeat of bits or till
the required accuracy
• Typically 4 bits at least is computed (4 integer part from 4
products)
Shivoo
Koteshwar’s
Notes
16
shivoo@pes.edu
17. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
Fractions: Octal to Decimal
• 0.4138 = 4 x 8-1 + 1 x 8-2 + 3 x 8-3
= 4(0.125) + 1(0.015625) +3(0.001953125)
= 0.5 + 0.015625 + 0.005859375
= 0.521484375
Fractions: Decimal to Octal
Fractions: Hexadecimal to Decimal
• 0.41316 = 4 x 16-1 + 1 x 16-2 + 3 x 16-3
= 4(0.0625) + 1(0.00390625)+3(0.000244140625)
= 0.25 + 0.00390625 + 0.000732421875
= 0.254639
Fractions: Decimal to Hexadecimal
Shivoo
Koteshwar’s
Notes
17
shivoo@pes.edu
18. Number
Systems
(1st
Semester)
UNIT
7
Notes
v1.0
SUMMARY
Binary Coded Decimal Number (BCD)
It is possible to represent decimal numbers simply by encoding
each decimal digit in binary for – called binary-coded-decimal
(BCD)
Because there are 10 digits to represent, it is necessary to use four
bits per digit
• From 0=0000 to 9=1001
• (01111000)BCD =(78)10
Shivoo
Koteshwar’s
Notes
18
shivoo@pes.edu