Professional Documents
Culture Documents
1.1 INTRODUCTION
1
Principles of Digtal Electronics Introduction to Digital Electronics
information, usually
Analog and digital signals are used to transinit 1.3 DIGITAL AND ANALOG SYSTEM
the information, such
through electric signals. In both these technologies,
as any audio or video. is transformed into
electric signals. The difference An analog system contains devices that manipulate physical quantities that
are 2presented in analog form. In the analog system, the quantities can vary
between analog and digital technologies is that in analog technology,
In digital of values.
information is translated intoelectric pulses of varying amplitude. over a continous range
format (zero or one)
technology, translation of information is into binary A digital system is a combination of devices designed to manipulate
where each bit is representative of two distinct amplitudes. physical quantities or information that are repre_ented in digital form.
Process of records Samples analog waveforims into iv) More digital circuitry can be fabricated or 1C chips.
Analog technology
recording waveforms as they are. a limited set of numbers and (vii) Eror detection and correction is possible in digital communication.
records them. (vii) Secure communication is possible due to encryption/decryption and
Data Deterioration by noise during Can be noise-immune. Less af- spread spectrum provides anti-jamming facility.
transmissions Iransmission. More likely to get fected by noise (ix)Compression of data is possible.
affected by noise
(x) Use of VLSI technology has made transceivers small in size and
Flexibility Hardware is not flexible. Hardware flexibility in imple- weight, handy and mobile.
mentation.
(xi) Digital circuits are more reliable.
Uses Audio and video transmission. Computing anddigital electron- The main limitation of digital
ics, also used in audio and video
signal processing is that all the physical
quantities are analog in nature and you have to convert them to digital. However.
applications. a variety of Analog to
Digital Converters (ADCs) and Digital to Analog
Bandwidth Consumes less bandwidth. Consumes more bandwidth. Converters (DACs) are available for this purpose.
Digital systems need high
bandwidth and synchronisation. However, with modern
Storage Stored in the form of wave sig- | Stored in the form of binary bit.
limitations are
techniques, the above
nal.
no more a
problem.
|Power and cost | Draw large power, Low cost. Draw negligible power, Cost is
Digital
electronics has a wide range of
applications from industrial
electronics to the fields of communication, from micro
high. embedded systems to
military equipment. Every electronic gadget you use has digital components
Impedance Low High in it.
Principles of Digtal Electronics
are limitless,
from your laptops. TV
Devices that digital electronics
use
system in
2
machines or the anti breaking
Smart phones to even your washing
infinite. ranging for high
cars have digital components.
Its applications are
versatile. signal processing,
miniature circuits that can be very
end computing to
communication ctc.
flexibility.
THINK ABOUT IT
EXERCISES
from the inside out. None can teach you, none
can
You have to qrow
between analog and digital systems.
make you spiritual. There is no other teacher but your
soul.
owm
1. (a) What is the difference
- Swami Vivekananda
and advantages of digital signal processing?
(b) What are the applications
of digital systems.
2. Explain the advantages
3. What is the difference between analog and digital systems?
SYSTEMS
2.1 INTRODUCTION OF DIFFERENT NUMBER
oon
or digits we
The base of a number system represents that how many symbols
are using in that number system. The base of
number system is also known as
Radix. The base of decimal number system is 10, because it uses 10 symbols
or digits (0 to 9). The base of any number is
indicated in its subscript. For
5
Principles of Digtal Electronics Number Systems
For example, in decimal number 583.5 represents five hundreds, both the units and tens place are
process is repeated till99
is reached. After 99
Srepresents 8 tens and 3 represent three units, Hence, the local weight of 5
is to get 100. (See Fig. 2.2).
the resetted to zero and 1 is placed at the hundreds place
maximum and hence it is called most significant digit or MSD.
3 has least
0 10 100 1000
local weight and hence called least significant digit or LSD. 1 11 101 /1001
Lets take an example. The decimal number 63.58 represent 6 tens, 3 units, 2 12 102
and fractional 13
5 tenths and 8 hundredths. The decimal point separates the integer 3 ***
Positional values
(weight) 98 997
9
L 10 103 10 10 10 102103 99 998
999
The main point here to notice is that the unit place is changed after every
Most Decimal Least
after
Significant Value Significant count, tens place changes after every 10 counts, hundreds place changes
digit (LSD) to notice is that by using one
digit (MSD) every 100 count and so on. One more point
decimal place we can count upto 10 objects (10' = 10) means 0 to 9, by using
the power of 10
Fig. 2.1 Define values of decimal positional to two decimal places we can count upto 10* = 100 objects means from 0 to 99,
Hence, we see that the position relative to decimal point represents the by using 3 decimal places we can count upto 10' = 1000 objects from 0 to 999
local value of the digit. Fig. 2.1 shows the position values of various digits in and by usingn decimal places we can count upto 10" objects.
the number 8357.216. It is clear from this figure that this number actualy
represents: Binary Number System
(8 x10 )+ (3x 10) + (5x 10t) + (7 x 10) + (2x 10)
The decimal number system is very widely used number system but
+(1 x 10)+ (6 x 107) unfortunately it is very difficult and uncomfortable to use deimal system in
digital systems because when we have to design electronic circuits which will
Decimal Counting work for 10 different voltage levels (because we need a different voltage level
In any number system the number of symbols are limited. But the counting for each digit from 0 to 9) but practically it is easy to design electronic cireuits
which work on only two voltage levels because the transistor while
has no limits. It can go on and on to infinity. So, the symbols have to be
as a switchcan work in two regions that is cut off and saturation (OFF and ON
working
repeated for counting to go on and this epetition is related to the base of
number. respectively). So, all digital systems are based on binary number system.
When the In binary system, we have only two states, 0 and 1, hence a much simpler,
counting is done in decimal number system then the counting faster, more reliable and less expensive equipment can be implemented for
starts from zero at the units place and is increased one
by one till 9 is reached. binary number system.
After thata l is placed at the next higher position and 9 is reset to zero so that
it becomes 10. After that, 0 is increased to I and so on till we reach 19. Now In binary number system also, every binary digit has a local place value
'
again, I is increased to 2 and 9 is again reset to zero, so that we get 20, this weight which depends on its position. Hence, binary number system is
8 Principles of Digtal Electronics
of digit is NumberSystems
a positional number system in which the positional value or weight
expressed in powers of 2 (Fig. 2.3). This can be understood using Table 2.1.
The digits to the left of binary point are expressed as posit1ve powers of 2 Table 2.1 Binary counting
while number to the right of binary point Positional values (weights)
are expressed as negative powers of 2.
Weights or =8 -4 2=2 =1 Decimal
For example, the binary number
L 2 2 22 23 positional equivalent
values
(1010.101), be converted into deci-
can 0 0 0
mal by taking the positional value of ev- 1o101o 1 0
ery binary digit and then taking the sum Fig. 2.3 Binary positional values (in 0
of all these positional values (Fig. 2.3). the powers of 2) 0
Note that, the subscript 2 or 10 indicates the base of number i.e. subscript 0
number while the 10 represents a 0 9
represents a binary subscript decimal
number. The binary digit is known as bit also in short (binary digit = bit). In 0 0 10
the binary number shown in Fig. 2.3, there are four bits to the left of binary 0 11
point while there are 3 bits to the right of binary point. The four bits to the lefi 1 0 12
of binary point represent the integer part while the bits to the right of point 0 13
represent the factional part. The left most bit has the maximum weight so that 14
it is known as most significant bit or MSB while the right most bit has the 15
minimum weight so it is known as least significant bit or LSB.
Table 2.1 shows counting of four bit
binary number counting starts from
Binary Counting 0000 (i.e., all bit zero). Then the bit at
position 2 (i.e. the LSB) toggles after
every count (the change of binary value of the bit i.e.,
As the binary counting is done using only two symbols so it is done as shown from I is known as toggling). The bit at
becoming 1 from 0 or 0
in Fig. 2.4. position 2 toggles whenever the LSB
goes from 1 to 0 (note that this happens after
every two positions i.e., when
decimal I changes to 2, 3 changes to 4 etc). The bit at
0 10 100 1000 10000 position 2- toggles
whenever the bit at 2" position goes from I to 0 (note that this
1 11, 101 1001 / 10001 happen every 4
110 positions, i.e. at the transition 3 to 4, 7 to 8 etc.). In the same way the bit at
111/ position 2 toggles (changes) whenever the bit at position 2 moves from 1 to
0 and this happen after every 8
** positions.
1110 ***
Hence, it is clear from Table 2.1 that in a binary number system the LSB
1111 changes after every count, 2' bit changes after every 2 count, 2 bit changes
after every 2= 4 counts, 2" position bit
changes after every 2" 8 counts, etc.
=
Fig. 2.4 Binary counting So, we see that in binary system 2" objects can be counted
using n bits.
For example using four bits 2" counts can be done
(0000 1111). Table 2.1
to
Number Systems 11
Electronics
waay
An easy
hexadecimal digits (also called hexa
Principles ofDigtal binary
number.
binary digit
is o n e
and
1010, 2 position
equivalent of (1010 Hexadecimal Decimal
the
in binary
number
the
decimal
1.e. 2"=1,2i
Binary
= 10 so
For example,
8 and 8
+2 positions
2 = 2 and
2' =
number
1011 three 2 + l = 1 . 0 0000
will be 8
Since +
way
in the binary 0001
same
equivalent
= 10. In the decimal
2
and 2 = 8
are 1, so its 0010
2
3 0011
4
eight symbols i.e
Octal Number System 0100
it uses
and hence 0101
number system
is eight
contains digits from O to 7. The
octal
The base of octal number
follows:
0110
6 and 7. So any octal number are
as
0, 1, 2, 3, 4, 5, in an
0111
position values of the digits 1000
9 1001
8 is the digit multiplied A 10 1010
value of octal digit
the positional number can be calculated B 11
Hence, we see that equivalent
of octal 1011
the decimal all these positional 12
by power of eight. So, values of every digit and summing D
1100
13 1101
by taking the positional number 10 100
the octal 0 E 14
values. For example
decimal as
11 101 1110
converted into 102 F 15 1111
(642)g can be 2 12
shown below: 13
14 The positional value or weights of digit positions in hexadecimal are as
(642) =6 x8 +4x8+2x8 5
**
follows:
= 6x64+4x8+2 x1 16
384 + 32+2 7
20
163 16 16 16 | 16 162 16|164
(418)10 21 So, the decinmal equivalent of any hexadecimal number can be calculated
by calculating the positional value of each digit (by multiplying the digit by
Octal Counting its positional weight) and summing all the positional values. For example, the
start and goes to
from zero decimal equivalent of hexadecimal (642)1 will be
Octal counting
seven and then 7 is
reseted to zero and next 16
one (See Fig. 2.5),
(642)16=6x 16 +4x 16 +2x
higher position is made Fig. 2.5 Octal Counting 6 x 256 +4 x 16+2x1
position can be used
to
hence n octal digit 1536 +64 +2
do a maximum of 8" counts.
= =
(1602)10
Similarly,
Hexadecimal Number System (2AB)= 2 x 16* + Ax 16' +Bx 16
16 and there are 16 symbols thatis 2 x 256 + 10x 16+ 11 x 1
The base of hexadecimal number system is
Table 2.2 represents the relatios 512 160+ 11 (683)10
1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
=
= +
0,
between hexadecimal, decimal and binary numbers. Keep
in mind that the
Number Svstems
15
Part of a Decimal Number into Binary
ofDigtal
Electromics
Conversion of Fractional
Principles
Solution
Solution: (6AB) multiplied by 2 and this processtogoes
(11x 1) the leit of the pOint are written in direct order
+ (10x
16) + (i.e., the numbers appearing
(6 256) x at tne let most position to obtain the binary
binary point is placed
=
+ 160+
11 =(17070 and a
exampie tne decimal number 0.625 can be converted
equivalent of fraction. For
1536
below:
into binary as shown
Example 2.7. (235.17)%=C 16)
+ (5 x
+ (3 x 16') (7x162
Solution: (235.17), (2 x 16) =
+(1x 16) + Product Integer part Fractional part
Fractional
x 1)
of product of product
+(3x 16) +(5 part
= (2 x 256) 0.0625) + (7 x 0.0039) = 1.250 0.250
+(1 x 0.625 x2
+0.0273 = (565.0898)1a
+0.0625
= 512 + 48 +5
0.250 x 2 =0.500 0 0.500
Example 2.8. (7A-D)16= 1
16) + (13 x 16)
Solution: (7A-D),6 =(7 x 16)+ (10 x + 0.0625) = 1.000 0.000
(7x 16) + (10 x 1)
=
(13 x
0.500x 2
= 0.000 0.0000
0.000x 2
Decimal to Binary Conversion
number Write the integer
equivalent, the decimal
For converting a decimal number to its binary order. For part of products
remainders are written in reverse
in direct order
is repeatedly divided by 2 and the follows:
converted into binary as
example-The decimal number 69 is
On writing the integer part of products in direct order
Remainder=1
69+2-34
Remainder=0
(0.625)10 (0.1010),
34+2-17 If the decimal number has both the integer and fraction part then convert
7+2-8 Remainder=1
Number Systems 17
Principles
ofDigtal
2 96 0 Example 2.12. (76)10 =
48 0
2 Solution: On repeated division of 76 by 8
2424 0
2 12 0 8 764
2 6 0
1
r e v e r s e order,
we get,
Hence (76)10 (114
remainders in
Writing the Example 2.13. (94.6)10 =
(96)0=(1100000),
Solution: First we will convert the integer part and the we will convert the
22 47|L 8 I13
231
11
2 51 Hence (94)0 (136)
220
21T
Now multiplying 0.6 repeatedly by 8, we get
0.6 x8 = |4.8
0 0.8 x 8 | 6.4
Hence 47)1o (101111), 0.4 x8 3.2
On repeated multiplication of 0.96,
0.96 x 2= i.92
0.2 x8 1.6
Hence
0.92 x 2= 1.84 (0.6)10(0.4631)g
Hence (94.6)10 (136.4631)s
0.84 x 2 1.68
0.68 x 2= 1.36
0.36 x 2=0.72 Decimal to Hexadecimal Conversion
Hence, (0.96)0 (0.11110), The rule for decimal to hexadecimal conversion are also same as the rules for
Hence, (47.96)10 = (101111.11110),
decimal to binary conversion but in this case the
repeated division is doneby
Note: If the repeated multiplic.tion of the fractional part is non-terminating 16. In the same way the repeated
multiplication for fractional part is also done
then you can stop after four or five multiplications. by 16. [Note that, if the remainder of repeated division (or the integer of the
Decimal to Octal Conversion repeated multiplication) comes out to be 10 or greater than 10 then write it as
A, B, C, D, E, F for 10, 11, 12, 13, 14, 15
The rules of decimal to octal conversions are same as decimal to respectively]
conversion but the repeated division is done by 8. In the same
binary Example 2.14. (99)10=-
way, for fractional 16
part the repeated multiplication is also done by 8. Solution: On repeated division of 99 by 16
NumberSystems 19
Electronics
Principles ofDigtal
18
Binary to Octal Conversion
16 6
0 Use the given Table 2.3 for binary to Octal (or octal to binary) conversion.
Table 2.3
(99)0 (63)16
Hence
Binary ctal
=
Solution:
16250A 001
16 15 F 010 2
011 3
(250)10=(FA)16 100
Hence
101 5
Example 2.16. (280.85)0 =
110 6
16 280 8 111 7
Solution:
16 17 1 For binary to octal conversion, group the bits in three. The digits to the
16 1
left of octal point should be grouped separately starting from right and the
digits to the right of octal point should be grouped separately starting from
left. If the last group is incomplete then add zeros to the left of integer and to
Hence (280)0 (118)16
O.85 x 16 = | D.6 the right of fraction to conplete the group.
0.6x 16 9.6 Then write the equivalent octal number of each group using T'able 2.3
0.6x 16 9.6
Example 2.18. (1100111),=( s
Hence, (0.85)0=(0.D99)16 Solution: Group from right to left in three
Hence, (280.85)10= (118.D99)16 (001 100 111
Write the octal equivalent each group using Table 2.3
Example 2.17. (96.8) = 16
Hence (1100111), = (147)g
Solution: 16960
Example 2.19. (1110111.11001), =(
0
Solution:
Hence (96)10= (60)16
(01110111;110010)> =(167.62
0.8x 16 | C.8 (Note that to complete the incomplete groups two zeros are added to the
left of integer and 1 zero to the right of fraction)
0.8x16 c.8
Hence, (0.8)0 (0.CC)16 Binary to Hexadecimal Conversion
Hence, (96.8)10 (60.C©)h6
For converting binary to hexadecimal (or hexadecimal to binary) use Table 2.2.
Electronics The digi, Number Systems 2 1
20
ofDigtal
Principles the bits
in Tour.
gits
conversion,
group
starting
trom right na d Hexadecimal to Binary Conversion
hexadecimal
separately
For binary to
point
should be grouped sepgrouped separately starting
grouped starungfro
uom
separately To convert hexadecimal number to binary number follows the reverse
the left of
octal should be of
ofinteger
integer and to process
O left
to the right
of octal point
add zeros to the ofbinary to hexadecimal1.e., wnte tne equivalent four bit for each hexadecimal
the digits last group is incomplete then digit using Table 2.2.
lett. If the the group.
complete using Table 2.2,
the right of fraction
to
octal
number of each group Example 2.24. (1977)16= >
equivalent
Then write the Solution : Because
Hexadecimal
(10111111i1000), 6
=
7
Example 2.20. from right to
left.
bits in four, starting
Solution: Group the
Binary 0001 10010111
(0001 11 111000) 0111
using Table 2.2.
Hence (1977)16= (0001100101110111),
each group,
equivalent of Since the three left most zeroes are
Now write the
hexadecimal
insignificant, we can remove them.
Hence,
(17F8)16
Hence (1011111111000),
=
(17F8)16 (1977)16 (1 1001 01110111),
Example 2.21. (111000. 1110001), =)16 Example2.25. (7A5.B2)1,=
Solution: From Table 2.2:
=
(38.E2)16
Solution: (001 1000,1100010) Hexadecimal 7 A B
in mind that don't read 10 as ten but read it as one, zero because this is a
convert
the given
Firstly
number to octal. binary number not a decimal number.
binary
We can add any two binary numbers using these rules in the same way as
Example 2.27. (5B.23)%6=( we have added decimal numbers. Start from LSB and write the sum and if
Solution: Because 3 there is a carry then move it to the next higher position. For example, binary
B 2
Hexadecimal number 1010 can be added to another binary number 101l as follows:
0010 0011
0011
0101 1011 1
Binary
Hence
(SB.23)6=
(O1011011.00100011)
I0 1
three:
Now grouping them in
(001011011 001,000110) 10 0 1
(01011011.00100011),
=
(133.106)8
Hence Carry 1 Carry 1
(SB.23)(133.106)
Hence
Practice Questions So on adding binary number 101G to the binary number 1011 the sum is
(Gii) (As:7)%6 =% iv) (23.24)g= 16 Do you want to check this answer whether it is correct or not? For this
you can convert these numbers to their decimal equivalents.
()(23.51)=10 (vi) (11110.11), =16
Because (1010), = (10)10
(vii) (1101.010), =1 o (vii) (16:0.10), =
(1011), = (11Do
(ir) (999.99)10=16 r)(7254)10 =%
(ri) (A5.7)16=( 1o
Cri) (A7.B)16 = ( s (10101),= (21)10
As we know that on adding decimal number 10 and 11, we get 23, so its
verified that the answer is correct.
2.3 BINARY ADDITION, SUBTRACTION,
MULTIPLICATION AND DViSION Example 2.28. Add binary numbers 10101 and 1100
Add binary
numbers
11100 and
10111
0-1 you borrow 2 from next
this
higher
Is that
position
when a
and 2 + 0 = 2 so 2 1 = 1.
number is borrowed 0 becomes
-
Exampe
2.29. Carry Another way to understand
subtracted from 10 we get 1.
0 0 10 and whe 1 is
Solution: the number from which borrow is taken also
Also keep in mind that
0 decreases by 1.
binary number 1011 can be subtracted from binary
0 For example-The
number 1101 as follows
100+ 10111 =110011
Hence
numbers 11111
and 111 Borrow
Add binary 0
Example 2.30. 11-Cary
Solution: 1 11 0 1
0 0 1 11
0 010
11111+ 111 = 100110 Understand this binary subtraction very carefully. In the second bit position
Hence I has to be subtracted from 0. For this a borrow is taken from the third position
101.11
numbers 11.01 and
Example 2.31. Add binary so it becomes 0 then the subtraction is done using rules given in 2.5 to 2.8.
11-Carry
Solution: 1 1
Example 2.32. (110.01), -(101.1), =
.
I 0 1
Solution:
0 0 1 0 0
10 I I 0
Binary Subtraction
0 011
another binary number using the
The binary number can be subtracted by Example 2.33. (10000),- (11), = -
following rules:
0-0=0 .(2.5) Solution:
0-1= 1(Borrow =1) 2.6)
-0=1 2.7)
1-1 =0 2.8)
0
011
0 1 1 0 1
The second rule of these (Equation 2.6) needs to be understood very
carefully. When you do subtraction on decimal numbers and you have to Note: As a precaution, always check the difference by adding it to
subtract a bigger number from a smaller what you do? You borrow a number subtrahend to get the minuend. Lets check this result
from next higher place and add to this to small number and then do the 01101
subtraction. Since the base of decimal number is 10 so, every time you borrow +00011
a 10 and add to the
smaller number. For example to subtract 9 from 6, you 10000
borrow and add 10 to 6 to make it sixteen and after subtraction
it becones Hence, the answer is verified.
-9=7.
Electomics
Prineiples ofDigtal
26
Binary Multiplication
decimal
multiplication. Thne Binary Division
Number Systems
27
same as
are
multiplication
The method for binary The Binary division is same as decimal diviSion. The rules of
multiplication
are:
are as follows: binary division
rules for binary
0x0=0
0+1=0
0xI=0 remainder )
1=1
Ix0=0 (remainder 0)
Note that zero cannot be divided
by any number.
Ixl=l
numbers 1011
and 110. Example 2.36. Divide the binary nunmber 1100111 by 101.
the produet of binary
Example 2.34: Find 10100 quotient
I01I(multiplicant) Solution: 101)1100111
Solution:
xI 0 (multiplier) 101
0 010
0 0 0
000
101
10 0 0 0 I0 (product) -
01
00
Example 2.35. (1.01), (10.1), x =
11
00
Solution: 11 Remainder
0 1
0 1 Example 2.37. Divide the
0
binary number 10011100 by 1100.
0
0 1101 quotient
1 0 0 1 Solution: 1100) 10011100
1100
Hence (1.01), x (10.1), = (11.001) 1111
(Note that the decimal points has been put three places from the right.) 1100
110
Note that in a binary subtraction if you take a burrow from, a next higher 000
1, than this next higher 1 will become zero. However, ifyou are borrowing 1100
from a next higher 0, thea before borrowing, this next higher zero will
1100
take a borrOW from its next higher bit, so it will become 10, and
then after giving a borrow it will become 10- I = 1. Remainder
Electronics
Number Systems 29
Principles ofDigral
28
(1100.11),+(10),
=. Even if the base is other than these popular bases, then also you can define
Example2.38: the complement for example, it the base is 5 you can define 5's complement
10.011
and 4's complement.
Solution: 10)1100.11|
00 decimal number system the true complement is the 10's complement while in
the binary number system it is called 2's complement. In other words. given a
00 positive number N in base r, with nteger part of n digits, the r's complement
11
N for N #0 and 0 for N =E0.
ofthe number is defined as "
-
10
10
Radix Minus-One Complement
10
To find radix-minus-one complement subtract each digit from radix-minus
one (i.e., 9 in the decimal system and I in the binary system). In decimal
Practice Questions = system radix-minus-one complement means 9's complement and in binary
(i) 1011.1-101.01
i) 10101.110+ 101.01
11.01 = system it means l's complement.
(iv) 10101.1+ In other word, given a positive number N in base r with integer part of n
10.11 =
(ii) 101.1l x
digits and a fraction part of m digits, the (r- 1)'s complement is defined as
-"-N.
2.4 COMPLEMENT OF A NUMBER
Example 2.39. Find the 9's and 10's complement of decimal number 76.
Negative Numbers Solution: To
Toffind 9's complement of 76 subtract each digit from 9.
a negativ Solution:
sign is placed before
a minus
a number to
represent
Decimal Number = 76
Generally. as -32.
number. For example, negative
32 is represented 9's Complement = 23.
numbers are stored complements
as
In digital machines, the negative To find 10's complement of 76 subtract each digit from 9 and then add
subtraction operations can both be
both the addition and one to the LSD
Using this technique
circuits.
done using addition Decimal number = 76
9's Complement = 23
Complement Types +1
of complement are defined:
For any number system, two types 10's Complement 24
Radix complement and radix-I complement.
For example, decimal number can have 10's complement and 9 Example 2.40. Find the 9's complement and 10's complement of (253.56) 0r
can have 2's complement and 1'
complement, binary number system Solution: Decimal number = 253.56
can have 8's complement and 7 9's complement = 746.43
complement, octal number system
can have 16's complement and
complement and hexadecimal number system +1
15's complement. 10's complement 746.44
Number Systems
(1110010
Elrctronics
of
ofDigtal
complement
Prineiples
and 2's each bitfrfrom (a) If end carry occurs then reject this end carry and represent the
30 complement
number
subiract
nent answer.
O 1o ).
Example complement
Add I
step (2). This is the final answer, place a negative sign before
to
Binary 00X)I
101
=
Given l's
complement
+1 answer.
using r's
(101110.1101), complement method may be done as follows:
of
1's and 2's
complement
() Add the minuend A tor's complement of subtrahend B.
2.42: Find
101110.1101
Example
Binary
number = 010001.0010
(i) Inspect the result obtained in step (i) for an end carry:
Solution: (a) If an end carry occurs, discard it.
=
complement
I's +1
(b) If an end carry does not occurs, take the r's complement of the
2's complement 010001.0011 number obtained in step (i) and place a negative sign in front
of the r's complement obtained.
Subtraction
Method of 2's
Complement Example 2.43: Solve the following binary subtraction using
1's and 2's which the
other number
number from complement method.
subtraction, the is subtracted is
that in the process of number which
Note
minuend and
the ) 1101011- 1011000
is called the subtract B from
A means
IS subtracted
want to
subtrahend. For example,
if you subtrahend and the (t) 1101- 1000
called the B is the
B C, then A is the minuend in other
find A the difference. So,
- =
(iii) 1000-1101
you want to
subtraction i.e. C is called
a n s w e r you get
after
subtrahend = difference. A = 1101011
words we can say that minuend Solution:
B= 1011000
Subtraction
Method of
2's Complement l's complement of B = 0100111
want to find A
-
B). Here as
to subtract B
from A (i.e. you
Suppose you want process should be +1
so the following
the minuend andB is the subtrahend,
A is
method of subtraction: 2's complement of B = 0101000
followed for 2's complement
(i.e. B)
subrahend A= 1101011
of
(i) Find the 2's complement of subtrahend obtained in
Add the minuend to the 2's complement 2's complement of B +0101000
(i) of B).
find A + 2's complement
step (1) (i.e. addition i.e. 10010011
arise when you do the
(ii) One of the two conditions may
at the
end carry may not occur (the carry Since end carry occurs, so discard it,
end carry may occur or
called the end carry) for example if and take the answer as positive.
MSB after adding 2 numbers is
a fifth bit, then this
fifth bit is
the addition of 4 bit number gives Hence
1101011- 1011000 = 0010011
Principles of Digtal
's
complement of B +0011
1011
2's complement of 110.01011 =
001.10101
Hence
SInce end carry does not occur, so we have to again take the 2's
complement of this sum and this. 11.11- 101.01101 = -
001.10101
' s complement of 1011
0100
1's Complement Method of Substraction
+1
2's complement of 1011 0101 Suppose we want to subtract B from A means B is the subtrahend and A is the
Hence 1000 1101 = - 0101 minuend, then the following step must be followed for subtraction using 's
complement.
Example 2.44: Perform the following binary subtractions using 2's
complement method. () Find the l's complement of subtrahend (i.e., B).
) 0.111-0.1001 (i) Add the l's complement of B to A (minuend) means find A +l's
) 11.11 - 101.01101 complement of B. One of the two conditions will arise i.e. cary may
occur or carry may not occur.
Solution: (i) A = 0.111
B 0.1001 (a) If end carry occurs then add this end carry to LSB of the sum
obtained in step (i). This is the final answer. Place a positive
I's complement of B = 1.0110
Digtal lind
of then again was obtai
ained in
Principles
occurs
B
which
w h i c h was oDlained i (ii) A= 1101
does not of .
cary complement
sign before
(b) Ifend
ofA
and I's
place
a
negalive the B= 1000
sum
Hence A =
ofthe 1101
answer,
final
This is
step (a). B complement l's
both of
ase r,
bas r, using +0111
answer.
-
B), End around carry
n u m b e r s (A
positive
101000
oftwo
The
substraction
done as
follows:
the subtrahend +
complement may be complement
of
(r-)'s
to the (r-1)'s 0101
)Add
theminuendA Hence 1101-1000 0101
B (i) for end carry:
the result
obtained in step
significant
digit (end (ii) A = 1000
( ) Inspect to least
end carry
occurs,
add I B 1101
(a) lf an Hence A =
around carry). take the (r - 1)'s 1000
again
end carry
does not occur,
binary
subtractions using 1'3 complement to get the final answer.
Perform the following I's complement of 1010 = 0101
Example 2.45:
complement method: Hence 1000 1101 = -0101
1011000 Example 2.46: Subtract the following using 1's complement method:
i) 1101011
-
O010011
0011.010
end around carry, so this end around cary have
Since we obtained an Hence 1011.101- 1000.011 =0011.010
been added to the LSB to get the final
answer. A = 11011.001
(b)
Hence 1101011- 1011000 = 0010011 B 11100.110
T's complement of B =O0011.00
A= 11011.001
to again
take tho
e '
36 Principles
so
we
have
before this 's
Assume microprocessor register 8-bit wide as that shown in Fig. 2.7(a).
a
sign
significant bit (MSB) is the sign bit. If this bit is 0, then the number
occurs,
around
carry
a
negative The most
end and place
Since no
sum
obtained
is positive. However, if the sign bits is 1. then the number is negative. The
complement ofthe answer.
other 7 bits in this 8-bit register represent the magnitude of the number.
to get
the final 00001.10I
Table 2.4(a) and (b) show the 2's complement representations for some
-
1100.1 10
=
complement
I1011.001-
Hence positive and negative numbers. For example, +127 is represented by the 2's
and s complemen
nt
Practice Questions using
I'S complement number 0111111. A decimal -128 is represented by the 2's
numbers
(vi) 0.1111-1
Separate the sign and magnitude part of -3. The negative sign means
(v) 1-0.1l111
using 9's and 10, the sign bit will be 1 in the 2's complement
decimal
numbers representation.
(6) Subtract the given Convert decimal 3 to its 7-bit binary equivalent i.e. decimal3 equals
complement method. 0000011 in binary.
(ii) 25-72
() 78-26
Convert binary 0000011 to its 1's complement form i.e. binary
(iv) 199-2.76
(in) 75.26-25.7
0000011 equals 1111100 in l's complement.
(vi) 0.999-1 Convert the I's complement to its 2's complement form i.e. 111101.
( ) 1-0.999
The 7-bit 2's complement number (1111101 in this example) becomes
method.
(c) Subtract using 15's complement the magnitude part of the entire 8-bit 2"'s complement number (check
) (EDC),6- (ECD)16 the answer from Table 2.4).
i) (ECD- (EDC)16
method. Sign bit
(d) Subtract using 5's complement
(6) (214.23)s-(214)s
(a) (214)-(214.23) MSB LSB
(d) (214,23),
-
(214)
(c) (214)- (214.23) Fig. 2.7 MSB represents the sign of the number
( ) (12345), - (54321), Table 2.4 (a) 2's complement representations of positive numbers
(e) Subtract using 16's complement method. Signed decimal 8-bit 2's complement representation
(BAD.BAD)-(BAD)16
)(BAD),6 - (BAD.BAD)i) +127 111 1111
+126 0 1110
negative
of
numbers
Number Systems
39
38
Principles
representations
1114100
complement
complement
1 I101
represented in 2 7-bit magnitude
-3 1100 Convert binary to decimal
111 complement forn 000 0111
4
000
0010 2s complement
- 126 0001 000 0110
000
127 O000 1's complement
000
- 128
1111 l1101 in 2', 111 1001
decimal -3 equals
the signed
The result is that shown in the register in
number is Fig. 2.9 Converting a 2's complement negative number to
notation. The 2's complement
complement its signed decimal equivalent
Fig. 2.8.
Add+I to the ls complement number i.e. 0000111. The 7-bit number
11111110 1 O000111 is now in binary.
Negative number Magnitude Convert the binary number to its decimal equivalent. This is -7.
Hence, sign bit = 1
of Digtal
Principles Number Systems
40 8 added to
5 give
13
4
and13-7 F6 Solution: (a) (1110.11), =1x2+1xx2+ 1x2'+0x20
(i1 +1x2+1x22
8+4 +2 +0 +0.5 +0.25
-27s = (1475)10
26
b) (237.24)=2 x8 +3 x 8 +7x 80+2x8 +4 x 8-2
Practice Questions = 128+24+7+0.25 +0.0625 (159.3125)0 =
)
(i)
(2335), +(45676),
(99.99),6+ (99.99)16+99.99)16=(-s
(c) x
48 + 10 +0.6875 +0.0078125
(6E16+(7)%6=( - ,
16
(dii') (24),+ (3B)+(4C)1
+(5D), + = (58.695313)10
(iv) (555)%-(16),
(-s =
(d) 2 240 025 x 2 =
| 0.50
() (ABC)46-(BAC)%6=(-16 12 0 0.50x2=||1.00
(vi) (EDC.ECD)16- (ECD.EDC)%=(-16 6 0 0.00x2= 0.00
(vi) (BED.BED)-(ABC)16(
(-
(252) (123.32),
=
(viil) -
(e) (32.41)10
(251.4)10 16 (251)10 (FB)1« (0.4)10 = (0.66)16
(g) (11110011.1101), Hence (251.4)10 (FB.66)16
(h)(1101011011.11011), =( %6
(8) (011110011110100) = (363.64)
) (74.43)s
() (2A.5)16 =2 (h) (001101011011 11011000) = (35B.D8)16
k) (72.5)g = 16
) (52.AB)16 (i) (74.43) (011 100 100 011)2
Electronics
EXERCISES
= (3A.A)16
(001|1010-1010), 1. (a) What do you mean by a number system? What is the base of the number
=
() (72.5)g system? How are decimal number converted to other number systems.
010110, =(122.526)g
(001010010.101
(b) Explain decimal, binary, octal and hexadecimal number systems and their
0 0 2 A 5 1 6 =
interconversion.
(b) 1 0 1 1 . 1 0 - 1001.01
Solve the following: (c) Explain the method to convert decimal, octal and hexadecimal numbers
Example 2. to binary and vice versa.
1101.110 + 100.101 (d) 111100+ 101
(a)
(c) 110.10x 11.10
(d) Explain the addition, subtraction, multiplication and division of binary
numbers.
Solution: (b)Borrow>01
(e) Explain l's and 2's complement methods to subtract one binary number
1011.10
from other.
(a) Cary >1111 -1001.01
1101.110
2. Convert the following binary numbers to decimal.
+100.101 O010.01
(a) 10110 (b) 1111010111 (c) 100100100111001
10010011
(d) 101)1ll0o(1100 (d) 110110.10101 () 10101.01010 1010111.1
(C) 110.11 101 3. Convert the following decimal numbers to binary.
101
11.10 101 (a) 37.45 (b) 73.22 (c) 111.11
000 00
0
1101 1 (d) 101.010 (e) 298.29 ) 756.82
numbers.
x =7 or *=
5. Perform the following operations on the given binary
1100.011 1011.011
or negative, hence
+
(a) 101.1+1011.1 (b)
Snce base of a number cannot be fractional
(d) 111.11- 101.1
(c) 11111.11+10101..
=7
Electronies
44 Principles of Digtal
1010.01
(11.11 - 10.111 Number Systems 45
() 101.l -
x 11.01
(h) 11.101 student to convert (29), to decimal she did it
(g) 1010.11
x 10.1 16. While taking the viva, I asked a
) 110001.10+ 11.01
like this:
(i) 101010+ 101.1
method and 2's complement method (9)=9 x 8°+2 x 8' = 9+ 16 = (25)0
6. Solve using l's complement
11.101 -
11.01 Now I asked her to convert this back to octal and she did it like thís:
(a) 1101.11- 101.1 (b)
(c) 1.1-11.101
(d) 1.111-1I1.
method,
8125111
method and 10's complement
7. Subtract using 9's complement 0
(b)99.13-22.87
(a) 78.25 -23.52
(d) 3.8- 125.92
(25)0 (31)
(c) 72.65 -95.9 then while
Now, I asked that is the decimal equivalent of (29), came to be 25,
the octal equivalent of (25)10 came equal (31),
to and not (29) She said that
8. Fill in the blanks. 0,
calculation Is there s o m e calculation mistake
(a) (10010), + (101.101),
there might be some mistake! really
or there is some other problem!
(b) (0FAC)6+(382.F)16
(c) (1.98)+ (1.98)16 O00
d) (101), + (101), + (101))0 = 16
Gii) (99)h6-(99)s s =