0% found this document useful (0 votes)
54 views187 pages

Bee Unit 3 Cse Gates, Boolean, Codes

Uploaded by

shaiksameer24303
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)
54 views187 pages

Bee Unit 3 Cse Gates, Boolean, Codes

Uploaded by

shaiksameer24303
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/ 187

BEE-PART-B

Basic Electronics Engineering


UNIT-III:DIGITAL ELECTRONICS

• Number Systems:- Binary , decimal and their conversion.


• Logic gates including Universal Gates,
• BCD codes, Excess-3 code, Gray code, Hamming code.
• Boolean Algebra, Basic Theorems and properties of Boolean
Algebra,
• Truth Tables and Functionality of Logic Gates – NOT, OR, AND,
NOR, NAND, XOR and XNOR Integrated Circuits (ICs).
• Simple combinational circuits–Half and Full Adders.
• Introduction to sequential circuits, Flip flops, Registers and
counters.
DIGITAL
What is digital ?
Digital means digits in a Number
Ex : 543
In 543 Number , 3 is first digit, 4 is second digit,
5 is third digit
Number System
• In digital electronics Number System is used to
represent the information.

• Number Systems are used to represent magnitudes of


any quantity
Examples that will show about the importance of Numbers
in our day to day life

How many subjects you are having in first year first


semester :
What is your Intermediate marks percentage :
How many best friends you are having :
Your body temperature at different times:
Your Blood pressure (BP):
Weight of cricket ball:
Distance between wickets in cricket match:
Based on the position of digits Number systems are
divided as

1) Non Positional Number system


Example : Roman numbers I II III IV V VI VII
VIII IX X

2) Positional Number system


Examples 23 456 1728
Number Systems
what is number system in digital electronics: In digital electronics, the number
system is used for representing the information.
• The number system has different bases and the most common of them are the
decimal, binary, octal, and hexadecimal.
• The base or radix of the number system is the total number of the digit used
in the number system.

• Positive radix, positional number systems


• A number with radix (base) r (or b) is represented
by a string of digits (n in integer and m in fraction):
A n - 1 A n - 2 … A1 A 0 . A- 1 A- 2 … A- m

where “.” is the radix point.


Integer Part Fraction Part
Number Systems Used in Computers
Name
Radix Set of Digits Example
of Radix

Decimal r=10 {0,1,2,3,4,5,6,7,8,9} 25510

Binary r=2 {0,1} 111111112

Octal r= 8 {0,1,2,3,4,5,6,7} 3778

Hexadecimal r=16 {0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F} FF16


Quantities/Counting (1 of 2)
Hexa-
Decimal Binary Octal decimal

0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
Quantities/Counting (2 of 2)
Hexa-
Decimal Binary Octal decimal

8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
Positive Powers of 2
• Powers of 2
Exponent Value Exponent Value
0 1 11 2,048 2 K
1 2 12 4,096 4 K
2 4 13 8,192 8 K
3 8 14 16,384 16 K
4 16 15 32,768 = 215 = 25 x 210 = 32 K
5 32 16 65,536 64 K
6 64 17 131,072 128 K
7 128 18 262,144 256 K
8 256 19 524,288 512 K
9 512 20 1,048,576 1 M
10 1024 1 K 21 2,097,152 2 M
Binary Numbers:
Special Powers of 2

210 (1024) is Kilo, denoted "K"


220 (1,048,576) is Mega, denoted "M"
230 (1,073, 741,824) is Giga, denoted "G"
240 (1,099,511,628) is Tera, denoted “T"
Types of Number Systems

Number Systems are divided as


1)Decimal Number System
2) Binary Number System
3) Octal Number System
4) Hexa-decimal Number System
Decimal Number system
Decimal number system has a Base (or) Radix of 10. Hence Decimal number
system consists of ten symbols (or) digits (0,1,2,3,4,5,6,7,8,9).
Any number is from the combination of these ten digits or symbols.

Ex. 927 5943 98000 (927)10 (5943)10

For example 927 is having three digits 9 2 7


7 is called Least Significant digit (Right most digit) (Has low positional value)

9 is called Most Significant digit (Left most digit) (Has high positional value)
927 = 9 x 102 + 2 x 101 + 7 x 100
From right to left positional value increases by 10 times
Decimal Number system

Positional value of 7 in 927 is 1 (100)

Positional value of 2 in 927 is 10 (101)

Positional value of 9 in 927 is 100 (102)


Positional value of the digits are power of 10
Fractional decimal number

Ex: 328.4

328.4 = 3x102 + 2x101 + 8x100 + 4x10-1


= 300 + 20 +8 + (4x0.1)
=328+0.4=328.4
Binary Number system

Base (or) radix =2 Number of digits = 2


0
1
In digital systems input and output values are
represented as either Low or High.
Low voltage represents binary bit 0
High voltage represents binary bit 1
Binary Number system

Binary Number system has a base of 2.


This means this Binary number system has only
two symbols or digits. They are 0 and 1.
All the binary numbers are formed from only
these two digits or symbols.

Ex: 1010 110001 1010101010

A binary digit is known as a bit (Bit 0 or Bit 1)


Example of a Binary
number

1010
This number consists of four bits. Each bit has
positional weightage of power of 2.
Right most binary digit or bit has least weightage
, hence it is called LSB (Least Significant Bit)
Left most binary digit or bit has highest
weightage , hence it is called MSB (Most
Significant Bit)
Binary Number system

(1010)2 = 1x23 + 0x22 + 1x21 + 0x20


= 8+0+2+0= (10)10
Octal Number system

Base (or) radix =8 Number of digits =


8
0
1
2
3 Ex : (56)8
4
5
6
7
Hexadecimal Number
system
Base (or) radix =16 Number of digits
= 16
0 8
1 9
2 A
3 B
4 C Ex :(4F)16
5 D
6 E
7 F
Binary number addition

(0,1) combinations are 0 0


0 1
1 0
1 1

0+0=0
0+1=1
1+0=1
1+1=10 (0 is sum and carry or carry forward is 1)
1+1=0
EXAMPLE

Add 1010 and 0011


1
1 0 1 0
0 0 1 1
1 1 0 1
Binary Subtraction
(0,1) combinations are 0 0
0 1
1 0
1 1

0 - 0= 0
0 - 1= 11 (1 is subtraction and borrow is 1
0 - 1= 1
1 - 0= 1
1 - 1= 0
EXAMPLE

Subtract 101 from 1001


1’s complement of a binary number
2’s complement of a binary number

1’s complement = inverting bits from 1 to 0


and from 0 to 1
1’s complement of 0111 is 1000
2’s complement= 1’s complement +1
2’s complement of 0111 is (1000 +1)=1001
Conversion Among Bases
• The possibilities:

Decimal Octal

Binary Hexadecimal
Conversion of Decimal number to any Radix number.

 Successive division for integer part conversion

 Successive multiplication for fractional part

conversion
1.Decimal to Binary

• Technique
–Divide by two, keep track of the
remainder
–First remainder is bit 0 (LSB, least-
significant bit)
–Second remainder is bit 1
–Etc.
Example
12510 = ?2 2 125
2 62 1
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1
0 1

12510 = 11111012
Example
• Decimal to binary .14579
x 2
3.14579 0.29158
x 2
0.58316
x 2
1.16632
x 2
0.33264
x 2
0.66528
x 2
1.33056
11.001001...
etc.
2.Decimal to Octal

• Technique

–Divide by 8
–Keep track of the remainder
Example

123410 = ?8
8 1234 LSB
154 2
8
19 2
8
8 2 3
0 2
MSB

123410 = 23228
Example

Convert 658.82510 = ?8

658.82510 =1222.6468
3.Decimal to Hexadecimal
• Technique
– Divide by 16
– Keep track of the remainder
Example 123410 = ?16
16 1234
77 2
16
4 13 = D
16
0 4

123410 = 4D216
Example
Convert (8765.025)10 to hexadecimal
1.Binary to Decimal

• Technique
Multiply each bit by 2n, where n is the
“weight” of the bit

The weight is the position of the bit, starting


from 0 on the right
Add the results
Example
Bit “0”

1010112 => 1 x 20 = 1
1 x 21 = 2
0 x 22 = 0
1 x 23 = 8
0 x 24 = 0
1 x 25 = 32
4310
Example
1000102to Base 10
1000102 => 0 x 20 = 0
1 x 21 = 2
0 x 22 = 0
0 x 23 = 0
0 x 24 = 0
1 x 25 = 32
3410
Example
• Binary to decimal

10.1011 => 1 x 2-4 = 0.0625


1 x 2-3 = 0.125
0 x 2-2 = 0.0
1 x 2-1 = 0.5
0 x 20 = 0.0
1 x 21 = 2.0
2.6875
2.Octal to Decimal

• Technique
–Multiply each bit by 8n, where n is the
“weight” of the bit
–The weight is the position of the bit,
starting from 0 on the right
–Add the results
Example

7248 => 4 x 80 = 4
2 x 81 = 16
7 x 82 = 448
46810
Example
4328 To Base 10

2 x 80 = 2
3 x 81 = 24
4 x 82 = 256
28210
3.Hexadecimal to Decimal

• Technique
–Multiply each bit by 16n, where n is
the “weight” of the bit
–The weight is the position of the bit,
starting from 0 on the right
–Add the results
Example

ABC16 => C x 160 =12 x1 = 12


B x 161 =11x16 = 176
A x 162=10x256 = 2560
274810
Example

A5D16 to Base 10

D x 160 =13 x1 = 13
5 x 161 = 5x16 = 80
A x 162=10x256 = 2560
265310
4.Octal to Binary

• Technique

–Convert each octal digit to a 3-bit


equivalent binary representation
Example

7058 = ?2

7 0 5

111 000 101

7058 = 1110001012
Example

2148 = ?2

2 1 4

010 001 100

2148 = 0100011002
5.Hexadecimal to Binary
• Technique

–Convert each hexadecimal digit to a 4-bit


equivalent binary representation
Example

10AF16 = ?2

1 0 A F

0001 0000 1010 1111

10AF16 = 00010000101011112
Example

3A9E.B0D16 = ?2
3 A 9 E . B 0 D

0011 1010 1001 1110 . 1011 0000 1101

3A9E.B0D16 =
0011101010011110.1011000011012
Binary to Octal
• Technique
– Group bits in threes, starting on right
– Convert to octal digits
Example

10110101112 = ?8
1 011 010 111

1 3 2 7

10110101112 = 13278
a) 110101.1010102 = ?8

110101.1010102 =65.528
b) 10101111001.01112 = ?8

10101111001.01112 =2571.348
Binary to Hexadecimal
• Technique
– Group bits in fours, starting on right
– Convert to hexadecimal digits
Example

10101110112 = ?16
10 1011 1011

2 B B

10101110112 = 2BB16
Convert
01011111011.0111112 =?16

01011111011.0111112
=2FB.7C?16
Octal to Hexadecimal
• Technique
– Use binary as an intermediary
Example

10768 = ?16
1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16
756.6038 = ?16

756.6038 =1EE.C1816
Example
10768 = ?16
1 0 7 6

001 000 111 110

2 3 E

10768 = 23E16
Hexadecimal to Octal
• Technique
– Use binary as an intermediary
Example
1F0C16 = ?8

1 F 0 C

0001 1111 0000 1100

1 7 4 1 4

1F0C16 = 174148
Logic Gates
A Logic Gate is an Digital electronic circuit which has one or
more inputs and single output.

Logic Gates are the basic building blocks any digital system

Logic Gates are classified as :


1) Basic Gates (AND, OR and NOT)
 2) Universal Gates (NAND,NOR)
 3) Special Gates (Ex – OR, Ex - NOR)
BASIC GATES

1) AND Gate


2) OR Gate
3) NOT Gate
AND Gate
An AND gate is a digital circuit that has two or more inputs and produces an
output, which is the logical AND of all inputs
.(dot) Symbol
Truth Table

A B Y = A.B
0 0 0
0 1 0
1 0 0
Outputs of AND Gate will be 1 when all the inputs
1 1 1 are 1
OR Gate
An OR gate is a digital circuit that has two or more
inputs and produces an output, which is the logical
OR of all those inputs
+ Symbol
Truth Table

A B Y=A+B
0 0 0
0 1 1
1 0 1
The output of an OR gate will be ‘1’,
1 1 1
when at least one of those inputs is ‘1’.
NOT Gate
An OR gate is a digital circuit that has one input and one output.
The output of NOT Gate is the logical inversion of input.
Hence NOT Gate is called as an Inverter.

A Y = A’
0 1

1 0

NOT Gate produces an output Y ,


which is complement of input A
UNIVERSAL GATES

1) NAND Gate


2) NOR Gate
NAND Gate
NAND gate is a digital circuit that has two
or more inputs and produces an output,
which is the inversion of logical AND of
all inputs.
A B Y = A.B

0 0 1

0 1 1

1 0 1

1 1 0
NOR Gate
NOR gate is a digital circuit that has two or
more inputs and produces an output, which
is the inversion of logical OR of all inputs.

A B Y = A+B

0 0 1

0 1 0

1 0 0

1 1 0
SPECIAL Gates

Ex-OR & Ex-NOR gates are called as special


gates. Because, these two gates are special cases
of OR & NOR gates.

1) Ex – OR
2) Ex – NOR
Ex – OR Gate
The full form of Ex-OR gate is Exclusive-OR gate.

Its function is same as that of OR gate except for


some cases.
Therefore, the output of Ex-OR gate is ‘1’, when only one
of the two inputs is ‘1’. And it is zero, when both inputs
are same.
A B Y=
A⊕B
0 0 0

0 1 1

1 0 1

1 1 0
Ex – NOR
The full form of Ex-NOR gate is Exclusive-NOR gate.

Its function is same as that of NOR gate except for some cases.

the output of Ex-NOR gate is ‘1’, when both inputs are same. And
it is zero, when both the inputs are different.

A B Y = A⊙B

0 0 1

0 1 0

1 0 0

1 1 1
Alternative Gate representation
 Bubbled NOR gate is nothing but AND gate

 Bubbled NAND gate is nothing but OR gate


 Bubbled OR gate is nothing but NAND gate

 Bubbled AND gate is nothing but NOR gate


Universal gates.

NAND and NOR gates are called universal gates


because we can implement or realise any basic
gate using these gates.
NAND Realisation.
NOT
NAND to AND
OR
NOR
Those three properties show that:
●a NAND gate with both of its inputs driven by the same signal is
equivalent to a NOT gate

●a NAND gate whose output is complemented is equivalent to an AND


gate

● a NAND gate with complemented inputs acts as an OR gate

●Hence, we can use a NAND gate to implement all three of


the elementary operators
(AND, OR, NOT)

●Therefore, ANY switching function can be constructed


using only NAND gates. Such a gate is said to be primitive
or functionally complete (Universal Gate)
NOR Realisation.
NOT
NOR to AND
OR
NAND
Binary Arithmetic
 Binary addition

 The four possible elementary operations are

0+0=0
0+1=1
1+0=1
1+1=0 with carry 1.
Binary Arithmetic
 Binary Substraction
 The four possible elementary operations are

0-0=0
0-1=1 with borrow 1.
1-0=1
1-1=0
Binary Arithmetic
 Binary Multiplication
 The four possible elementary operations are

0*0=0
0*1=0
1*0=0
1*1=1
Binary Arithmetic
 Binary Division
 The two possible elementary operations are

0/1=0
1/1=1

Note: In Binary numbers divide by ‘0’ has no meaning.


Complements
In digital computer to simplify the subtraction operation
and for logic manipulation Complements are used.

There are two types of Complements:

1. The Radix Complement (r’ Complement)

2. Diminished radix complement ( (r-1)’ Complement)


Example: For Binary number system (base 2)
we have 2’s complement and 1’s complement
1’s Complement
• 1’s complement of N = (2n -1)-N.
–If n=4 have (2n -1) being 1 0000 - 1 =
1111
• So for n=4 would subtract any 4-bit binary
number from 1111.
• This is just inverting each bit.
• Example: 1’s compliment of 1011001
• is 0100110
2’s complement
• The 2’s complement of N= 2n-N
• Adding 1 to the 1’s complement of a
number.
• For 6 = 0110
–The 1’s complement is 1001
–The 2’s complement is 1010
1’s Complement
The 1’ complement of a binary number is
the number that results when we change all
1’s to zeros and zeros to 1’s.
2’s Complement
The 2’ complement of a binary number is
the number that results when we add 1 to
LSB of its 1’s complement no.
Obtain the 1’s and 2’S complements of the following binary numbers :
(a)11101010
(b)01111110
(c)00000001
(d)10000000

1’s complements:
(a) 00010101 (b)10000001 (c)11111110 (d)01111111

2’s complement :
(a) 00010110 (b)10000010 (c)11111111 (d)10000000
Binary Subtraction using 1’s Complement
Method
In this method Operation A-B is performed using following
Steps.
Take 1’s complement of B.

Result=A+1’s complement of B.

If carry is generated then the result is +ve and add carry
to the result to get the final answer.

If carry is not generated then the result is -ve and for
final result find the 1’s complement of the intermediate
results.
Binary Subtraction using 2’s Complement
Method
In this method Operation A-B is performed using following
Steps.
Take 2’s complement of B.

Result=A+2’s complement of B.

If carry is generated then the result is +ve and add Ignor
the carry.

If carry is not generated then the result is -ve and for
final result find the 2’s complement of the intermediate
results.
Decimal Number System
9’s and 10’s Complements
9’ Complement:
The 9’s complement of the decimal number is obtained by
subtracting each digit of that decimal number from 9.

10’ Complement:
The 10’s complement of the decimal number is obtained by
adding a1 to its9’s complement
9’s Complement of subtraction

Find the 9’s complement of the subtracted number &


add it to the main no.

If carry is present in the intermediate results, it


indicates that the answer is +ve, Add the carry to LSB.

If carry doesn't present, then the answer is –ve . place –ve
sign before the answer and find its 9’complement.
10’s Complement of subtraction

Find the 10’s complement of the subtracted number


& add it to the main no.

If carry is present in the intermediate results, it


indicates that the answer is +ve, and neglect the carry.

If carry doesn't present, then the answer is –ve . place –ve
sign before the answer and find its 10’complement.
Representation of sign numbers using 1’s and 2’s
complement method.

If the number is +ve the magnitude is represent in its


true binary form and a sign bit ‘0’ placed in front of MSB.

If the number is -ve the magnitude is represent in its 1’s


or 2’s complement form and a sign bit ‘1’ placed in front
of MSB.
2.perform the following
i) Subtract by using 10’s compliment
for the given 3456-245
ii) Subtract by using 2’s compliment
for the given 111001-1010
Operation with 2’s complement
• Add 4 and -6
• Will use the 2’s complement of -6 or 1010
– 4 0100
– -6 1010
– 1110
• And taking the 2’s complement of 1110 get
0001 + 1 = 0010

64
Subtraction with Complements
Example
Codes
Codes:

When numbers, alphabets or words are represented by


a Specific group of symbols, We can say they are
Encoded.
The group of symbols used to encode them are called Codes.
Binary Codes:

The digital data is represented, stored and transmitted as a


group of binary digits(bits).The group of bits also known as
binary codes.
BCD code
• In this code each
decimal digit is
represented by a 4-
bit binary number.
• It is very similar to
decimal system.
• We need to
remember binary
equivalent of
decimal numbers 0
to 9 only
Excess-3 Code
The excess-3 code is a non-
weighted code used to express
decimal numbers
Excess-3 codes are obtained by
adding 3 to each decimal digit
then it can be represented by
using 4 bit binary number for
each digit
GRAY code
The Gray code is an ordering of the binary numeral system such
that two successive numbers differ in only one bit.

Gray code is a non-


weighted code and it is a
special case of “Unit
distance code”.

In unit-
distancecode
bit patterns
for two
consecutive numbers
differ is only one bit
position.

These codes are also


called “cyclic codes. And
the gray code is also called
as reflected code.
BCD code

The most commonly used BCD code is 8-4-2-1. Each digit of


the decimal number is represented by group of four bits.
Disadvantage of BCD code:
BCD code having less efficiency than pure binary number
system.

Advantage of BCD code:

The conversion from BCD to decimal is very easy than


compared to other code conversions to decimal.
Binary Coded Decimal
● Binary Coded Decimal (BCD) represents each
decimal digit with four bits
Ex. 0011 0010 1001 = 32910
3 2 9

● This is NOT the same as 0011001010012


● Why do this? Because people think in decimal
BCD BCD
Digit Code Digit Code
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
BCD addition:

The are 3 cases present in the addition of BCD codes.

Case:1 Sum equals “9” or less with carry ”0”.

Case:2 Sum greater than “9” with carry “0”.

Case:3 Sum equals “9” or less with carry ”1”.


Procedure for BCD addition:

 Add two BCD numbers using ordinary binary addition.

If four bit sum is equal to or less than “9”. No correction is


needed. The sum is in proper BCD form.

If four-bit sum is greater than “9” or if a carry is generated


from the four bit sum, the sum is invalid.

To correct the invalid sum, add 6(0110) to the four bit sum.
If a carry results from this addition, add it to the next higher
order BCD digit.
BCD Subtraction using 9’s complement

 Find the 9’s complement of the –ve number.

 Add two numbers using BCD addition.

If carry is not generated the result is –ve and find the 9’
complement of the results, otherwise result is +ve and add
carry to the results.
BCD Subtraction using 10’s complement

 Find the 10’s complement of the –ve number.

 Add two numbers using BCD addition.

If carry is not generated the result is –ve and find the 10’
complement of the results, otherwise result is +ve and ignore
the carry.
Reflective property of 2-4-2-1 code.

Reflective property or self complementing property of 2-4-


2-1 is code for 9 is complement of code 0,code for 8 is
complement of code1 and so on.
Decimal no complement relation decimal no
2421
0 0000
1111 9

1 0001
1110 8

2 0010
1101 7

3 0011
1100 6

4 0100
1011 5
Excess-3 code.

The Excess-3 code can be derived from the natural BCD code
by adding 3(0011) to each coded number.
Decimal Excess-3 code
0 0000+0011 0011 3
1 0001+0011 0100 4
2 0010+0011 0101 5
3 0011+0011 0110 6
4 0100+0011 0111 7
5 0101+0011 1000 8
6 0110+0011 1001 9
7 0111+0011 1010 10
8 1000+0011 1011 11
9 1001+0011 1100 12
Advantage of Excess-3 code.
In Excess-3 code we get 9’s complement of a number by just
complementing each bit.

So Excess-3 code is called Self-complementing code or


reflective code.
Excess-3 Addition
 Add two Excess-3 numbers using binary addition.

 If carry=1 add 3(0011) to the sum of two digits.

 If carry=0 Subtract 3(0011) from the sum.


Excess-3 Subtraction or Ex-3 Subtraction using 9’s
complement
 Complement the subtracted no.

 Add complemented subtracted no to main no.

 If carry=1 Result is +ve. Add 3(0011) and end around carry.

 If carry= 0 Result is –ve subtract 3(0011).


Gray code:
Gray code is a non-weighted code and it is a special case of
“Unit distance code”.
In unit-distance code bit patterns for two consecutive
numbers differ is only one bit position.

These codes are also called “cyclic codes. And the gray code
is also called as reflected code.
1. A 1-bit Gray code has two code words, 0 and 1.
2.The first 2n code words of an (n+1)-bit gray code equal the code words of
an n-bit gray code,written in order with a leading 0 appended.

3.The last 2n code words of an (n+1)-bit Gray code equal the code words of
an n-bit gray code, but written in reverse order with a leading 1 appended.

 Example: For a 2-bit Gray code, n=1.


2-bit Gray code
1-bit Gray code 0 0 00
0 0 1 01
1 1 1 11
1 0 10
Gray Code
 Example: For a 3-bit Gray code, n=2.
3-bit Gray code
2-bit Gray code 0 00 000
0 01 001
00 0 11 011
01 0 10 010
11 1 10 110
10 1 11 111
1 01 101
1 00 100
000 0000---0
Gray code: 001 0001---1
011 0011---2
010 0010---3
0 00 110 0110---4
00 000 111 0111---5
1 01 01 001 101 0101---6
........... ........... 100 0100---7
11 011 ........... ...........
1 11 10 010 100 1100---8
0 10 101 1101---9
........... ........... 111 1111---10
10 110 110 1110---11
010 1010---12
11 111 011 1011---13
01 101 001 1001---14
000 1000---15
00 100
Binary to Gray code conversion:

The MSB of the gray code is the same as the MSB of the
binary code. So write down as it is

To obtain the next gray digit , Perform an Exclusive-


OR(Ex-OR) operation b/w previous and current binary bit .
Write down result.

Repeat Step-2 until all binary bits have been Exclusive-


ORed with their previous bits.
Binary to Gray Code Conversion-2
The Gray to Binary Conversion
• Gray-to-Binary Conversion
– The MSB in the binary code is the same as the
corresponding bit in the Gray code.
– Add each binary code bit generated to the Gray
code bit in the next adjacent position. Discard
carries.
ex: convert the Gray code word 11011 to binary
1 1 0 1 1 Gray
+ + + +
1 0 0 1 0 Binary
Alpha numeric code:

One standard alphanumeric code called the ASCII(American


Standard Code for Information Interchange.)

 It is a 7 bit code. It represents 2 power 7=128 Symbols.


ASCII values for A to Z

A-65 M-77 Y-89


B-66 N-78 Z-90
C-67 O-79
D-68 P-80
E-69 Q-81
F-70 R-82
G-71 S-83
H-72 T-84
I-73 U-85
J-74 V-86
K-75 W-87
L-76 X-88
ASCII values for a to z

a-97 m-109 y-121


b-98 n-110 z-122
c-99 o-111
d-100 p-112
e-101 q-113
f-102 r-114
g-103 s-115
h-104 t-116
i-105 u-117
j-106 v-118
k-107 w-119
l-108 x-120
ASCII values for 0 to 9

0 - 48
1 - 49
2 - 50
3 - 51
4 - 52
5 - 53
6 - 54
7 - 55
8 - 56
9 - 57
Note:

ASCII values for A to Z are 65 to 90

ASCII values for a to z are 97 to 122

ASCII values for 0 to 9 are 48 to 57


Parity bit:

A parity bit is used for the purpose of detecting Error during


the transmission of binary information.

A parity bit is an extra bit included with a binary message to


make no.of 1’s either odd or even number.

The circuit that generates the parity bit in the transmitter is


called a parity generator. And the circuit that checks the
parity in the receiver is called a parity checker.
Error – Detecting codes: When binary data is transmitted & processed, it is
susceptible to noise that can alter or distort its contents.
• The 1‘s may get changed to 0‘s & 1‘s .because digital systems must be accurate to
the digit, error can pose a problem.
• Several schemes have been devised to detect the occurrence of a single bit error
in a binary word, so that whenever such an error occurs the concerned binary
word can be corrected & retransmitted.
Parity: The simplest techniques for detecting errors is that of adding an extra bit
known as parity bit to each word being transmitted.
• Two types of parity: Odd parity, even parity for odd parity, the parity bit is set to a
‗0‘ or a ‗1‘ at the transmitter such that the total no. of 1 bit in the word including
the parity bit is an odd no. For even parity, the parity bit is set to a ‗0‘ or a ‗1‘ at
the transmitter such that the parity bit is an even no.

Decimal 8421 code Odd parity Even parity


0 0000 1 0
1 0001 0 1
2 0010 0 1
3 0011 1 0
4 0100 0 1
5 0100 1 0
6 0110 1 0
7 0111 0 1
8 1000 0 1
9 1001 1 0
When the digit data is received . a parity checking circuit generates an error signal
if the total no of 1‘s is even in an odd parity system or odd in an even parity
system.
This parity check can always detect a single bit error but cannot detect 2 or more
errors with in the same word.
Odd parity is used more often than even parity does not detect the situation.
Where all 0‘s are created by a short ckt or some other fault condition.

Ex: Even parity scheme


(a) 10101010 (b) 11110110 (c)10111001
Ans:
(a) No. of 1‘s in the word is even is 4 so there is no error
(b) No. of 1‘s in the word is even is 6 so there is no error
(c) No. of 1‘s in the word is odd is 5 so there is error

Ex: odd parity


(a)10110111 (b) 10011010 (c)11101010

Ans:
(a) No. of 1‘s in the word is even is 6 so word has error
(b) No. of 1‘s in the word is even is 4 so word has error
(c) No. of 1‘s in the word is odd is 5 so there is no error
Hamming Code

 Hamming code is error detecting and correcting code.

 In Hamming code for parity bit is used for error detecting.


Error –Correcting Codes:

• One type of error correcting code is the Hamming code ,


• In this code , to each group of m information or message or
data bits,
K parity checking bits
denoted by P1,P2,…Pk located at positions 2 k-1 from left are
added to form an (m+k) bit code word.
• To correct the error, k parity checks are performed on
selected digits of each code word,
& the position of the error bit is located by forming an error
word,
& the error bit is then complemented.
• The k bit error word is generated by putting a 0 or a 1 in the 2
k-1th position depending upon whether the check for parity

involving the parity bit Pk is satisfied or not.


• Error positions and their corresponding values :
• D+P+1≤2P
Error Position For 15 bit code For 12 bit code For 7 bit code
C4 C3 C2 C1 C 4 C3 C2 C1 C3 C2 C1

0 0000 0000 000

1 0001 0001 001

2 0010 0010 010

3 0011 0011 011

4 0100 0100 100

5 0101 0101 101

6 0 1 10 0 1 10 1 10

7 0 1 1 1 0 1 1 1 1 1 1

8 1 0 0 0 1 0 0 0

9 1 0 0 1 1 0 0 1

10 1 0 1 0 1 0 1 0

11 1 0 1 1 1 0 1 1

12 1 1 0 0 1 1 0 0

13 1 1 0 1

14 1 1 1 0

15 1 1 1 1
7-bit Hamming code:
To transmit four data bits, 3 parity bits located at positions 20 21 22 from left are
added to make a 7-bit code word which is then transmitted.
The word format

P1 P2 D3 P4 D5 D6 D7
D—Data bits P- Parity bits

Decimal Digit For BCD For Excess-3


P1P2D3P4D5D6D7 P1P2D3P4D5D6D7
0 0 0 0 0 0 0 0 1 0 0 0 0 1
1
1 1 1 0 1 0 0 1 1 0 0 1 1 0
0
2 0 1 0 1 0 1 1 0 1 0 0 1 0
1
3 1 0 0 0 0 1 1 1 1 0 0 1 1
0
4 1 0 0 1 1 0 0 0 0 0 1 1 1
1
5 0 1 0 0 1 0 1 1 1 1 0 0 0
0
6 1 1 0 0 1 1 0 0 0 1 1 0 0
1
7 0 0 0 1 1 1 1 1 0
1 1 0 1 0
8 1 1 1 0 0 0 0 0 1
1 0 0 1 1
9 0 0 1 1 0 0 1 0 1
1 1 1 0 0
Ex: Encode the data bits 1101 into the 7 bit even parity Hamming Code The bit pattern is
P1 P2 D3 P4 D5 D6 D7
1 1 0 1

Bits 1,3,5,7 (P1 111) must have even parity, so P1 =1


Bits 2, 3, 6, 7(P2 101) must have even parity, so P2 =0
Bits 4,5,6,7 (P4 101)must have even parity, so P4 =0
The final code is 1010101
EX: Code word is 1001001

Bits 1,3,5,7 (C1 1001) →no error →put a 0 in the 1‘s position→C1=0
Bits 2, 3, 6, 7(C2 0001)) → error →put a 1 in the 2‘s position→C2=1
Bits 4,5,6,7 (C4 1001)) →no error →put a 0 in the 4‘s position→C3=0

15-bit Hamming Code: It transmit 11 data bits, 4 parity bits located 20 21 22 23


Word format is
P1 P2 D3 P4 D5 D6 D7 P8 D9 D10 D11 D12 D13 D14 D15

12-Bit Hamming Code: It transmit 8 data bits, 4 parity bits located at position 20 21 22 23
Word format is
P1 P2 D3 P4 D5 D6 D7 P8 D9 D10 D11 D12
Axiomatic definition of Boolean
algebra
• Boolean algebra is an algebraic structure defined by a set of
elements, together with two binary operators + and . ,
provided that the following postulates are satisfied.
Boolean laws
Postulate : Closure Property

• Closure(a):
when two binary elements are operated by operator +
the result is a unique binary element
OR operator (plus/Addition)
• Closure(b):
When two binary elements are operated by operator
.(dot),the result is a unique binary element

AND operator (dot/multiplication)


Postulate: Identity or Idempotency Property

• There exists unique elements 1(one) and 0(zero) such that:


(a) x + x = x
x+0=x
(b) x . x= x
x . 1= x
• Where 0 is the identity element for the OR operator and 1 is the
identity element for the AND operator
Postulate : Complementation Property

•For every x in β there exists a unique element x’such that:


x + x’= 1 x . x’= 0
Properties of 0 and 1 Element
Duality Property
• If a Boolean expression is true, the dual of expression also
true.
• To find the dual, follow the following steps:
(1) Change + operator to . operator
(2) Change . operator to + operator.
(3) Change 0 to 1 and 1 to 0 .
• Example: Dual of relation X + X’= 1 is X . X’=0.
• Duality is a very important property of boolean algebra.
Ex: A+A’=1 Apply the Duality Principal.
A.A’=0
Ex: A.(B.C)=(A.B).C
A+(B+C)=(A+B)+C
A+A’=1
A.A’=0
Theorem1 : Idempotency

(a) A + A = A (b) A . A = A
Proof: Proof:
A + A = (A + A) . 1 A.A=A.A+ 0
= (A + A). (A + A’)
= A . A + A .A’
= AA + AA’+ AA + AA’
= A ( A + A’)
= AA+ AA’
=A+ 0 =A. 1
=A =A
Perfect Induction Method

• (a) A + 1 = 1 (b) A . 0 = 0
Proof: Proof:
A + 1 = 1 . (A + 1)
= (A + A’) (A + 1) 0.0=0
= A.A + A.1 + A’ .A + => A . 0 = 0
A’.1 1.0=0
= A +A+ 0 + A’
= A + A’
=1 A . 0 = 0 by the duality
theorem
Theorem 2: Involution
• A’’ = A
• Proof:
0’’ = 0
=> A’ = A
1’’ = 1
Theorem 3 : Absorbtion

• (a) A + AB = A (b) A (A+B) = A


Proof: Proof:
A + AB = A . 1 + AB A (A + B) = A . A + AB
= A(1+B) = A + AB
=A
=A. 1
=A
Examples of Absorption theorem

• (a) A + A’ B = A + B (b) A . (A’ + B) = AB


Proof: Proof:
A + A’ B = A + AB + A’B A . ( A’ + B) = (A + AB) . (A’ + B)
= AA’ + AB + A’AB+
= A + B .( A + A’)
ABB
= A + B .1 = AB + ABB
= A+ B = AB + AB
= AB
Theorem4: DeMorgan’s Theorems
• DeMorgan suggested two theorems that form an important
part of boolean algebra.
(1) = +
The complement of a product is equal to the sum
of the complements
Truth Table:
(2) =
•The complement of a sum is equal to the product of the
complements
Truth Table:
Theorem5 : Consensus Theorem
• The expression of the form AB + A’C+ BC in which the term BC
is redundant and can be eliminated to form the equivalent
expression as AB + A’C
• The theorem used for this simplification is known as consensus
theorem and it is stated as
AB + A’C + BC = AB + A’C
Proof:
AB + A’C + BC = AB + A’C + (A + A’) BC
= AB + A’C + ABC + A’BC
= AB + ABC + A’C + A’BC
= AB(1+C) + A’C(1+B)
= AB + A’C
Binary Operators

x y x.y x y x+y x x’
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
x.(y+z) = (x.y)+(x.z)
x y z y+z x.(y+z) x.y x.z (x.y)+x.z
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1
Definitions
Literal: A variable or its complement

Product term: literals connected by •

Sum term: literals connected by +

Minterm: a product term in which all the variables appear


exactly once, either complemented or uncomplemented

Maxterm: a sum term in which all the variables appear exactly


once, either complemented or uncomplemented
Truth Table: A Truth table is a table that shows all the input-
output possibilities of a logic circuit. ie the truth table indicates
the outputs for different possibilities of the input.
Steps to reducing the Boolean expression
 Multiply all variables necessary to remove parentheses.

Look for identical terms. Only one of those terms be


retained and all others dropped.

Ex: AB+AB+AB+AB+AB=AB

Look for variable and its negation in the same term, this
term can be dropped.
Ex: 1. A.BB’=A.0=0
2. ABCC’=AB.0=0
Look for pairs of terms that are identical except for one
variable which may be missing in one of the terms, the
large term can be dropped.
Ex: ABC’D’+ABC’= ABC’(D’+1)= ABC’.1= ABC’
Look for pairs of terms which are having the same
variables, with one or more variables complemented. If
variable in one term of such a pair is complemented while
in the second term it is not, such terms can be combined
in to a single term with that variable dropped.

Ex: 1. ABC’D’+ABC’D= ABC’(D’+D)= ABC’.1= ABC’


2. AB(C+D)+AB(C+D)’= AB((C+D)+(C+D)’)= AB.1= AB
Reducing Boolean Expressions

● Is this the smallest possible implementation of this


expression? No! G = xyz + xyz’ + x’yz
● Use Boolean Algebra rules to reduce complexity
while preserving functionality
● Step 1: Use Theorem 1 (a + a = a)
• xyz + xyz’ + x’yz = xyz + xyz + xyz’ + x’yz
● Step 2: Use distributive rule a(b + c) = ab + ac
• xyz + xyz + xyz’ + x’yz = xy(z + z’) + yz(x + x’)
● Step 3: Use Postulate 3 (a + a’ = 1)
• xy(z + z’) + yz(x + x’) = xy.1 + yz.1
● Step 4: Use Postulate 2 (a . 1 = a)
● xy.1 + yz.1 = xy + yz = xyz + xyz’ + x’yz
Representing Functions with Minterms

● Minterm number is same as row position in truth table


(starting with 0 at the top)
● Shorthand way to represent functions

x y z G
0 0 0 0
0 0 1 0 G = xyz + xyz’ + x’yz
0 1 0 0
0 1 1 1
1 0 0 0 G = m7 + m6 + m3 = Σ(3, 6, 7)
1 0 1 0
1 1 0 1
1 1 1 1
Conversion Between Canonical Forms
● Easy to convert between minterm and maxterm
representations
● For maxterm representation, select rows with 0’s

x y z G G = xyz + xyz’ + x’yz


0 0 0 0
0 0 1 0
0 1 0 0 G = m7 + m6 + m3 = Σ(3, 6, 7)
0 1 1 1
1 0 0 0
1 0 1 0
G = M0M1M2M4M5 = π(0,1,2,4,5)
1 1 0 1
1 1 1 1
G = (x+y+z)(x+y+z’)(x+y’+z)(x’+y+z)(x’+y+z’)
Switching Functions/ Boolean Functions.
Boolean Functions are used to describe Boolean
expressions.

Ex: If the Boolean expression (A+B’)C is used to describe


the function f, then Boolean Function can be written as

f(A,B,C)=(A+B’)C
Or
f=(A+B’)C
Boolean Functions are represented in two forms.

 Sum Of Product forms (SOP)

 Product Of Sum forms (POS)

Sum Of Product forms (SOP):


A sum of product is a group of product terms OR ed
together.

Ex: f(A,B,C)=ABC+AB’C’

Ex: f(P,Q,R,S)=P’Q+QR+RS
Product Of Sum forms (POS):
A product of sum form is a group of sum terms AND ed
together.

Ex: f(A,B,C)=(A+B).(B’+C)

Ex: f(P,Q,R,S)=(P+Q).(R+S’).(P+S)
Canonical forms(Standard SOP and POS forms):

Standard SOP form or Minterm canonical form:


If each term in SOP form contains all the literals or
variables then the SOP form is known as Standard or
Canonical SOP form.
Each individual term in the Standard SOP form is called
“minterm”.

Ex: f(A,B,C)=AB’C+ABC+A’BC’
Standard POS form or Maxterm canonical form:
If each term in POS form contains all the literals or
variables then the POS form is known as Standard or
Canonical POS form.
Each individual term in the Standard POS form is called
“Maxterm”.

Ex: f(A,B,C)=(A+B+C).(A+B’+C).(A’+B’+C’)
Steps to convert SOP to Standard SOP form.
 Find the missing literal in each product term if any.

AND each product term with (missing literal + its


complement).

Expand the terms by applying distributive law and


record the literals in the product terms.

Reduce the expression by omitting repeated product


terms if any . Because A+A=A.
Steps to convert POS to Standard POS form.
 Find the missing literal in each sum term if any.

OR each product term with (missing literal * its


complement).

Expand the terms by applying distributive law and


record the literals in the sum terms.

Reduce the expression by omitting repeated sum terms


if any . Because A.A=A.
M-Notations: Minterms and Maxterms
Variables Minterms Maxterms
ABC (mi) (Mi)
000 A’B’C’=m0 A+B+C=M0
001 A’B’C=m1 A+B+C’=M1
010 A’BC’=m2 A+B’+C=M2
011 A’BC=m3 A+B’+C’=M3
100 AB’C’=m4 A’+B+C=M4
101 AB’C=m5 A’+B+C’=M5
110 ABC’=m6 A’+B’+C=M6
111 ABC=m7 A’+B’+C’=M7
Shorthand notation of SOP & POS forms:

Ex: Write the shorthand notation for the following


Boolean function.
f(A,B,C)=A’B’C’+A’B’C+A’BC+ABC’

Sol: f(A,B,C)=m0+m1+m3+m6
=Σm(0,1,3,6)
Σ=Sum of product terms
Ex: Write the shorthand notation for the following
Boolean function.
f(A,B,C)=(A+B+C’)(A+B’+C’)(A’+B’+C)

Sol: f(A,B,C)=M1 M3 M6
=ΠM(1,3,6)
Π =Product of sum terms
Conversion from min to Max & Max to min:
Ex: Convert the following min terms to max terms
f(A,B,C)=m0+m1+m3+m4+m6+m7.

Sol: f(A,B,C)=m0+m1+m3+m4+m6+m7
=Σm(0,1,3,4,6,7)
=ΠM(2,5)
Ex: Convert the following max terms to min terms
f(A,B,C,D)=M1 M3 M5 M7 M9 M11 M13 M15.
=ΠM(1,3,5,7,9,11,13,15)

=Σm(0,2,4,6,8,10,12,14
Ex: Simply the following three variable expression
using Boolean algebra.
Y=Σm(1,3,5,7)

Sol:
Y=A’B’C+A’BC+AB’C+ABC
=A’C(B’+B)+AC(B’+B)
=A’C(1)+AC(1)

=C(A’+A)

=C
Ex: Convert the expression given below in to min
terms using complementary property and simply
the expression using Boolean algebra.
Y=ΠM(3,5,7)
Sol: Y=Σm(0,1,2,4,6)
=A’B’C’+A’B’C+A’BC’+AB’C’+ABC’
=A’B’C’+AB’C’+A’BC’+ABC’+A’B’C
=B’C’(A’+A)+BC’(A’+A)+A’B’C
=B’C’+BC’+A’B’C
=C’(B’+B)+A’B’C
=C’+A’B’C A+A’B=A+B
=C’+A’B’

You might also like