0% found this document useful (0 votes)
35 views26 pages

Unit I

The document discusses analog and digital signals, highlighting their differences, characteristics, advantages, and disadvantages. It explains the types of signals, the components of digital electronics, and various number systems including binary, decimal, octal, and hexadecimal. Additionally, it covers number base conversions and the applications of these systems in digital electronics.

Uploaded by

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

Unit I

The document discusses analog and digital signals, highlighting their differences, characteristics, advantages, and disadvantages. It explains the types of signals, the components of digital electronics, and various number systems including binary, decimal, octal, and hexadecimal. Additionally, it covers number base conversions and the applications of these systems in digital electronics.

Uploaded by

kanikahanda23004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Analog and Digital Signals

A signal is an electrical or electromagnetic quantity that transports data or information from one system
to another. For data transmission, two types of signals are used: Analog signals and digital signals.

Analog and digital signals are very different in many ways. An analog signal is a continuous function,
whereas a digital signal is a discontinuous function.

Analog and digital signals are two signal kinds that carry data or information. As far as analog signal vs.
digital signal is concerned, analog signals feature continuous electrical signals, whereas digital signals
are otherwise without continuity in signals

Types of Signals
Signals are classified into two types:
Continuous-time signals/ Analog signals: A continuous-time signal is any continuous function of time.
Discrete-time signals/ Digital Signals: A discrete-time signal is any series of real numbers separated by
equal time increments (or samples).

Analog signals
Analog signals are used to create information-carrying signals in a variety of systems. Both in terms of
quantities and time, these signals are continuous. As technology evolved, digital transmissions repealed the
use of analog signals. Signals that are natural or occur naturally are analog signals. Since it denotes a
quantity that is analogous to another measure, it is called so. Analog signals are known for use of medium to
channelize the flow of information. Analog signals can be easily distorted, thereby losing clarity and quality.

Examples of Analog Signal

Any natural sound, human voice, and data read by analog devices are examples of analog signals.
Characteristics of Analog Signal:

 These sort of electronic signals are time-varying.

 Lowest and highest values which is either positive or negative.


 It is often either periodic or non-periodic.

 Analog Signal works on continuous data.

 The accuracy of the analog signal isn’t high in comparison to the digital signal.

 It helps you to live natural or physical values.

 Analog signal output form is like Curve, Line, or Graph, so it’s going to not be meaningful to all or any.

Advantages of Analog Signals :


Here, are pros/benefits of Analog Signals.

 It is Easier in processing.

 Analog Signals are best fitted to audio and video transmission.

 It has a coffee cost and is portable.

 It posses higher density.

 Not necessary in Analog Signals to shop for a replacement graphics board.

 It uses less bandwidth than digital sounds.

 It Provide more accurate representation of a sound.

 It is the natural sort of a sound.

 It has less bandwidth.

 Binary digits 0 and 1 represent the optical pulse for storing, processing and transmitting information.

Disadvantages of Analog Signals:


Here are cons / drawback of Analog Signals are as follows.

 Analog tends to possess a lower quality signal than digital.

 The cables are sensitive to external influences.

 Analog wire is expensive and not easily portable.

 In this, it has Low availability of models with digital interfaces.

 Recording analog sound on tape is sort of expensive if the tape is broken.

 It offers limitations in editing.

 Tape is becoming hard to seek out.

 It is quite difficult to synchronize analog sound.

 Quality is definitely lost.

 Data can become corrupted in analog signals.


 Most of sound capturing devices such as phones etc which may become confusing to store a digital
signal.

 Digital sound’s can cut an analog acoustic wave which suggests that you simply can’t get an ideal
reproduction of a sound.

 It offers poor multi-user interfaces.

Digital Signal
A digital signal is one that is a discrete function of time rather than a continuous signal. Digital signals are
binary in nature and consist of discrete voltage values at discrete times. A digital signal, in essence,
represents data and information as a sequence of discrete values at any given time. The digital signal has a
limited number of values.
Characteristics’ of Digital signals as follows.
 Digital signal are discrete signals.
 This type of electronic l signals are often processed and transmitted better compared to analog signal.
 Digital signals are versatile, so it’s widely used.
 The accuracy of the digital signal is best than that of the analog signal.

Advantages of Digital Signals: Here, are pros/advantages of Digital Signals as follows.

 Digital data can be easily compressed.

 Equipment that uses digital signals is more common and fewer expensive.

 These signals turn the moving instruments free from errors.

 You can edit the sound without altering the first copy.

 Digital signals can convey information with less noise, distortion, and interference.

 Digital signals can be reproduced easily in mass quantities at comparatively low costs.

 Digital signal processing is safer because digital information is often easily encrypted and compressed.

 Digital systems are more accurate, and therefore the probability of error occurrence is often reduced by
employing error detection and correction codes.

 Digital signals are often easily stored on any magnetic media or optical media using semiconductor chips.

 Digital signals can be transmitted over long distances.

Disadvantage of Digital Signals:

 Sampling may cause loss of information.

 Processor speed is limited.

 Develop quantization and round-off errors.

 Systems and processing is more complex.


 A higher bandwidth is required for data communication in comparison to analog transmission of
equivalent information.

 Digital systems and processing are typically more complex.


INTRODUCTION TO DGITAL ELECTRONICS

Digital electronics is a branch that studies digital signals and the setup of different
devices that use them. This concept only translates and communicates information in
binary format, i.e. one and zero. It is noise-immune, flexible, and best suited for digital
devices. This concept is entirely different from analogue, which has an extra dimension,
is exposed to noise, is less flexible, and is mostly used for audio and video.

Advantages of Digital Electronics Over the Analog Electronics

It is much easier and more convenient to store information in the digital system than in
the analogue system.

 As the digital system has a noise-immunity feature, the data can be stored and later
retrieved without destruction or degradation.

 Even though multiple circuits are required to manage the signals in a digital
system, every digit is handled by the corresponding hardware components.

 Digital signals are more secure because encryption and compression of signals are
easier in digital systems than in analogue systems.

Components of Digital Electronics

Digital electronics consist of numerous components that are used for performing
specific functions. These components are divided into two categories, namely:

 Active Components

 Passive Components

Active Components
An electrical circuit element that may provide the circuit with power or increase the
circuit's power is referred to as an active element or active component.

Energy sources (voltage or current sources), alternators or generators, and


semiconductor devices like transistors, photodiodes, etc., are typical examples of active
circuit elements.

The circuit component, known as the active elements, is entirely in charge of the
circuit's electric current flow.

Passive Components

A passive circuit component, or simply passive component, is a circuit part that can
only receive electrical energy and dissipate it as heat or store it in either a magnetic
field or an electric field.

As a result, in an electric circuit, a passive component cannot produce electric power or


power amplification. The resistor, inductor, capacitor, and transformer, among other
components, are typical examples of passive circuit components.

Advantages of Digital Electronics

The advantages of digital electronics are as under:

 It is easier to design digital electronics circuits. Technology today has made it


comparatively easy to design digital circuits. The person designing the component
does not need to know the basic operation of the required features.

 Digital electronic circuits are quite reliable. When a digital circuit is designed, it
will always produce the same output at any given point in time.

 It is highly flexible. One can easily change the working of the digital circuit
without even changing the program.

 It is pocket-friendly. With the help of existing technology, it is possible to produce


complex digital circuits at lower costs.

Disadvantages of Digital Electronics

The disadvantages of digital electronics are as under:


 In comparison to the analogue system, the digital system uses more energy.
Calculations and signal processing use up this energy, which causes heat to be
generated.

 These systems cost a lot of money.

 The electronic systems are brittle. In other words, the final results will radically
change if one digital data is misinterpreted.

 As analogue components are included in the design of the digital system, dealing
with analogue concerns in digital systems may be challenging.
Number System
In a digital system, the system can understand only the optional number system. In
these systems, digits symbols are used to represent different values, depending on the
index from which it settled in the number system.

A number system is a method to represent numbers mathematically. It can


use arithmetic operations to represent every number uniquely. To represent a number, it
requires a base or radix.

The digit value in the number system is calculated using:

1. The digit
2. The index, where the digit is present in the number.
3. Finally, the base numbers, the total number of digits available in the number
system.

Types of Number System

There are four common types of number systems based on the radix or base of the
number:

1. Decimal number system or Base 10 number system

2. Binary number system or Base 2 number system

3. Octal number system or Base 8 number system

4. Hexadecimal number system or Base 16 number system

Decimal Number System

The Decimal Number System is the most familiar number system, as it is the one we use
in our everyday life. It has a base of 10, meaning it uses ten digits (0-9) to represent
numbers. Each digit's positional value is a power of 10.

Characteristics:

Base: 10

Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Positional Value: Each digit in a decimal number is multiplied by 10 raised to the power
of its position.
Example:

The decimal number 345 can be expressed as:

345=3×102+4×101+5×100

Binary Number System

The Binary Number System is the foundation of all digital electronics. It has a base of 2,
meaning it uses only two digits: 0 and 1. Every digital device, from simple calculators to
complex computers, relies on the binary system to perform operations and store data.

Characteristics:

Base: 2

Digits Used: 0, 1

Positional Value: Each digit in a binary number is multiplied by 2 raised to the power of
its position.

Example:

The binary number 1101 can be expressed as:

(1101)2=1×23+1×22+0×21+1×20

The binary number system is very important in digital electronics because it directly
correlates with the ON and OFF states of transistors, which are the building blocks of
digital circuits.

Octal Number System

A number system with a base of 8 is known as the octal number system. This system
utilizes 8 symbols—0, 1, 2, 3, 4, 5, 6, and 7—to represent numbers.

To convert an octal number into its equivalent decimal form, follow these steps:

Characteristics:

Base: 8

Digits Used: 0, 1, 2, 3, 4, 5, 6, 7

Positional Value: Each digit in an octal number is multiplied by 8 raised to the power of
its position.
Example:

The octal number 345 can be expressed as

(345)8=3×82+4×81+5×80

Usage:

Octal numbers are often used as a shorthand representation for binary numbers because
each octal digit corresponds to exactly three binary digits.

Hexadecimal Number System

The Hexadecimal Number System is widely used in digital electronics and computing. It
has a base of 16, meaning it uses sixteen digits, including 0-9 and A-F, where A
represents 10, B represents 11, up to F represents 15.

Characteristics:

Base: 16

Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

Positional Value: Each digit in a hexadecimal number is multiplied by 16 raised to the


power of its position.

Example:

The hexadecimal number 1A3 can be expressed as: (1A3)16=1×162+10×161+3×160

Hexadecimal numbers are commonly used in programming and digital electronics to


represent binary data in a more compact and readable form.

Application of Number System

Number systems are integral to digital electronics and are used in various applications:

 Data Representation: Binary numbers are used to represent and store data in digital
systems.
 Programming: Hexadecimal numbers are commonly used in programming and
debugging.
 Digital Circuit Design: Binary, octal, and hexadecimal numbers are used in the
design and analysis of digital circuits.
 Communication Protocols: Number systems are used in protocols for data
transmission and encoding
Number Base Conversion
In our previous section, we learned different types of number systems such as binary,
decimal, octal, and hexadecimal. In this part of the tutorial, we will learn how we can
change a number from one number system to another number system.

As, we have four types of number systems so each one can be converted into the
remaining three systems. There are the following conversions possible in Number
System

1. Binary to other Number Systems.


2. Decimal to other Number Systems.
3. Octal to other Number Systems.
4. Hexadecimal to other Number Systems.

Binary to other Number Systems

There are three conversions possible for binary number, i.e., binary to decimal, binary
to octal, and binary to hexadecimal. The conversion process of a binary number to
decimal differs from the remaining others. Let's take a detailed discussion on Binary
Number System conversion.

Binary to Decimal Conversion


The process of converting binary to decimal is quite simple. The process starts from
multiplying the bits of binary number with its corresponding positional weights. And
lastly, we add all those products.

Let's take an example to understand how the conversion is done from binary to decimal.
Example 1: (10110.001)2

We multiplied each bit of (10110.001)2 with its respective positional weight, and last we add the
products of all the bits with its weight.

(10110.001)2=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+(0×2-1)+(0×2-2)+(1×2-3)

(10110.001)2=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+(0×1⁄2)+(0×1⁄4)+(1×1⁄8)

(10110.001)2=16+0+4+2+0+0+0+0.125

(10110.001)2=(22.125 )10

Binary to Octal Conversion


The base numbers of binary and octal are 2 and 8, respectively. In a binary number,
the pair of three bits is equal to one octal digit. There are only two steps to convert a
binary number into an octal number which are as follows:

1. In the first step, we have to make the pairs of three bits on both sides of the
binary point. If there will be one or two bits left in a pair of three bits pair, we
add the required number of zeros on extreme sides.
2. In the second step, we write the octal digits corresponding to each pair.
Example 1: (111110101011.0011)2

1. Firstly, we make pairs of three bits on both sides of the binary point.

111 110 101 011.001 1

On the right side of the binary point, the last pair has only one bit. To make it a complete pair of three
bits, we added two zeros on the extreme side.

111 110 101 011.001 100

2. Then, we wrote the octal digits, which correspond to each pair.

(111110101011.0011)2=(7653.14)8

Binary to Hexadecimal Conversion


The base numbers of binary and hexadecimal are 2 and 16, respectively. In a binary
number, the pair of four bits is equal to one hexadecimal digit. There are also only two
steps to convert a binary number into a hexadecimal number which are as follows:
1. In the first step, we have to make the pairs of four bits on both sides of the binary
point. If there will be one, two, or three bits left in a pair of four bits pair, we add
the required number of zeros on extreme sides.
2. In the second step, we write the hexadecimal digits corresponding to each pair.
Example 1: (10110101011.0011)2

1. Firstly, we make pairs of four bits on both sides of the binary point.

111 1010 1011.0011

On the left side of the binary point, the first pair has three bits. To make it a complete pair of four bits,
add one zero on the extreme side.

0111 1010 1011.0011

2. Then, we write the hexadecimal digits, which correspond to each pair.

(011110101011.0011)2=(7AB.3)16

Decimal to other Number System


The decimal number can be an integer or floating-point integer. When the decimal
number is a floating-point integer, then we convert both part (integer and fractional) of
the decimal number in the isolated form(individually). There are the following steps that
are used to convert the decimal number into a similar number of any base 'r'.

1. In the first step, we perform the division operation on integer and successive part
with base 'r'. We will list down all the remainders till the quotient is zero. Then
we find out the remainders in reverse order for getting the integer part of the
equivalent number of base 'r'. In this, the least and most significant digits are
denoted by the first and the last remainders.
2. In the next step, the multiplication operation is done with base 'r' of the fractional
and successive fraction. The carries are noted until the result is zero or when the
required number of the equivalent digit is obtained. For getting the fractional part
of the equivalent number of base 'r', the normal sequence of carrying is
considered.

Decimal to Binary Conversion


For converting decimal to binary, there are two steps required to perform, which are as
follows:

1. In the first step, we perform the division operation on the integer and the
successive quotient with the base of binary(2).
2. Next, we perform the multiplication on the integer and the successive quotient
with the base of binary(2).
Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 2.

Operation Quotient Remainder

152/2 76 0 (LSB)

76/2 38 0

38/2 19 0

19/2 9 1

9/2 4 1

4/2 2 0

2/2 1 0

1/2 0 1(MSB)

(152)10=(10011000)2

Step 2:

Now, perform the multiplication of 0.27 and successive fraction with base 2.

Operation Result carry

0.25×2 0.50 0
0.50×2 0 1

(0.25)10=(.01)2

Decimal to Octal Conversion


For converting decimal to octal, there are two steps required to perform, which are as follows:

1. In the first step, we perform the division operation on the integer and the successive
quotient with the base of octal(8).
2. Next, we perform the multiplication on the integer and the successive quotient with the
base of octal(8).

Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 8.

Operation Quotient Remainder

152/8 19 0

19/8 2 3

2/8 0 2

(152)10=(230)8

Step 2:

Now perform the multiplication of 0.25 and successive fraction with base 8.

Operation Result carry


0.25×8 0 2

(0.25)10=(2)8

So, the octal number of the decimal number 152.25 is 230.2

Decimal to hexadecimal conversion


For converting decimal to hexadecimal, there are two steps required to perform, which are as follows:

1. In the first step, we perform the division operation on the integer and the successive quotient with
the base of hexadecimal (16).
2. Next, we perform the multiplication on the integer and the successive quotient with the base of
hexadecimal (16).

Example 1: (152.25)10

Step 1:

Divide the number 152 and its successive quotients with base 8.

Operation Quotient Remainder

152/16 9 8

9/16 0 9

(152)10=(98)16

Step 2:

Now perform the multiplication of 0.25 and successive fraction with base 16.

Operation Result carry

0.25×16 0 4

(0.25)10=(4)16

So, the hexadecimal number of the decimal number 152.25 is 230.4.


Octal to other Number System
Like binary and decimal, the octal number can also be converted into other number systems. The
process of converting octal to decimal differs from the remaining one. Let's start understanding how
conversion is done.

Octal to Decimal Conversion


The process of converting octal to decimal is the same as binary to decimal. The process starts from
multiplying the digits of octal numbers with its corresponding positional weights. And lastly, we add all
those products.

Let's take an example to understand how the conversion is done from octal to decimal.

Example 1: (152.25)8

Step 1:

We multiply each digit of 152.25 with its respective positional weight, and last we add the products of
all the bits with its weight.

(152.25)8=(1×82)+(5×81)+(2×80)+(2×8-1)+(5×8-2)
(152.25)8=64+40+2+(2×1⁄8)+(5×1⁄64)
(152.25)8=64+40+2+0.25+0.078125
(152.25)8=106.328125

So, the decimal number of the octal number 152.25 is 106.328125

Octal to Binary Conversion


The process of converting octal to binary is the reverse process of binary to octal. We write the three
bits binary code of each octal number digit.

Example 1: (152.25)8

We write the three-bit binary digit for 1, 5, 2, and 5.

(152.25)8=(001101010.010101)2

So, the binary number of the octal number 152.25 is (001101010.010101)2

Octal to hexadecimal conversion


For converting octal to hexadecimal, there are two steps required to perform, which are as follows:

1. In the first step, we will find the binary equivalent of number 25.
2. Next, we have to make the pairs of four bits on both sides of the binary point. If there will be one,
two, or three bits left in a pair of four bits pair, we add the required number of zeros on extreme sides
and write the hexadecimal digits corresponding to each pair.

Example 1: (152.25)8
Step 1:

We write the three-bit binary digit for 1, 5, 2, and 5.

(152.25)8=(001101010.010101)2

So, the binary number of the octal number 152.25 is (001101010.010101)2

Step 2:

1. Now, we make pairs of four bits on both sides of the binary point.

0 0110 1010.0101 01

On the left side of the binary point, the first pair has only one digit, and on the right side, the last pair
has only two-digit. To make them complete pairs of four bits, add zeros on extreme sides.

0000 0110 1010.0101 0100

2. Now, we write the hexadecimal digits, which correspond to each pair.

(0000 0110 1010.0101 0100)2=(6A.54)16

Hexa-decimal to other Number System


Like binary, decimal, and octal, hexadecimal numbers can also be converted into other number systems.
The process of converting hexadecimal to decimal differs from the remaining one. Let's start
understanding how conversion is done.

Hexa-decimal to Decimal Conversion


The process of converting hexadecimal to decimal is the same as binary to decimal. The process starts
from multiplying the digits of hexadecimal numbers with its corresponding positional weights. And
lastly, we add all those products.

Let's take an example to understand how the conversion is done from hexadecimal to decimal.

Example 1: (152A.25)16

Step 1:

We multiply each digit of 152A.25 with its respective positional weight, and last we add the products of
all the bits with its weight.

(152A.25)16=(1×163)+(5×162)+(2×161)+(A×160)+(2×16-1)+(5×16-2)
(152A.25)16=(1×4096)+(5×256)+(2×16)+(10×1)+(2×16-1)+(5×16-2)
(152A.25)16=4096+1280+32+10+(2×1⁄16)+(5×1⁄256)
(152A.25)16=5418+0.125+0.125
(152A.25)16=5418.14453125

So, the decimal number of the hexadecimal number 152A.25 is 5418.14453125


Hexadecimal to Binary Conversion
The process of converting hexadecimal to binary is the reverse process of binary to hexadecimal. We
write the four bits binary code of each hexadecimal number digit.

Example 1: (152A.25)16

We write the four-bit binary digit for 1, 5, A, 2, and 5.

(152A.25)16=(0001 0101 0010 1010.0010 0101)2

So, the binary number of the hexadecimal number 152.25 is (1010100101010.00100101)2

Hexadecimal to Octal Conversion


For converting hexadecimal to octal, there are two steps required to perform, which are as follows:

1. In the first step, we will find the binary equivalent of the hexadecimal number.
2. Next, we have to make the pairs of three bits on both sides of the binary point. If there will be one or
two bits left in a pair of three bits pair, we add the required number of zeros on extreme sides and
write the octal digits corresponding to each pair.

Example 1: (152A.25)16

Step 1:

We write the four-bit binary digit for 1, 5, 2, A, and 5.

(152A.25)16=(0001 0101 0010 1010.0010 0101)2

So, the binary number of hexadecimal number 152A.25 is (0011010101010.010101)2

Step 2:

3. Then, we make pairs of three bits on both sides of the binary point.

001 010 100 101 010.001 001 010

4. Then, we write the octal digit, which corresponds to each pair.

(001010100101010.001001010)2=(12452.112)8

So, the octal number of the hexadecimal number 152A.25 is 12452.112

Signed and Unsigned Binary Numbers


The integer variables are represented in a signed and unsigned manner. The positive and
negative values are differentiated by using the sign flag in signed numbers. The unsigned
numbers do not use any flag for the sign, i.e., only positive numbers can be stored by the
unsigned numbers.

It is very easy to represent positive and negative numbers in our day to day life. We represent
the positive numbers without adding any sign before them and the negative number with -
(minus) sign before them. But in the digital system, it is not possible to use negative sign before
them because the data is in binary form in digital computers. For representing the sign in binary
numbers, we require a special notation.

Binary Numbers Representation


Our computer can understand only (0, 1) language. The binary numbers are represented in both
ways, i.e., signed and unsigned. The positive numbers are represented in both ways- signed and
unsigned, but the negative numbers can only be described in a signed way. The difference
between unsigned and signed numbers is that unsigned numbers do not use any sign bit for
positive and negative numbers identification, but the signed number used.

Unsigned Numbers
As we already know, the unsigned numbers don't have any sign for representing negative
numbers. So the unsigned numbers are always positive. By default, the decimal number
representation is positive. We always assume a positive sign in front of each decimal digit.

There is no sign bit in unsigned binary numbers so it can only represent its magnitude. In zero
and one, zero is an unsigned binary number. There is only one zero (0) in this representation,
which is always positive. Because of one unique binary equivalent form of a number in
unsigned number representation, it is known as unambiguous representation technique. The
range of the unsigned binary numbers starts from 0 to (2n-1).

Example: Represent the decimal number 102 in unsigned binary numbers.

We will change this decimal number into binary, which has the only magnitude of the given
name.

Decimal Operation Result Remainder

102 102/2 51 0

51 51/2 25 1

25 25/2 12 1

12 12/2 6 0

6 6/2 3 0

3 3/2 1 1

1 1/2 0 1

So the binary number of (102)10 is (1100110)2, a 7-bit magnitude of the decimal number 102.

Signed Numbers
The signed numbers have a sign bit so that it can differentiate positive and negative integer
numbers. The signed binary number technique has both the sign bit and the magnitude of the
number. For representing the negative decimal number, the corresponding symbol in front of the
binary number will be added.

The signed numbers are represented in three ways. The signed bit makes two possible
representations of zero (positive (0) and negative (1)), which is an ambiguous representation.
The third representation is 2's complement representation in which no double representation of
zero is possible, which makes it unambiguous representation. There are the following types of
representation of signed binary numbers:

 Sign-Magnitude form

In this form, a binary number has a bit for a sign symbol. If this bit is set to 1, the number
will be negative else the number will be positive if it is set to 0. Apart from this sign-bit,
the n-1 bits represent the magnitude of the number.

 1's Complement

In number representation techniques, the binary number system is the most used
representation technique in digital electronics. The complement is used for representing
the negative decimal number in binary form. Different types of complement are possible
of the binary number, but 1's and 2's complements are mostly used for binary numbers.
We can find the 1's complement of the binary number by simply inverting the given
number.

For finding 1's complement of the binary number, we can implement the logic circuit
also by using NOT gate. We use NOT gate for each bit of the binary number. So, if we
want to implement the logic circuit for 5-bit 1's complement, five NOT gates will be
used.

Example 1: 11010.1101

For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So
the 1's complement of the number 11010.1101 comes out 00101.0010.

Use of 1's complement


1's complement plays an important role in representing the signed binary numbers. The
main use of 1's complement is to represent a signed binary number. Apart from this, it is
also used to perform various arithmetic operations such as addition and subtraction.
In signed binary number representation, we can represent both positive and negative
numbers. For representing the positive numbers, there is nothing to do. But for
representing negative numbers, we have to use 1's complement technique. For
representing the negative number, we first have to represent it with a positive sign, and
then we find the 1's complement of it.

 2's Complement

Just like 1's complement, 2's complement is also used to represent the signed binary
numbers. For finding 2's complement of the binary number, we will first find the 1's
complement of the binary number and then add 1 to the least significant bit of it.

For example, if we want to calculate the 2's complement of the number 1011001, then
firstly, we find the 1's complement of the number that is 0100110 and add 1 to the LSB.
So, by adding 1 to the LSB, the number will be (0100110)+1=0100111.

Use of 2's complement


2's complement is used for representing signed numbers and performing arithmetic
operations such as subtraction, addition, etc. The positive number is simply represented
as a magnitude form. So there is nothing to do for representing positive numbers. But if
we represent the negative number, then we have to choose either 1's complement or 2's
complement technique. The 1's complement is an ambiguous technique, and 2's
complement is an unambiguous technique. Let's see an example to understand how we
can calculate the 2's complement in signed binary number representation.

1's and 2's Complement Subtraction


Rules in 1s and 2s complement subtraction
Rule using 1s Complement
Step 1: Given numbers must be in the form X-Y with same digits. Extra 0 can
be added at the beginning to make same digits.
Step 2: Calculate 1's complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that extra bit and add on its remaining bit.
If there is no extra bit, find 1's Complement of result in step 3 and add
(-)ve sign.
Rule using 2s Complement
Step 1: Given numbers must be in the form X-Y with same digits. Extra 0 can
be added at the beginning to make same digits.
Step 2: Calculate 2’s complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that and remaining bit will be the answer.
If there is no extra bit, find 2’s Complement of result in step 3 and
add (-)ve sign.
Example:
Subtract (1010) from (1111) using 1's and 2's complement.
Ans. Given question is (1111) - (1010)
A) Using 1's Complement,
First calculating 1's complement of (1010) is (0101)
Adding (0101) with (1111) we get
(0101) + (1111) = (10100)
Since, there is extra bit i.e. 4 digits added with 4 digits and gives 5 digits
result
Removing that extra bit and adding on it
(0100) + (1) = (0101)
Hence, result is (0101)

B) Using 2's Complement,


First calculating 2's complement of (1010) is (0101) + (1) = (0110)
Adding (0111) with (1101) we get
(0110) + (1111) = (10101)
Since, there is extra bit i.e. 4 digits added with 4 digits and gives 5 digits
result
Removing that extra bit, we get (0101) ,Hence, result is (0101).

Example:
Subtract (100) from (11) using 1's and 2's complement.
Ans. Given question is (11) - (100), making same digits we have (011) - (100)
A) Using 1's Complement,
First calculating 1's complement of (100) is (011)
Adding (011) with (011) we get
(011) + (011) = (110)
Since, there is no extra bit i.e. 3 digits added with 3 digits and gives 3 digits
result
Calculating 1's complement of (110) we get (001) and putting (-)ve sign
Hence, result is -(001)

B) Using 2's Complement,


First calculating 2's complement of (100) is (011) + (1) = (100)
Adding (100) with (011) we get
(100) + (011) = (111)
Since, there is no extra bit i.e. 3 digits added with 3 digits and gives 3 digits
result
Calculating 2's complement of (111) we get (000) + (1) = (0001) and putting
(-)ve sign
Hence, result is -(001)
Difference between 1’s Complement Representation and 2’s Complement
Parameters 1’s Complement Representation 2’s Complement Representation

Process of To generate a 1’s complement for any given To generate a 2’s complement for any given
Generation binary number, you only need to invert that binary number, you need to invert it. Then you
number. need to add 1 to the LSB (Least Significant Bit)
of the generated result.

Example For a binary number like 110010, the 1’s For a binary number like 110010, the 2’s
complement would be 001101. complement would be 001110.

Logic Gates It is a very simple type of implementation that It makes use of the BOT gate for every bit of
Used makes use of the NOT gate for every bit of input. input, along with a full adder.

Number You can use the 1’s in case of a signed binary You can use the 2’s in case of a signed binary
Representation representation. Still, you cannot use it as an representation. It is also the most suitable in the
ambiguous representation in the case of the form of an unambiguous representation of all the
number 0. available numbers.

K-bits Register In the case of a k-bits register, it can store the In the case of a k-bits register, it can store the
lowest negative number as -(2(k-1)-1) and the lowest negative number as -(2(k-1)) and the
largest positive number as (2(k-1)-1). largest positive number as (2(k-1)-1).

Representation The number 0 has two major representations- one The number -0 has a single representation for
of 0 is +0 (for instance, 0 0000 in a five-bit register), both +0 and -0 (for instance, 0 0000 in a five-bit
and the second one is -0 (for instance, 1 1111 in a register). Here, we always consider the zero to
five-bit register). be positive.

Sign Extension We need to use the sign extension for the In this case, too, we need to use the sign
conversion of any signed integer from a given extension. It converts any signed integer from a
sign to another one. given sign to another one.

End-Around- In the case of a 1’s complement arithmetic In the case of a 2’s complement arithmetic
Carry-Bit operation, there occurs an addition of the end- operation, no addition of end-around-carry-
around-carry-bit. We add it to the result’s LSB. bit occurs. It ignores this addition.

Ease of The complement arithmetic operations of 1’s The complement arithmetic operations of the 2’s
Operation type are not easier than the 2’s type because they type are much easier to operate than the 1’s type
always need to add end-around-carry-bit. because they lack the addition of end-around-
carry-bit.

You might also like