0% found this document useful (0 votes)
59 views34 pages

Code Conversion

Uploaded by

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

Code Conversion

Uploaded by

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

Code Conversion

Binary to Gray Code Conversion


• Gray code is not weighted that means it does not
depends on positional value of digit.
• Gray code also known as reflected binary code, because
the first (n/2) values compare with those of the last
(n/2) values, but in reverse order.
• Gray codes are very useful in the normal sequence of
binary numbers generated by the hardware that may
cause an error or ambiguity during the transition from
one number to the next. So, the Gray code can
eliminate this problem easily since only one bit changes
its value during any transition between two numbers.
Gray Code
• It is the non-weighted code and it is not arithmetic codes.
• That means there are no specific weights assigned to the
bit position.
• It has a very special feature that, only one bit will change
each time the decimal number is incremented as shown in
fig.
• As only one bit changes at a time, the gray code is called
as a unit distance code.
• The gray code is a cyclic code.
• Gray code cannot be used for arithmetic operation.
Binary to Gray Conversion Process
Truth Table for Binary to Gray Code Conversion
K-Map for Binary to Gray Conversion

Kmap for go: Kmap for g1:


Continued….

Kmap for g2: Kmap for g3:


Circuit Diagram for Binary to Gray
K-map for Gray to Binary Code Conversion

K-map forb0: K-map for b1:


Continued…
K-map for b2: K-map for b3:
Simplification of Expression
Circuit Diagram for Gray to Binary
BCD Code
• In the BCD numbering system, a decimal
number is separated into four bits for each
decimal digit within the number.
• Each decimal digit is represented by its
weighted binary value performing a direct
translation of the number.
• So a 4-bit group represents each displayed
decimal digit from 0000 for a zero to 1001 for
a nine.
Continued….
Advantages of BCD Codes
• It is very similar to decimal system.
• We need to remember binary equivalent of decimal
numbers 0 to 9 only.

Disadvantages of BCD Codes


• The addition and subtraction of BCD have different rules.
• The BCD arithmetic is little more complicated.
• BCD needs more number of bits than binary to represent
the decimal number. So BCD is less efficient than binary.
Excess-3 code
• The Excess-3 code is also called as XS-3 code. It
is non-weighted code used to express decimal
numbers.
• The Excess-3 code words are derived from the
8421 BCD code words adding (0011)2 or (3)10 to
each code word in 8421.
• The excess-3 codes are obtained as follows −
Truth Table for BCD to Excess-3
K-map for BCD to Excess-3 code conversion
Simplification of Expression
Circuit Diagram for BCD to Excess-3 code Conversion
Excess-3 to BCD Code Conversion
• BCD is obtained by Excess-3 code in the
opposite way as of BCD to Excess-3 code.

• BCD = Excess-3 code – 3


Truth Table for Excess-3 code to BCD
K-map for Excess-3 to BCD code Conversion

• K-map for D: • K-map for C:


Continued…
• K-map for B: • K-map for A:
Circuit Diagram for Excess-3 to BCD code
Questions
1) Design BCD to Gray code conversion.
2) Design Excess-3 to Gray code conversion.
NAND & NOR: Universal Gates
• A universal gate is a gate which can implement any
Boolean function without need to use any
other gate type.
• The NAND and NOR gates are universal gates.
• NOR and NAND gates have the particular property that
any one of them can create any logical Boolean
expression if appropriately designed.
• Meaning that you can create any logical Boolean
expression using ONLY NOR gates or ONLY NAND gates.
• Other logical gates do not have this property.
Symbols of NAND & NOR Gates
NAND as Universal Gates
XOR Implementation using NAND
XNOR Implementation Using NAND
NOR as Universal Gate
XOR Using NOR Gate
XNOR Using NOR

You might also like