0% found this document useful (0 votes)
29 views51 pages

Notes of de Unit-1 Part 1

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

Notes of de Unit-1 Part 1

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

United College Of Engineering & Research, Naini, Payagraj

Department Of Electronics & Communication Engineering


Digital Electronics (KEE- 401)
Unit-1

Digital electronics are those systems that use a digital signal instead of an analog signal. Digital Electronic circuits
are those which operate with digital signals. These are discrete signals which are sampled from the analog signal.
Digital circuits use the binary notation for transmission of the signal. A digital circuit is constructed from small
electronic circuits called logic gates which are used in creation of combination logic. Each logic gate is built to
perform a function of Boolean logic when acting on logic signals.

Why Engineers need to know about Digital System Electronics?

Computer science and engineering has several fields of electrical engineering and it required to form computer
hardware and software. Computer engineers have training in electronic engineering, software design, and hardware-
software integration instead of only software engineering or electronic engineering. Right from the design of
individual micro-controllers, microprocessors, personal computers, and supercomputers, to circuit design computer
engineers participate in many hardware and software factors of computing.
The Digital electronics uses VLSI technology, which has greatly decreased the size and area of the circuit boards
and has enhanced the accuracy and performance of the systems. Mostly, digital systems have the advantage of data
encryption for the communication purposes. The data transmission is safe and secure. All these factors clearly show
that the digital electronic stream has wide future scope in the modern era.

Advantages Of Digital Electronics

 Digital Electronic circuits are relatively easy to design.


 It has higher precision rate in terms of accuracy.
 Transmitted signals are not lost over long distance.
 Digital Signals can be stored easily.
 Digital Electronics is more immune to 'error' and 'noise' than analog. But in case of high-speed designs, a
small noise can induce error in the signal.
 The voltage at any point in a Digital Circuit can be either high or low; hence there is less chance of
confusion.
 Digital Circuits have the flexibility that can change the functionality of digital circuits by making changes
in software instead of changing actual circuit.

Disadvantages of Digital Electronics

 The real world is analog in nature, all quantities such as light, temperature, sound etc. Digital Systems is
required to translate a continuous signal to discrete which leads to small quantization errors. To reduce
quantization errors a large amount of data needs to be stored in Digital Circuit.
 Digital Circuits operate only with digital signals hence, encoders and decoders are required for the process.
This increases the cost of equipment.
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.

In simple terms, for representing the information, we use the number system in the digital system.

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.

Note: When the number system represents a digit from 0 - 9, the base of the number will be 10.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Types of Number System

In the digital computer, there are various types of number systems used for representing information.

1. Binary Number System

2. Decimal Number System

3. Hexadecimal Number System

4. Octal Number System

Binary Number System

Generally, a binary number system is used in the digital computers. In this number system, it carries only two digits,
either 0 or 1. There are two types of electronic pulses present in a binary number system. The first one is the absence
of an electronic pulse representing '0'and second one is the presence of electronic pulse representing '1'. Each digit is
known as a bit. A four-bit collection (1101) is known as a nibble, and a collection of eight bits (11001010) is known
as a byte. The location of a digit in a binary number represents a specific power of the base (2) of the number
system.

Characteristics:

1. It holds only two values, i.e., either 0 or 1.

2. It is also known as the base 2 number system.

3. The position of a digit represents the 0 power of the base(2). Example: 2 0

4. The position of the last digit represents the x power of the base(2). Example: 2 x, where x represents the last
position, i.e., 1

Examples:

(10100)2, (11011)2, (11001)2, (000101)2, (011010)2.

Decimal Number System

The decimal numbers are used in our day to day life. The decimal number system contains ten digits from 0 to
9(base 10). Here, the successive place value or position, left to the decimal point holds units, tens, hundreds,
thousands, and so on.

The position in the decimal number system specifies the power of the base (10). The 0 is the minimum value of the
digit, and 9 is the maximum value of the digit. For example, the decimal number 2541 consist of the digit 1 in the
unit position, 4 in the tens position, 5 in the hundreds position, and 2 in the thousand positions and the value will be
written as:

(2×1000) + (5×100) + (4×10) + (1×1)


(2×103) + (5×102) + (4×101) + (1×100)
2000 + 500 + 40 + 1
2541
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Octal Number System

The octal number system has base 8(means it has only eight digits from 0 to 7). There are only eight possible digit
values to represent a number. With the help of only three bits, an octal number is represented. Each set of bits has a
distinct value between 0 and 7.

Below, we have described certain characteristics of the octal number system:

Characteristics:

1. An octal number system carries eight digits starting from 0, 1, 2, 3, 4, 5, 6, and 7.

2. It is also known as the base 8 number system.

3. The position of a digit represents the 0 power of the base(8). Example: 8 0

4. The position of the last digit represents the x power of the base(8). Example: 8 x, where x represents the last
position, i.e., 1

Number Octal Number

0 000

1 001

2 010

3 011

4 100

5 101

6 110

7 111

Examples:

(273)8, (5644)8, (0.5365)8, (1123)8, (1223)8.

Hexadecimal Number System

It is another technique to represent the number in the digital system called the hexadecimal number system. The
number system has a base of 16 means there are total 16 symbols(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) used for
representing a number. The single-bit representation of decimal values10, 11, 12, 13, 14, and 15 are represented by
A, B, C, D, E, and F. Only 4 bits are required for representing a number in a hexadecimal number. Each set of bits
has a distinct value between 0 and 15. There are the following characteristics of the octal number system:
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Characteristics:

1. It has ten digits from 0 to 9 and 6 letters from A to F.

2. The letters from A to F defines numbers from 10 to 15.

3. It is also known as the base 16number system.

4. In hexadecimal number, the position of a digit represents the 0 power of the base(16). Example: 16 0

5. In hexadecimal number, the position of the last digit represents the x power of the base(16). Example: 16x,
where x represents the last position, i.e., 1

Binary Number Hexadecimal Number

0000 0

0001 1

0010 2

0011 3

0100 4

0101 5

0110 6

0111 7

1000 8

1001 9

1010 A

1011 B

1100 C

1101 D

1110 E

1111 F
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Examples:

(FAC2)16, (564)16, (0ABD5)16, (1123)16, (11F3)16.

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:
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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'.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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 2
0.25×8
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

(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.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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.


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

(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

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 example, 1's
complement of binary number 1011001 is 0100110. We can find the 2's complement of the binary number by
changing each bit(0 to 1 and 1 to 0) and adding 1 to the least significant bit. For example, 2's complement of binary
number 1011001 is (0100110)+1=0100111.

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.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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.

Example 2: 100110.1001

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 100110.1001 comes out 011001.0110.

1's Complement Table

Binary Number 1's Complement

0000 1111

0001 1110

0010 1101

0011 1100

0100 1011

0101 1010

0110 1001

0111 1000

1000 0111

1001 0110

1010 0101

1011 0100

1100 0011

1101 0010

1110 0001

1111 0000
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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.

Let's take an example of a positive and negative number and see how these numbers are represented.

Example 1: +6 and -6

The number +6 is represented as same as the binary number. For representing both numbers, we will take the 5-bit
register.

So the +6 is represented in the 5-bit register as 0 0110.

The -6 is represented in the 5-bit register in the following way:

1. +6=0 0110

2. Find the 1's complement of the number 0 0110, i.e., 1 1001. Here, MSB denotes that a number is a negative
number.

Here, MSB refers to Most Significant Bit, and LSB denotes the Least Significant Bit.

Example 2: +120 and -120

The number +120 is represented as same as the binary number. For representing both numbers, take the 8-bit
register.

So the +120 is represented in the 8-bit register as 0 1111000.

The -120 is represented in the 8-bit register in the following way:

1. +120=0 1111000

2. Now, find the 1's complement of the number 0 1111000, i.e., 1 0000111. Here, the MSB denotes the
number is the negative number.

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. We can also create the logic circuit using OR, AND, and NOT gates. The logic circuit for
finding 2's complement of the 5-bit binary number is as follows:
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Example 1: 110100

For finding 2'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 110100 is 001011. Now add 1 to the LSB of this number, i.e., (001011)+1=001100.

Example 2: 100110

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 100110 is 011001. Now add one the LSB of this number, i.e., (011001)+1=011010.

2's Complement Table

Binary Number 1's Complement 2's complement

0000 1111 0000

0001 1110 1111

0010 1101 1110

0011 1100 1101

0100 1011 1100

0101 1010 1011

0110 1001 1010

0111 1000 1001

1000 0111 1000

1001 0110 0111

1010 0101 0110

1011 0100 0101

1100 0011 0100

1101 0010 0011

1110 0001 0010

1111 0000 0001


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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.

Example 1: +6 and -6

The number +6 is represented as same as the binary number. For representing both numbers, take the 5-bit register.

So the +6 is represented in the 5-bit register as 0 0110.

The -6 is represented in the 5-bit register in the following way:

1. +6=0 0110

2. Now, find the 1's complement of the number 0 0110, i.e. 1 1001.

3. Now, add 1 to its LSB. When we add 1 to the LSB of 11001, the newly generated number comes out
11010. Here, the sign bit is one which means the number is the negative number.

Example 2: +120 and -120

The number +120 is represented as same as the binary number. For representing both numbers, take the 8-bit
register.

So the +120 is represented in the 8-bit register as 0 1111000.

The -120 is represented in the 8-bit register in the following way:

1. +120=0 1111000

2. Now, find the 1's complement of the number 0 1111000, i.e. 1 0000111. Here, the MSB denotes the
number is the negative number.

3. Now, add 1 to its LSB. When we add 1 to the LSB of 1 0000111, the newly generated number comes out 1
0001000. Here, the sign bit is one, which means the number is the negative number.

9's and 10's Complement

If the number is binary, then we use 1's complement and 2's complement. But in case, when the number is a decimal
number, we will use the 9's and 10's complement. The 10's complement is obtained from the 9's complement of the
number, and we can also find the 9's and 10's complement using the r's and (r-1)'s complement formula.

9's Complement

The 9's complement is used to find the subtraction of the decimal numbers. The 9's complement of a number is
calculated by subtracting each digit of the number by 9. For example, suppose we have a number 1423, and we want
to find the 9's complement of the number. For this, we subtract each digit of the number 1423 by 9. So, the 9's
complement of the number 1423 is 9999-1423= 8576.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Subtraction using 9's complement

With the help of the 9's complement, the process of subtraction is done in a much easier way. Generally, we subtract
the subtrahend from the minuend, but in a case when we perform subtraction using 9's complement, there is no need
to do the same.

For subtracting two numbers using 9's complement, we first have to find the 9's complement of the subtrahend and
then we will add this complement value with the minuend. There are two possible cases when we subtract the
numbers using 9's complement.

Case 1: When the subtrahend is smaller than the minuend.

For subtracting the smaller number from the larger number using 9's complement, we will find the 9's
complement of the subtrahend, and then we will add this complement value with the minuend. By adding
both these values, the result will come in the formation of carry. At last, we will add this carry to the result
obtained previously.

Case 2: When the subtrahend is greater than the minuend.

In this case, when we add the complement value and the minuend, the result will not come in the formation
of carry. This indicates that the number is negative, and for finding the final result, we need to find the 9's
complement of the result.

10's Complement

The 10's complement is also used to find the subtraction of the decimal numbers. The 10's complement of a number
is calculated by subtracting each digit by 9 and then adding 1 to the result. Simply, by adding 1 to its 9's complement
we can get its 10's complement value. For example, suppose we have a number 1423, and we want to find the 10's
complement of the number. For this, we find the 9's complement of the number 1423 that is 9999-1423= 8576, and
now we will add 1 to the result. So the 10's complement of the number 1423 is 8576+1=8577.

Subtraction using 10's complement

For subtracting two numbers using 10's complement, we first have to find the 10's complement of the subtrahend,
and then we will add this complement value with the minuend. There are two possible cases when we subtract the
numbers using 10's complement.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Case 1: When the subtrahend is smaller than the minuend.

For subtracting the smaller number from the larger number using 10's complement, we will find the 10's
complement of the subtrahend and then we will add this complement value with the minuend. By adding both these
values, the result will come in the formation of carry. We ignore this carry and the remaining digits will be the
answer.

Case 2: When the subtrahend is greater than the minuend.

In this case, when we add the complement value and the minuend, the result will not come in the formation of carry.
This indicates that the number is negative and for finding the final result, we need to find the 10's complement of the
result obtained by adding complement value of subtrahend and minuend.

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.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

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 (2 n-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
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-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:

1. 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.

2. 1's Complement

By inverting each bit of a number, we can obtain the 1's complement of a number. The negative numbers
can be represented in the form of 1's complement. In this form, the binary number also has an extra bit for
sign representation as a sign-magnitude form.

3. 2's Complement

By inverting each bit of a number and adding plus 1 to its least significant bit, we can obtain the 2's
complement of a number. The negative numbers can also be represented in the form of 2's complement. In
this form, the binary number also has an extra bit for sign representation as a sign-magnitude form.

Addition and Subtraction using 1's complement

In our previous section, we learned about different complements such as 1's complement, 2's complement, 9's
complement, and 10's complement, etc.. In this section, we will learn to perform the arithmetic operations such as
addition and subtraction using 1's complement. We can perform addition and subtraction using 1's, 2's, 9's, and 10's
complement.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Addition using 1's complement

There are three different cases possible when we add two binary numbers which are as follows :

Case 1: Addition of the positive number with a negative number when the positive number has a greater
magnitude.

Initially, calculate the 1's complement of the given negative number. Sum up with the given positive number. If we
get the end-around carry 1, it gets added to the LSB.

Example: 1101 and -1001

1. First, find the 1's complement of the negative number 1001. So, for finding 1's complement, change all 0 to
1 and all 1 to 0. The 1's complement of the number 1001 is 0110.

2. Now, add both the numbers, i.e., 1101 and 0110;


1101+0110=1 0011

3. By adding both numbers, we get the end-around carry 1. We add this end around carry to the LSB of 0011.
0011+1=0100

Case 2: Adding a positive value with a negative value in case the negative number has a higher magnitude.

Initially, calculate the 1's complement of the negative value. Sum it with a positive number. In this case, we did not
get the end-around carry. So, take the 1's complement of the result to get the final result.

Note: The resultant is a negative value.

Example: 1101 and -1110

1. First find the 1's complement of the negative number 1110. So, for finding 1's complement, we change all 0
to 1, and all 1 to 0. 1's complement of the number 1110 is 0001.

2. Now, add both the numbers, i.e., 1101 and 0001;


1101+0001= 1110

3. Now, find the 1's complement of the result 1110 that is the final result. So, the 1's complement of the result
1110 is 0001, and we add a negative sign before the number so that we can identify that it is a negative
number.

Case 3: Addition of two negative numbers

In this case, first find the 1's complement of both the negative numbers, and then we add both these complement
numbers. In this case, we always get the end-around carry, which get added to the LSB, and for getting the final
result, we take the 1's complement of the result.

Note: The resultant is a negative value.

Example: -1101 and -1110 in five-bit register


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

1. Firstly find the 1's complement of the negative numbers 01101 and 01110. So, for finding 1's complement,
we change all 0 to 1, and all 1 to 0. 1's complement of the number 01110 is 10001, and 01101 is 10010.

2. Now, we add both the complement numbers, i.e., 10001 and 10010;
10001+10010= 1 00011

3. By adding both numbers, we get the end-around carry 1. We add this end-around carry to the LSB of
00011.
00011+1=00100

4. Now, find the 1's complement of the result 00100 that is the final answer. So, the 1's complement of the
result 00100 is 110111, and add a negative sign before the number so that we can identify that it is a
negative number.

Subtraction using 1's complement


These are the following steps to subtract two binary numbers using 1's complement

o In the first step, find the 1's complement of the subtrahend.

o Next, add the complement number with the minuend.

o If got a carry, add the carry to its LSB. Else take 1's complement of the result which will be negative

Note: The subtrahend value always get subtracted from minuend.

Example 1: 10101 - 00111

We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So,

10101+11000 =1 01101.

In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e., 01101+1=01110, which is the
answer.

Example 2: 10101 - 10111

We take 1's complement of subtrahend 10111, which comes out 01000. Now, add both of the numbers. So,

10101+01000 =11101.

In the above result, we didn't get the carry bit. So calculate the 1's complement of the result, i.e., 00010, which is the
negative number and the final answer.

Addition and Subtraction using 2's complement


In our previous section, we learned how we could perform arithmetic operations such as addition and subtraction
using 1's complement. In this section, we will learn to perform these operations using 2's complement.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Addition using 2's complement

There are three different cases possible when we add two binary numbers using 2's complement, which is as
follows:

Case 1: Addition of the positive number with a negative number when the positive number has a greater
magnitude.

Initially find the 2's complement of the given negative number. Sum up with the given positive number. If we get the
end-around carry 1 then the number will be a positive number and the carry bit will be discarded and remaining bits
are the final result.

Example: 1101 and -1001

1. First, find the 2's complement of the negative number 1001. So, for finding 2's complement, change all 0 to
1 and all 1 to 0 or find the 1's complement of the number 1001. The 1's complement of the number 1001 is
0110, and add 1 to the LSB of the result 0110. So the 2's complement of number 1001 is 0110+1=0111

2. Add both the numbers, i.e., 1101 and 0111;


1101+0111=1 0100

3. By adding both numbers, we get the end-around carry 1. We discard the end-around carry. So, the addition
of both numbers is 0100.

Case 2: Adding of the positive value with a negative value when the negative number has a higher magnitude.

Initially, add a positive value with the 2's complement value of the negative number. Here, no end-around carry is
found. So, we take the 2's complement of the result to get the final result.

Note: The resultant is a negative value.

Example: 1101 and -1110

1. First, find the 2's complement of the negative number 1110. So, for finding 2's complement, add 1 to the
LSB of its 1's complement value 0001.
0001+1=0010

2. Add both the numbers, i.e., 1101 and 0010;


1101+0010= 1111

3. Find the 2's complement of the result 1110 that is the final result. So, the 2's complement of the result 1110
is 0001, and add a negative sign before the number so that we can identify that it is a negative number.

Case 3: Addition of two negative numbers

In this case, first, find the 2's complement of both the negative numbers, and then we will add both these
complement numbers. In this case, we will always get the end-around carry, which will be added to the LSB, and
forgetting the final result, we will take the2's complement of the result.

Note: The resultant is a negative value.


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Example: -1101 and -1110 in five-bit register

1. Firstly find the 2's complement of the negative numbers 01101 and 01110. So, for finding 2's complement,
we add 1 to the LSB of the 1's complement of these numbers. 2's complement of the number 01110 is
10010, and 01101 is 10011.

2. We add both the complement numbers, i.e., 10001 and 10010;


10010+10011= 1 00101

3. By adding both numbers, we get the end-around carry 1. This carry is discarded and the final result is the
2.s complement of the result 00101. So, the 2's complement of the result 00101 is 11011, and we add a
negative sign before the number so that we can identify that it is a negative number.

Subtraction using 2's complement

These are the following steps to subtract two binary numbers using 2's complement

o In the first step, find the 2's complement of the subtrahend.

o Add the complement number with the minuend.

o If we get the carry by adding both the numbers, then we discard this carry and the result is positive else
take 2's complement of the result which will be negative.

Example 1: 10101 - 00111

We take 2's complement of subtrahend 00111, which is 11001. Now, sum them. So,

10101+11001 =1 01110.

In the above result, we get the carry bit 1. So we discard this carry bit and remaining is the final result and a positive
number.

Example 2: 10101 - 10111

We take 2's complement of subtrahend 10111, which comes out 01001. Now, we add both of the numbers. So,

10101+01001 =11110.

In the above result, we didn't get the carry bit. So calculate the 2's complement of the result, i.e., 00010. It is the
negative number and the final answer.

Gray Code
The Gray Code is a sequence of binary number systems, which is also known as reflected binary code. The reason
for calling this code as reflected binary code is the first N/2 values compared with those of the last N/2 values in
reverse order. In this code, two consecutive values are differed by one bit of binary digits. Gray codes are used in the
general sequence of hardware-generated binary numbers. These numbers cause ambiguities or errors when the
transition from one number to its successive is done. This code simply solves this problem by changing only one bit
when the transition is between numbers is done.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

The gray code is a very light weighted code because it doesn't depend on the value of the digit specified by the
position. This code is also called a cyclic variable code as the transition of one value to its successive value carries a
change of one bit only.

How to generate Gray code?

The prefix and reflect method are recursively used to generate the Gray code of a number. For generating gray code:

1. We find the number of bits required to represent a number.

2. Next, we find the code for 0, i.e., 0000, which is the same as binary.

3. Now, we take the previous code, i.e., 0000, and change the most significant bit of it.

4. We perform this process reclusively until all the codes are not uniquely identified.

5. If by changing the most significant bit, we find the same code obtained previously, then the second most
significant bit will be changed, and so on.

Gray Code Table


Decimal Number Binary Number Gray Code

0 0000 0000

1 0001 0001

2 0010 0011

3 0011 0010

4 0100 0110

5 0101 0111

6 0110 0101

7 0111 0100

8 1000 1100

9 1001 1101

10 1010 1111

11 1011 1110
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

12 1100 1010

13 1101 1011

14 1110 1001

15 1111 1000

Excess-3 Code
The excess-3 code is also treated as XS-3 code. The excess-3 code is a non-weighted and self-complementary BCD
code used to represent the decimal numbers. This code has a biased representation. This code plays an important
role in arithmetic operations because it resolves deficiencies encountered when we use the 8421 BCD code for
adding two decimal digits whose sum is greater than 9. The Excess-3 code uses a special type of algorithm, which
differs from the binary positional number system or normal non-biased BCD.

We can easily get an excess-3 code of a decimal number by simply adding 3 to each decimal digit. And then we
write the 4-bit binary number for each digit of the decimal number. We can find the excess-3 code of the given
binary number by using the following steps:

1. We find the decimal number of the given binary number.

2. Then we add 3 in each digit of the decimal number.

3. Now, we find the binary code of each digit of the newly generated decimal number.

We can also add 0011 in each 4-bit BCD code of the decimal number for getting excess-3 code.

The Excess-3 code for the decimal number is as follows:

Decimal Digit BCD Code Excess-3 Code

0 0000 0011

1 0001 0100

2 0010 0101

3 0011 0110

4 0100 0111

5 0101 1000
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

6 0110 1001

7 0111 1010

8 1000 1011

9 1001 1100

In excess-3 code, the codes 1111 and 0000 are never used for any decimal digit. Let's take some examples of
Excess-3 code.

Example 1: Decimal number 31

1. We find the BCD code of each digit of the decimal number.

Digit BCD

3 0011

1 0001

2) Then, we add 0011 in both of the BCD code.

Decimal BCD Excess-3

3 0011+0011 0110

1 0001+0011 0100

3. So, the excess-3 code of the decimal number 31 is 0110 0100

Example 2: Decimal number 81.61

1. We find the BCD code of each digit of the decimal number.

Digit BCD

8 1000

1 0001

6 0110
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

1 0001

2) Then, we add 0011 in both of the BCD code.

Decimal BCD Excess-3

8 1000+0011 1011

1 0001+0011 0100

6 0110+0011 1001

3) So, the excess-3 code of the decimal number 81.61 is 1011 0100.1001 0100

Self-complementary property
A self-complementary binary code is a code which is always complimented in itself. By replacing the bit 0 to 1 and
1 to 0 of a number, we find the 1's complement of the number. The sum of the 1'st complement and the binary
number of a decimal is equal to the binary number of decimal 9.

Note: if we perform the 1's complement of excess-3 of a decimal number, it will be equal to the excess-3
code of the 9's complement of that decimal number.

For example: If we perform 1's complement of the excess-3 code 1000(decimal 5), complement value will be 0111,
which is the excess-3 code of 9's complement of 5, i.e., 4(0111).

Why use Excess-3 code?

There are the following advantages of excess-3 code which make it required to use:

1. These codes are self-complementary.

2. These codes use biased representation.

3. The excess-3 code has no limitation, so that it considerably simplifies arithmetic operations.

4. The codes 0000 and 1111 can cause a fault in the transmission line. The excess-3 code doesn't use these
codes and gives an advantage for memory organization.

5. These codes are usually unweighted binary decimal codes.

6. This code has a vital role in arithmetic operations. It is because it resolves deficiencies which are
encountered when we use the 8421 BCD code for adding two decimal digits whose sum is greater than 9.

Error Detection and Correction Code

Error detection and correction code plays an important role in the transmission of data from one source to another.
The noise also gets added into the data when it transmits from one system to another, which causes errors in the
received binary data at other systems. The bits of the data may change(either 0 to 1 or 1 to 0) during transmission.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

It is impossible to avoid the interference of noise, but it is possible to get back the original data. For this purpose, we
first need to detect either an error z is present or not using error detection codes. If the error is present in the code,
then we will correct it with the help of error correction codes.

Error detection code


The error detection codes are the code used for detecting the error in the received data bitstream. In these
codes, some bits are included appended to the original bitstream.

Error detecting codes encode the message before sending it over the noisy channels. The encoding scheme is
performed in such a way that the decoder at the receiving can find the errors easily in the receiving data with a
higher chance of success.

Parity Code

In parity code, we add one parity bit either to the right of the LSB or left to the MSB to the original bitstream. On
the basis of the type of parity being chosen, two types of parity codes are possible, i.e., even parity code and odd
parity code.

Features of Error detection codes

These are the following features of error detection codes:

o These codes are used when we use message backward error correction techniques for reliable data
transmission. A feedback message is sent by the receiver to inform the sender whether the message is
received without any error or not at the receiver side. If the message contains errors, the sender retransmits
the message.

o In error detection codes, in fixed-size blocks of bits, the message is contained. In this, the redundant bits are
added for correcting and detecting errors.

o These codes involve checking of the error. No matter how many error bits are there and the type of error.

o Parity check, Checksum, and CRC are the error detection technique.

Error correction code

Error correction codes are generated by using the specific algorithm used for removing and detecting errors from the
message transmitted over the noisy channels. The error-correcting codes find the correct number of corrupted bits
and their positions in the message. There are two types of ECCs(Error Correction Codes), which are as follows.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Block codes

In block codes, in fixed-size blocks of bits, the message is contained. In this, the redundant bits are added for
correcting and detecting errors.

Convolutional codes

The message consists of data streams of random length, and parity symbols are generated by the sliding application
of the Boolean function to the data stream.

The hamming code technique is used for error correction.

Hamming Code

Hamming code is an example of a block code. The two simultaneous bit errors are detected, and single-bit errors are
corrected by this code. In the hamming coding mechanism, the sender encodes the message by adding the
unessential bits in the data. These bits are added to the specific position in the message because they are the extra
bits for correction.

ASCII Code
The ASCII stands for American Standard Code for Information Interchange. The ASCII code is an alphanumeric
code used for data communication in digital computers. The ASCII is a 7-bit code capable of representing 27 or 128
number of different characters. The ASCII code is made up of a three-bit group, which is followed by a four-bit
code.

o The ASCII Code is a 7 or 8-bit alphanumeric code.

o This code can represent 127 unique characters.

o The ASCII code starts from 00h to 7Fh. In this, the code from 00h to 1Fh is used for control characters, and
the code from 20h to 7Fh is used for graphic symbols.

o The 8-bit code holds ASCII, which supports 256 symbols where math and graphic symbols are added.

o The range of the extended ASCII is 80h to FFh.

The ASCII characters are classified into the following groups:

Control Characters

The non-printable characters used for sending commands to the PC or printer are known as control characters. We
can set tabs, and line breaks functionality by this code. The control characters are based on telex technology.
Nowadays, it's not so much popular in use. The character from 0 to 31 and 127 comes under control characters.

Special Characters

All printable characters that are neither numbers nor letters come under the special characters. These characters
contain technical, punctuation, and mathematical characters with space also. The character from 32 to 47, 58 to 64,
91 to 96, and 123 to 126 comes under this category.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Numbers Characters

This category of ASCII code contains ten Arabic numerals from 0 to 9.

Letters Characters

In this category, two groups of letters are contained, i.e., the group of uppercase letters and the group of lowercase
letters. The range from 65 to 90 and 97 to 122 comes under this category.

ASCII Table
The values are typically represented in ASCII code tables in decimal, binary, and hexadecimal form.

Binary Hexadecimal Decimal ASCII Description Group


Symbol

0000000 0 0 NUL The null character Control


encourage the device to Character
do nothing

0000001 1 1 SOH The symbol SOH(Starts Control


of heading) Initiates the Character
header.

0000010 2 2 STX The symbol STX(Start of Control


Text) ends the header and Character
marks the beginning of a
message.

0000011 3 3 ETX The symbol ETX(End of Control


Text) indicates the end of Character
the message.

0000100 4 4 EOT The EOT(end of text) Control


symbol marks the end of a Character
completes transmission

0000101 5 5 ENQ The ENQ(Enquiry) Control


symbol is a request that Character
requires a response

0000110 6 6 ACK The ACK(Acknowledge) Control


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

symbol is a positive Character


answer to the request.

0000111 7 7 BEL The BEL(Bell) symbol Control


triggers a beep. Character

0001000 8 8 BS Lets the cursor move back Control


one step (Backspace) Character

0001001 9 9 TAB (HT) A horizontal tab that Control


moves the cursor within a Character
row to the next predefined
position (Horizontal Tab)

0001010 A 10 LF Causes the cursor to jump Control


to the next line (Line Character
Feed)

0001011 B 11 VT The vertical tab lets the Control


cursor jump to a Character
predefined line (Vertical
Tab)

0001100 C 12 FF Requests a page break Control


(Form Feed) Character

0001101 D 13 CR Moves the cursor back to Control


the first position of the Character
line (Carriage Return)

0001110 E 14 SO Switches to a special Control


presentation (Shift Out) Character

0001111 F 15 SI Switches the display back Control


to the normal state (Shift Character
In)

0010000 10 16 DLE Changes the meaning of Control


the following characters Character
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

(Data Link Escape)

0010001 11 17 DC1 Control characters Control


assigned depending on the Character
device used (Device
Control)

0010010 12 18 DC2 Control characters Control


assigned depending on the Character
device used (Device
Control)

0010011 13 19 DC3 Control characters Control


assigned depending on the Character
device used (Device
Control)

0010100 14 20 DC4 Control characters Control


assigned depending on the Character
device used (Device
Control)

0010101 15 21 NAK The negative response to a Control


request (Negative Character
Acknowledge)

0010110 16 22 SYN Synchronizes a data Control


transfer, even if no signals Character
are transmitted
(Synchronous Idle)

0010111 17 23 ETB Marks the end of a Control


transmission block (End Character
of Transmission Block)

0011000 18 24 CAN Makes it clear that Control


transmission was faulty Character
and the data must be
discarded (Cancel)
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

0011001 19 25 EM Indicates the end of the Control


storage medium (End of Character
Medium)

0011010 1A 26 SUB Replacement for a faulty Control


sign (Substitute) Character

0011011 1B 27 ESC Initiates an escape Control


sequence and thus gives Character
the following characters a
special meaning (Escape)

0011100 1C 28 FS File separator. Control


Character

0011101 1D 29 GS Group separator. Control


Character

0011110 1E 30 RS Record separator. Control


Character

0011111 1F 31 US Unit separator. Control


Character

0100000 20 32 SP Blank space Special


Character

0100001 21 33 ! Exclamation mark Special


Character

0100010 22 34 Only quotes above Special


Character

0100011 23 35 # Pound sign Special


Character

0100100 24 36 $ Dollar sign Special


Character

0100101 25 37 % Percentage sign Special


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Character

0100110 26 38 & Commercial and Special


Character

0100111 27 39 Apostrophe Special


Character

0101000 28 40 ( Left bracket Special


Character

0101001 29 41 ) Right bracket Special


Character

0101010 2A 42 * Asterisk Special


Character

0101011 2B 43 + Plus symbol Special


Character

0101100 2C 44 , Comma Special


Character

0101101 2D 45 - Dash Special


Character

0101110 2E 46 . Full stop Special


Character

0101111 2F 47 / Forward slash Special


Character

0110000 30 48 0 Numbers

0110001 31 49 1 Numbers

0110010 32 50 2 Numbers

0110011 33 51 3 Numbers

0110100 34 52 4 Numbers
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

0110101 35 53 5 Numbers

0110110 36 54 6 Numbers

0110111 37 55 7 Numbers

0111000 38 56 8 Numbers

0111001 39 57 9 Numbers

0111010 3A 58 : Colon Special


characters

0111011 3B 59 ; Semicolon Special


characters

0111100 3C 60 < Small than bracket Special


characters

0111101 3D 61 = Equals sign Special


characters

0111110 3E 62 > Bigger than symbol Special


characters

0111111 3F 63 ? Question mark Special


characters

1000000 40 64 @ At symbol Special


characters

1000001 41 65 A Capital
letters

1000010 42 66 B Capital
letters

1000011 43 67 C Capital
letters

1000100 44 68 D Capital
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

letters

1000101 45 69 E Capital
letters

1000110 46 70 F Capital
letters

1000111 47 71 G Capital
letters

1001000 48 72 H Capital
letters

1001001 49 73 I Capital
letters

1001010 4A 74 J Capital
letters

1001011 4B 75 K Capital
letters

1001100 4C 76 L Capital
letters

1001101 4D 77 M Capital
letters

1001110 4E 78 N Capital
letters

1001111 4F 79 O Capital
letters

1010000 50 80 P Capital
letters

1010001 51 81 Q Capital
letters
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

1010010 52 82 R Capital
letters

1010011 53 83 S Capital
letters

1010100 54 84 T Capital
letters

1010101 55 85 U Capital
letters

1010110 56 86 V Capital
letters

1010111 57 87 W Capital
letters

1011000 58 88 X Capital
letters

1011001 59 89 Y Capital
letters

1011010 5A 90 Z Capital
letters

1011011 5B 91 [ Left square bracket Special


character

1011100 5C 92 \ Inverse/backward slash Special


character

1011101 5D 93 ] Right square bracket Special


character

1011110 5E 94 ^ Circumflex Special


character

1011111 5F 95 _ Underscore Special


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

character

1100000 60 96 ` Gravis (backtick) Special


character

1100001 61 97 A Lowercase
letters

1100010 62 98 B Lowercase
letters

1100011 63 99 C Lowercase
letters

1100100 64 100 D Lowercase


letters

1100101 65 101 E Lowercase


letters

1100110 66 102 F Lowercase


letters

1100111 67 103 G Lowercase


letters

1101000 68 104 H Lowercase


letters

1101001 69 105 I Lowercase


letters

1101010 6A 106 J Lowercase


letters

1101011 6B 107 K Lowercase


letters

1101100 6C 108 L Lowercase


letters
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

1101101 6D 109 M Lowercase


letters

1101110 6E 110 N Lowercase


letters

1101111 6F 111 O Lowercase


letters

1110000 70 112 P Lowercase


letters

1110001 71 113 Q Lowercase


letters

1110010 72 114 R Lowercase


letters

1110011 73 115 S Lowercase


letters

1110100 74 116 T Lowercase


letters

1110101 75 117 U Lowercase


letters

1110110 76 118 v Lowercase


letters

1110111 77 119 w Lowercase


letters

1111000 78 120 x Lowercase


letters

1111001 79 121 y Lowercase


letters

1111010 7A 122 z Lowercase


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

letters

1111011 7B 123 { Left curly bracket Special


characters

1111100 7C 124 l Vertical line Special


characters

1111101 7D 125 } Right curly brackets Special


characters

1111110 7E 126 ~ Tilde Special


characters

1111111 7F 127 DEL The DEL(Delete) symbol Control


deletes a character. This is characters
a control character that
consists of the same
number in all positions.

Example 1: (10010101100001111011011000011010100111000011011111101001
110111011101001000000011000101100100110011)2

Step 1: In the first step, we we make the groups of 7-bits because the ASCII code is 7 bit.

1001010 1100001 1110110 1100001 1010100 1110000 1101111 1101001 1101110 1110100 1000000 0110001 0110010
0110011

Step 2: Then, we find the equivalent decimal number of the binary digits either from the ASCII table or 64 32 16 8
4 2 1 scheme.

Binary Decimal

64 32 16 8 4 2 1 64+8+2=74
1 0 0 1010

64 32 16 8 4 2 1 64+32+1=94
1 1 0 0001

64 32 16 8 4 2 1 64+32+16+4+2=118
1 1 1 0110
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

64 32 16 8 4 2 1 64+32+1=97
1 1 0 0001

64 32 16 8 4 2 1 64+16+4=84
1 0 1 0100

64 32 16 8 4 2 1 64+32+16=112
1 1 1 0000

64 32 16 8 4 2 1 64+32+8+4+2+1=111
1 1 0 1111

64 32 16 8 4 2 1 64+32+8+1=105
1 1 0 1001

64 32 16 8 4 2 1 64+32+8+4+2=110
1 1 0 1110

64 32 16 8 4 2 1 64+32+16+4=116
1 1 1 0100

64 32 16 8 4 2 1 64
1 0 0 0000

64 32 16 8 4 2 1 32+16+1=49
0 1 1 0001

64 32 16 8 4 2 1 32+16+2=50
0 1 1 0010

64 32 16 8 4 2 1 32+16+2+1=51
0 1 1 0011

Step 3: Last, we find the equivalent symbol of the decimal number from the ASCII table.

Decimal Symbol

74 J

94 a
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

118 v

97 a

84 T

112 p

111 o

105 i

110 n

116 t

64 @

49 1

50 2

51 3

Logic Gates
Logic gates play an important role in circuit design and digital systems. It is a building block of a digital system and
an electronic circuit that always have only one output. These gates can have one input or more than one input, but
most of the gates have two inputs. On the basis of the relationship between the input and the output, these gates are
named as AND gate, OR gate, NOT gate, etc.

There are different types of gates which are as follows:

AND Gate

This gate works in the same way as the logical operator "and". The AND gate is a circuit that performs the AND
operation of the inputs. This gate has a minimum of 2 input values and an output value.

Y=A AND B AND C AND D……N


Y=A.B.C.D……N
Y=ABCD……N
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Logic Design

Truth Table

OR Gate
This gate works in the same way as the logical operator "or". The OR gate is a circuit which performs the OR
operation of the inputs. This gate also has a minimum of 2 input values and an output value.

Y=A OR B OR C OR D……N
Y=A+B+C+D……N

Logic Design

Truth Table
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

NOT Gate

The NOT gate is also called an inverter. This gate gives the inverse value of the input value as a result. This gate has
only one input and one output value.

Y=NOT A
Y=A'

Logic Design

Truth Table

NAND Gate

The NAND gate is the combination of AND gate and NOT gate. This gate gives the same result as a NOT-AND
operation. This gate can have two or more than two input values and only one output value.

Y=A NOT AND B NOT AND C NOT AND D……N


Y=A NAND B NAND C NAND D……N

Logic Design
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Truth Table

NOR Gate

The NOR gate is the combination of an OR gate and NOT gate. This gate gives the same result as the NOT-OR
operation. This gate can have two or more than two input values and only one output value.

Y=A NOT OR B NOT OR C NOT OR D……N


Y=A NOR B NOR C NOR D……N

Logic Design

Truth Table

XOR Gate

The XOR gate is also known as the Ex-OR gate. The XOR gate is used in half and full adder and subtractor. The
exclusive-OR gate is sometimes called as EX-OR and X-OR gate. This gate can have two or more than two input
values and only one output value.

Y=A XOR B XOR C XOR D……N


Y=A⨁B⨁C⨁D……N
Y=AB'+A'B
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Logic Design

Truth Table

XNOR Gate

The XNOR gate is also known as the Ex-NOR gate. The XNOR gate is used in half and full adder and subtractor.
The exclusive-NOR gate is sometimes called as EX-NOR and X-NOR gate. This gate can have two or more than
two input values and only one output value.

Y=A XNOR B XNOR C XNOR D……N


Y=A⊖B⊖C⊖D……N
Y=A'B'+AB

Logic Design

Truth Table
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Binary Codes
In the coding, when numbers or letters are represented by a specific group of symbols, it is said to be that number
or letter is being encoded. The group of symbols is called as code. The digital data is represented, stored and
transmitted as group of bits. This group of bits is also called as binary code.
Binary codes can be classified into two types.

 Weighted codes
 Unweighted codes
If the code has positional weights, then it is said to be weighted code. Otherwise, it is an unweighted code.
Weighted codes can be further classified as positively weighted codes and negatively weighted codes.

Binary Codes for Decimal digits

The following table shows the various binary codes for decimal digits 0 to 9.

Decimal Digit 8421 Code 2421 Code 84-2-1 Code Excess 3 Code

0 0000 0000 0000 0011

1 0001 0001 0111 0100

2 0010 0010 0110 0101

3 0011 0011 0101 0110

4 0100 0100 0100 0111

5 0101 1011 1011 1000

6 0110 1100 1010 1001

7 0111 1101 1001 1010

8 1000 1110 1000 1011

9 1001 1111 1111 1100


United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

We have 10 digits in decimal number system. To represent these 10 digits in binary, we require minimum of 4 bits.
But, with 4 bits there will be 16 unique combinations of zeros and ones. Since, we have only 10 decimal digits, the
other 6 combinations of zeros and ones are not required.

8 4 2 1 code

 The weights of this code are 8, 4, 2 and 1.


 This code has all positive weights. So, it is a positively weighted code.
 This code is also called as natural BCD BinaryCodedDecimalBinaryCodedDecimal code.
Example
Let us find the BCD equivalent of the decimal number 786. This number has 3 decimal digits 7, 8 and 6. From the
table, we can write the BCD 84218421 codes of 7, 8 and 6 are 0111, 1000 and 0110 respectively.
∴ 78678610 = 011110000110011110000110BCD
There are 12 bits in BCD representation, since each BCD code of decimal digit has 4 bits.

2 4 2 1 code

 The weights of this code are 2, 4, 2 and 1.


 This code has all positive weights. So, it is a positively weighted code.
 It is an unnatural BCD code. Sum of weights of unnatural BCD codes is equal to 9.
 It is a self-complementing code. Self-complementing codes provide the 9’s complement of a decimal
number, just by interchanging 1’s and 0’s in its equivalent 2421 representation.
Example
Let us find the 2421 equivalent of the decimal number 786. This number has 3 decimal digits 7, 8 and 6. From the
table, we can write the 2421 codes of 7, 8 and 6 are 1101, 1110 and 1100 respectively.
Therefore, the 2421 equivalent of the decimal number 786 is 110111101100.

8 4 -2 -1 code

 The weights of this code are 8, 4, -2 and -1.


 This code has negative weights along with positive weights. So, it is a negatively weighted code.
 It is an unnatural BCD code.
 It is a self-complementing code.
Example
Let us find the 8 4-2-1 equivalent of the decimal number 786. This number has 3 decimal digits 7, 8 and 6. From
the table, we can write the 8 4 -2 -1 codes of 7, 8 and 6 are 1001, 1000 and 1010 respectively.
Therefore, the 8 4 -2 -1 equivalent of the decimal number 786 is 100110001010.

Excess 3 code

 This code doesn’t have any weights. So, it is an un-weighted code.


 We will get the Excess 3 code of a decimal number by adding three 00110011 to the binary equivalent of
that decimal number. Hence, it is called as Excess 3 code.
 It is a self-complementing code.
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

Example
Let us find the Excess 3 equivalent of the decimal number 786. This number has 3 decimal digits 7, 8 and 6. From
the table, we can write the Excess 3 codes of 7, 8 and 6 are 1010, 1011 and 1001 respectively.
Therefore, the Excess 3 equivalent of the decimal number 786 is 101010111001

Gray Code

The following table shows the 4-bit Gray codes corresponding to each 4-bit binary code.

Decimal Number Binary Code Gray Code

0 0000 0000

1 0001 0001

2 0010 0011

3 0011 0010

4 0100 0110

5 0101 0111

6 0110 0101

7 0111 0100

8 1000 1100

9 1001 1101

10 1010 1111

11 1011 1110
United College Of Engineering & Research, Naini, Payagraj
Department Of Electronics & Communication Engineering
Digital Electronics (KEE- 401)
Unit-1

12 1100 1010

13 1101 1011

14 1110 1001

15 1111 1000

 This code doesn’t have any weights. So, it is an un-weighted code.


 In the above table, the successive Gray codes are differed in one bit position only. Hence, this code is
called as unit distance code.

Binary code to Gray Code Conversion

Follow these steps for converting a binary code into its equivalent Gray code.
 Consider the given binary code and place a zero to the left of MSB.
 Compare the successive two bits starting from zero. If the 2 bits are same, then the output is zero.
Otherwise, output is one.
 Repeat the above step till the LSB of Gray code is obtained.
Example
From the table, we know that the Gray code corresponding to binary code 1000 is 1100. Now, let us verify it by
using the above procedure.
Given, binary code is 1000.
Step 1 − By placing zero to the left of MSB, the binary code will be 01000.
Step 2 − By comparing successive two bits of new binary code, we will get the gray code as 1100.

You might also like