UNIVERSITY INSTITUTE OF ENGG.
BE ACAD.UNIT 2
Bachelor of Engineering (Computer Science & Engineering)
Digital Electronics ECT-155
Types of Binary Codes
DISCOVER . LEARN . EMPOWER
1
Types Of Binary Codes
Code
Course Objectives:
• To understand what Binary Code means and apply this
Conversion
knowledge.
• To make you analyze and understand how data is represented
using bit systems and be able to change decimal numbers into
binary
• To Impart Knowledge about various types of binary codes
Course Outcome:
CO Title Level Figure 1.1 BCD code representation to Binary [1]
Number
CO1 Merits of digital code systems , types of Remember and
codes and its application understanding
CO2 Logic gate implementation of given code Applying and
Analyzing
CO3 Conversion of decimal number system to Evaluating and
any binary codes creating
2
Types Of Binary Codes Weighted to Non Weighted
code
Overview
Figure 1.2 BCD to Grey code conversion [2]
•Why binary?
•Binary codes and its types
•Weighted & non Weighted
codes
•Applications of Binary codes
3
Why Binary??
People use all kinds of symbols, sounds, colours and body motions to express themselves.
These expressions are like codes; signals we use to communicate with each other
Computers also use codes, but this code is much simpler.
Computers use electronic circuits that are either ON or OFF, there's no middle ground
4
What is Binary Code?
“Binary” comes from the Latin word for two.
In your everyday life you generally use a decimal system that allows you to use numbers 0-9
to make others.
Computers use a special code of their own to express the digital information they process.
It’s called the binary code because it consists of only two symbols – 0s and 1s
5
Types of Binary
codes
Figure 1.3 Types of Binary codes 6
Weighted Codes
Weighted binary codes are those binary codes which obey the positional weight principle.
Each position of the number represents a specific weight.
Several systems of the codes are used to express the decimal digits 0 through 9.
In these codes each decimal digit is represented by a group of four bits.
Example:
Figure 1.4 Weighted Codes
7
NON WEIGHTED CODE
IN NON WEIGHTED CODE THERE IS NO POSITIONAL WEIGHT
EACH POSITION WITHIN THE BINARY NUMBER IS NOT ASSIGNED A PREFIX VALUE.
NO SPECIFIC POSITIONS ARE ASSIGNED TO BIT POSITIONS IN NON WEIGHTED CODE
Code written with no
matching of number
with positional
weight
Figure 1.5 Non Weighted Codes 8
Weighted 4-Bit BCD
Code (8421)
The weighted 4-bit BCD code is more commonly known as 8421 weighted code.
It is called weighted code because it encodes the decimal system into binary system by using the
concept of positional weighting into consideration.
In this code, each decimal digit is encoded into its 4-bit binary number in which the bits from left to right
have the weights 8, 4, 2, and 1, respectively
Decimal number
BCD Code for Decimal Number
Figure 1.6 Decimal to BCD conversion 9
Gray Code Non-Weighted
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 figure below.
Figure 1.7 Binary to Gray code Figure 1.8 Binary to Gray
code
10
Binary code to Gray Code
Conversion Steps
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.
Figure 1.9 EXOR Gate is used for Conversion[4]
11
Gray Code to Binary
code Conversion Steps
The MSB of the binary number will be equal to the MSB of the given gray code.
Now if the second gray bit is 0, then the second binary bit will be the same as the previous or the first
bit. If the gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and if it was 0 it will be 1.
This step is continued for all the bits to do Gray code to binary conversion
Figure 1.10 Gray to binary conversion[4]
12
Applications of Binary
Codes
Suitable for the computer applications.
Suitable for the digital communications
Make the analysis and designing of digital circuits if we use the
binary codes.
Since only 0 & 1 are being used ,implementation becomes easy
13
REFERENCES
1. https://www.google.com/search?q=binary+multiplication+examples&oq=binary+multiplication+e
xamples&aqs=chrome..69i57j0l7.10302j0j4&sourceid=
chrome&ie=UTF-8
2. http://www.ipsgwalior.org/download/number%20system.pdf
3. https://www.google.com/search?q=decimal+to+binary&source=lnms&tbm=isch&sa=X&ved=0ah
UKEwi6nMvW5uHiAhVBXSsKHUgGC60Q_AUIECgB&biw=1517&bih=730#imgrc=cl-xz1ixddfv9M
4. www.cse.yorku.ca/~mack/1011/01.NumberSystems.ppt
5. https://www.google.com/search?q=binary+to+grey+conversion&source=lnms&tbm=isch&sa=X&
ved=0ahUKEwjD6vrQi-PiAhVMSX0KHftLDngQ_AUIECgB&biw=1366&bih=657#imgrc=bkt5qsZlpTZ
1sM
6. http://www.geeksforgeeks.org/digital-electronics-logic-design-tutorials/
7. https://www.google.com/search?q=binary+to+grey+conversion&source=lnms&tbm=isch&sa=X&
ved=0ahUKEwjD6vrQi-PiAhVMSX0KHftLDngQ_AUIECgB&biw=1366&bih=657#imgrc=bkt5qsZlpTZ
1sM
8. http://www.ni.com/example/14493/en/
9. https://www.tutorialspoint.com/digital_electronics/index.asp
10. https://www.tutorialspoint.com/computer_logical_organization/complement_arithmetic.htm
11. Floyd & Jain, Digital Fundamentals, Pearson.
12. Mano,Morris, Digital Design, Prentice Hall of India. 14
THANK YOU
For queries
Email: [email protected]