SlideShare a Scribd company logo
Codes
Computers and digital circuits processes information in the binary
format. Each character is assigned 7 or 8 bit binary code to indicate its character
which may be numeric, alphabet or special symbol. Example - Binary number
1000001 represents 65(decimal) in straight binary code, alphabet A in ASCII
code and 41(decimal) in BCD code.
Types of codes
• BCD (Binary-Coded Decimal) code :
• ASCII (American Standard Code Information Interchange) code :
• EBCDIC (Extended Binary Coded Decimal Interchange Code) code
• Gray code
• Excess-3 code
BCD (Binary-Coded Decimal) code :
• Four-bit code that represents one of the ten decimal digits from 0 to
9.
• Example - (37)10 is represented as 0011 0111 using BCD code, rather
than (100101)2 in straight binary code.
• Thus BCD code requires more bits than straight binary code.
• Still it is suitable for input and output operations in digital systems.
• Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE in
BCD code.
ASCII (American Standard Code Information Interchange) code :
• It is 7-bit or 8-bit alphanumeric code.
• 7-bit code is standard ASCII supports 127 characters.
• Standard ASCII series starts from 00h to 7Fh, where 00h-1Fh are used
as control characters and 20h-7Fh as graphics symbols.
• 8-bit code is extended ASCII supports 256 symbols where special
graphics and math's symbols are added.
• Extended ASCII series starts from 80h to FFh.
EBCDIC (Extended Binary Coded Decimal Interchange Code) code
• 8-bit alphanumeric code developed by IBM, supports 256 symbols.
• It was mainly used in IBM mainframe computers.
Gray code
• Differs from leading and following number by a single bit.
• Gray code for 2 is 0011 and for 3 is 0010.
• No weights are assigned to the bit positions.
• Extensively used in shaft encoders.
Excess-3 code
• 4-bit code is obtained by adding binary 0011 to the natural BCD code
of the digit.
• Example - decimal 2 is coded as 0010 + 0011 = 0101 as Excess-3 code.
• It not weighted code.
• Its self-complimenting code, means 1's complement of the coded
number yields 9's complement of the number itself.
• Used in digital system for performing subtraction operations.
There are many methods or techniques which can be used to convert code from one
format to another.
We'll demonstrate here the following
• Binary to BCD Conversion
• BCD to Binary Conversion
• BCD to Excess-3
• Excess-3 to BCD
Binary to BCD Conversion
Steps
Step 1 -- Convert the binary number to decimal.
Step 2 -- Convert decimal number to BCD.
Example − convert (11101)2 to BCD.
Step 1 − Convert to Decimal
Binary Number − 111012
Calculating Decimal Equivalent −
Step Binary Number Decimal Number
Step 1 111012
((1 × 24) + (1 × 23) + (1 × 22)
+ (0 × 21) + (1 × 20))10
Step 2 111012 (16 + 8 + 4 + 0 + 1)10
Step 3 111012 2910
Binary Number − 111012 = Decimal Number − 2910
Step 2 − Convert to BCD
Decimal Number − 2910
Calculating BCD Equivalent. Convert each digit into groups of four binary digits equivalent.
Step Decimal Number Conversion
Step 1 2910 00102 10012
Step 2 2910 00101001BCD
Result
(11101)2 = (00101001)BCD
BCD to Binary Conversion
Steps
Step 1 -- Convert the BCD number to decimal.
Step 2 -- Convert decimal to binary.
Example − convert (00101001)BCD to Binary.
Step 1 - Convert to BCD
BCD Number − (00101001)BCD
Calculating Decimal Equivalent. Convert each four digit into a group and get decimal equivalent for each group.
Step BCD Number Conversion
Step 1 (00101001)BCD 00102 10012
Step 2 (00101001)BCD 210 910
Step 3 (00101001)BCD 2910
BCD Number − (00101001)BCD = Decimal Number − 2910
Step 2 - Convert to Binary
• Used long division method for decimal to binary conversion.
• Decimal Number − 2910
• Calculating Binary Equivalent −
Step Operation Result Remainder
Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7 / 2 3 1
Step 4 3 / 2 1 1
Step 5 1 / 2 0 1
Decimal Number − 2910 = Binary Number − 111012
Result
(00101001)BCD = (11101)2
Result
(1001)BCD = (1100)XS-3
BCD to Excess-3
Steps
Step 1 -- Convert BCD to decimal.
Step 2 -- Add (3)10 to this decimal number.
Step 3 -- Convert into binary to get excess-3 code.
Example − convert (1001)BCD to Excess-3.
Step 1 − Convert to decimal
(1001)BCD = 910
Step 2 − Add 3 to decimal
(9)10 + (3)10 = (12)10
Step 3 − Convert to Excess-3
(12)10 = (1100)XE-3
Excess-3 to BCD Conversion
Steps
Step 1 -- Subtract (0011)2 from each 4 bit of excess-3 digit to obtain the corresponding BCD
code.
Example − convert (10011010)XS-3 to BCD.
Given XE-3 number = 10011010
Subtract (0011)2 = 00110011
_______________
BCD 01100111
RESULT : (10011010)Xe-3 =(01100111)BCD

More Related Content

PPT
Digital fundamendals r001a
PPT
Number systems r002
PPTX
Codes r005
PPT
Binary coded decimal r004
PPT
Error detection and correction codes r006
PPT
Combinational circuits r011
PPT
Number system and codes
PPTX
Binary Codes and Number System
Digital fundamendals r001a
Number systems r002
Codes r005
Binary coded decimal r004
Error detection and correction codes r006
Combinational circuits r011
Number system and codes
Binary Codes and Number System

What's hot (20)

PPTX
Computer architecture data representation
PDF
Fixed Point Conversion
PPTX
Data Representation
PPTX
Quick tutorial on IEEE 754 FLOATING POINT representation
PPTX
Representation of Signed Numbers - R.D.Sivakumar
PPT
Representation of Real Numbers
PPTX
Representation of Integers
PPT
Integer Representation
PDF
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
PPTX
Floating point representation
PPSX
Fixed point and floating-point numbers
PPT
Lec 02 data representation part 1
PPTX
Introduction of number system
PPTX
Introduction to number system
PPTX
Data Representation
PPTX
Number systems and conversions
PPTX
Chapter 2.1 introduction to number system
PPT
09 Arithmetic
PDF
Data representation
PPT
Data representation
Computer architecture data representation
Fixed Point Conversion
Data Representation
Quick tutorial on IEEE 754 FLOATING POINT representation
Representation of Signed Numbers - R.D.Sivakumar
Representation of Real Numbers
Representation of Integers
Integer Representation
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
Floating point representation
Fixed point and floating-point numbers
Lec 02 data representation part 1
Introduction of number system
Introduction to number system
Data Representation
Number systems and conversions
Chapter 2.1 introduction to number system
09 Arithmetic
Data representation
Data representation
Ad

Similar to Code conversion r006 (20)

PPTX
micro processor and its architecture unit1.pptx
PPTX
Digital Module 1.pptx Digital logic design
PPTX
PPT
Number system
PPTX
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
PPTX
Digital Module 2.pptx Digital logic design
PPTX
Digital Logic BCA TU Chapter 2.2
PPTX
PPT - 2.pptx
PDF
Logic Gates(Logic gates are fundamental building blocks of digital circuits).pdf
PDF
Computer Logical Organization(It refers to how its functional units are arran...
PDF
What is bcd number system
PDF
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
PDF
Lecture5 Chapter1- Binary Codes.pdf
PPTX
Unit-1 (DLD) Lecture 2.pptx
PPT
Digital Electronics Principles & Applications Fifth Edition
PPT
Digital Electronics Principle and application using circuits
PPT
Ch02_Number_system_decimal_octal_Binary_hex.ppt
PPTX
digital%20electronics.pptx
micro processor and its architecture unit1.pptx
Digital Module 1.pptx Digital logic design
Number system
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
Digital Module 2.pptx Digital logic design
Digital Logic BCA TU Chapter 2.2
PPT - 2.pptx
Logic Gates(Logic gates are fundamental building blocks of digital circuits).pdf
Computer Logical Organization(It refers to how its functional units are arran...
What is bcd number system
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
Lecture5 Chapter1- Binary Codes.pdf
Unit-1 (DLD) Lecture 2.pptx
Digital Electronics Principles & Applications Fifth Edition
Digital Electronics Principle and application using circuits
Ch02_Number_system_decimal_octal_Binary_hex.ppt
digital%20electronics.pptx
Ad

More from arunachalamr16 (14)

PPT
Pipeline r014
PPT
Registers r011
PPT
08 logic simplification
PDF
Boolean algebra r009
PPT
Boolean variables r010
PPT
Central processing unit and stack organization r013
PPT
Counters r012
PPT
Flipflop r012
PDF
Universal gates r008
PPT
Logic gates r007
PDF
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
PPT
1sand2scomplement r004
PPT
1’s and 2’s complements
PPTX
Pill camera
Pipeline r014
Registers r011
08 logic simplification
Boolean algebra r009
Boolean variables r010
Central processing unit and stack organization r013
Counters r012
Flipflop r012
Universal gates r008
Logic gates r007
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
1sand2scomplement r004
1’s and 2’s complements
Pill camera

Recently uploaded (20)

PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Basic Mud Logging Guide for educational purpose
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Institutional Correction lecture only . . .
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Sports Quiz easy sports quiz sports quiz
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Pharma ospi slides which help in ospi learning
PDF
Complications of Minimal Access Surgery at WLH
PDF
01-Introduction-to-Information-Management.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cell Structure & Organelles in detailed.
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Basic Mud Logging Guide for educational purpose
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPH.pptx obstetrics and gynecology in nursing
Institutional Correction lecture only . . .
TR - Agricultural Crops Production NC III.pdf
Computing-Curriculum for Schools in Ghana
Sports Quiz easy sports quiz sports quiz
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Anesthesia in Laparoscopic Surgery in India
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
GDM (1) (1).pptx small presentation for students
Pharma ospi slides which help in ospi learning
Complications of Minimal Access Surgery at WLH
01-Introduction-to-Information-Management.pdf
Classroom Observation Tools for Teachers
Microbial disease of the cardiovascular and lymphatic systems
human mycosis Human fungal infections are called human mycosis..pptx
Cell Structure & Organelles in detailed.

Code conversion r006

  • 1. Codes Computers and digital circuits processes information in the binary format. Each character is assigned 7 or 8 bit binary code to indicate its character which may be numeric, alphabet or special symbol. Example - Binary number 1000001 represents 65(decimal) in straight binary code, alphabet A in ASCII code and 41(decimal) in BCD code.
  • 2. Types of codes • BCD (Binary-Coded Decimal) code : • ASCII (American Standard Code Information Interchange) code : • EBCDIC (Extended Binary Coded Decimal Interchange Code) code • Gray code • Excess-3 code
  • 3. BCD (Binary-Coded Decimal) code : • Four-bit code that represents one of the ten decimal digits from 0 to 9. • Example - (37)10 is represented as 0011 0111 using BCD code, rather than (100101)2 in straight binary code. • Thus BCD code requires more bits than straight binary code. • Still it is suitable for input and output operations in digital systems. • Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE in BCD code.
  • 4. ASCII (American Standard Code Information Interchange) code : • It is 7-bit or 8-bit alphanumeric code. • 7-bit code is standard ASCII supports 127 characters. • Standard ASCII series starts from 00h to 7Fh, where 00h-1Fh are used as control characters and 20h-7Fh as graphics symbols. • 8-bit code is extended ASCII supports 256 symbols where special graphics and math's symbols are added. • Extended ASCII series starts from 80h to FFh.
  • 5. EBCDIC (Extended Binary Coded Decimal Interchange Code) code • 8-bit alphanumeric code developed by IBM, supports 256 symbols. • It was mainly used in IBM mainframe computers. Gray code • Differs from leading and following number by a single bit. • Gray code for 2 is 0011 and for 3 is 0010. • No weights are assigned to the bit positions. • Extensively used in shaft encoders.
  • 6. Excess-3 code • 4-bit code is obtained by adding binary 0011 to the natural BCD code of the digit. • Example - decimal 2 is coded as 0010 + 0011 = 0101 as Excess-3 code. • It not weighted code. • Its self-complimenting code, means 1's complement of the coded number yields 9's complement of the number itself. • Used in digital system for performing subtraction operations.
  • 7. There are many methods or techniques which can be used to convert code from one format to another. We'll demonstrate here the following • Binary to BCD Conversion • BCD to Binary Conversion • BCD to Excess-3 • Excess-3 to BCD Binary to BCD Conversion Steps Step 1 -- Convert the binary number to decimal. Step 2 -- Convert decimal number to BCD. Example − convert (11101)2 to BCD.
  • 8. Step 1 − Convert to Decimal Binary Number − 111012 Calculating Decimal Equivalent − Step Binary Number Decimal Number Step 1 111012 ((1 × 24) + (1 × 23) + (1 × 22) + (0 × 21) + (1 × 20))10 Step 2 111012 (16 + 8 + 4 + 0 + 1)10 Step 3 111012 2910 Binary Number − 111012 = Decimal Number − 2910 Step 2 − Convert to BCD Decimal Number − 2910 Calculating BCD Equivalent. Convert each digit into groups of four binary digits equivalent. Step Decimal Number Conversion Step 1 2910 00102 10012 Step 2 2910 00101001BCD Result (11101)2 = (00101001)BCD
  • 9. BCD to Binary Conversion Steps Step 1 -- Convert the BCD number to decimal. Step 2 -- Convert decimal to binary. Example − convert (00101001)BCD to Binary. Step 1 - Convert to BCD BCD Number − (00101001)BCD Calculating Decimal Equivalent. Convert each four digit into a group and get decimal equivalent for each group. Step BCD Number Conversion Step 1 (00101001)BCD 00102 10012 Step 2 (00101001)BCD 210 910 Step 3 (00101001)BCD 2910 BCD Number − (00101001)BCD = Decimal Number − 2910
  • 10. Step 2 - Convert to Binary • Used long division method for decimal to binary conversion. • Decimal Number − 2910 • Calculating Binary Equivalent − Step Operation Result Remainder Step 1 29 / 2 14 1 Step 2 14 / 2 7 0 Step 3 7 / 2 3 1 Step 4 3 / 2 1 1 Step 5 1 / 2 0 1 Decimal Number − 2910 = Binary Number − 111012 Result (00101001)BCD = (11101)2
  • 11. Result (1001)BCD = (1100)XS-3 BCD to Excess-3 Steps Step 1 -- Convert BCD to decimal. Step 2 -- Add (3)10 to this decimal number. Step 3 -- Convert into binary to get excess-3 code. Example − convert (1001)BCD to Excess-3. Step 1 − Convert to decimal (1001)BCD = 910 Step 2 − Add 3 to decimal (9)10 + (3)10 = (12)10 Step 3 − Convert to Excess-3 (12)10 = (1100)XE-3
  • 12. Excess-3 to BCD Conversion Steps Step 1 -- Subtract (0011)2 from each 4 bit of excess-3 digit to obtain the corresponding BCD code. Example − convert (10011010)XS-3 to BCD. Given XE-3 number = 10011010 Subtract (0011)2 = 00110011 _______________ BCD 01100111 RESULT : (10011010)Xe-3 =(01100111)BCD