SlideShare a Scribd company logo
1 of 12
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

What's hot

Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representationAnil Pokhrel
 
Fixed Point Conversion
Fixed Point ConversionFixed Point Conversion
Fixed Point ConversionRajesh Sharma
 
Quick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationQuick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationRitu Ranjan Shrivastwa
 
Representation of Signed Numbers - R.D.Sivakumar
Representation of Signed Numbers - R.D.SivakumarRepresentation of Signed Numbers - R.D.Sivakumar
Representation of Signed Numbers - R.D.SivakumarSivakumar R D .
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of IntegersSusantha Herath
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representationgavhays
 
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...Arti Parab Academics
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbersMOHAN MOHAN
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1Abdul Khan
 
Introduction of number system
Introduction of number systemIntroduction of number system
Introduction of number systemAswiniT3
 
Introduction to number system
Introduction to number systemIntroduction to number system
Introduction to number systemAswiniT3
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversionsSusantha Herath
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemISMT College
 
Data representation
Data representationData representation
Data representationMysore
 

What's hot (20)

Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representation
 
Fixed Point Conversion
Fixed Point ConversionFixed Point Conversion
Fixed Point Conversion
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Quick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representationQuick tutorial on IEEE 754 FLOATING POINT representation
Quick tutorial on IEEE 754 FLOATING POINT representation
 
Representation of Signed Numbers - R.D.Sivakumar
Representation of Signed Numbers - R.D.SivakumarRepresentation of Signed Numbers - R.D.Sivakumar
Representation of Signed Numbers - R.D.Sivakumar
 
Representation of Real Numbers
Representation of Real NumbersRepresentation of Real Numbers
Representation of Real Numbers
 
Representation of Integers
Representation of IntegersRepresentation of Integers
Representation of Integers
 
Integer Representation
Integer RepresentationInteger Representation
Integer Representation
 
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
FYBSC IT Digital Electronics Unit I Chapter II Number System and Binary Arith...
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbers
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1
 
Introduction of number system
Introduction of number systemIntroduction of number system
Introduction of number system
 
Introduction to number system
Introduction to number systemIntroduction to number system
Introduction to number system
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Number systems and conversions
Number systems and conversionsNumber systems and conversions
Number systems and conversions
 
Chapter 2.1 introduction to number system
Chapter 2.1 introduction to number systemChapter 2.1 introduction to number system
Chapter 2.1 introduction to number system
 
09 Arithmetic
09  Arithmetic09  Arithmetic
09 Arithmetic
 
Data representation
Data representationData representation
Data representation
 
Data representation
Data representationData representation
Data representation
 

Similar to Code conversion r006

12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...JatinJatin30
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2ISMT College
 
PPT - 2.pptx
PPT - 2.pptxPPT - 2.pptx
PPT - 2.pptxANUTD1
 
What is bcd number system
What is bcd number systemWhat is bcd number system
What is bcd number systemMuhammad Shahid
 
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfW3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfMOHDZAMRIBINIBRAHIM1
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfUmerKhan147799
 
Unit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxUnit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxBunnyYadav7
 
digital%20electronics.pptx
digital%20electronics.pptxdigital%20electronics.pptx
digital%20electronics.pptxansariparveen06
 
Lecture 5 binary_codes
Lecture 5 binary_codesLecture 5 binary_codes
Lecture 5 binary_codesKamran Zafar
 
digital logic circuits, digital component floting and fixed point
 digital logic circuits, digital component floting and fixed point digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointRai University
 
DIGITAL ELECTRONICS
DIGITAL ELECTRONICSDIGITAL ELECTRONICS
DIGITAL ELECTRONICSSYEDJAMAESHA
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notesKurenai Ryu
 

Similar to Code conversion r006 (20)

Bcd
BcdBcd
Bcd
 
Number system
Number systemNumber system
Number system
 
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2
 
PPT - 2.pptx
PPT - 2.pptxPPT - 2.pptx
PPT - 2.pptx
 
Number codes
Number codesNumber codes
Number codes
 
What is bcd number system
What is bcd number systemWhat is bcd number system
What is bcd number system
 
Number codes students
Number codes studentsNumber codes students
Number codes students
 
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfW3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdf
 
Unit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxUnit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptx
 
digital%20electronics.pptx
digital%20electronics.pptxdigital%20electronics.pptx
digital%20electronics.pptx
 
Chapter1b
Chapter1bChapter1b
Chapter1b
 
Lecture 5 binary_codes
Lecture 5 binary_codesLecture 5 binary_codes
Lecture 5 binary_codes
 
digital logic circuits, digital component floting and fixed point
 digital logic circuits, digital component floting and fixed point digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed point
 
DIGITAL ELECTRONICS
DIGITAL ELECTRONICSDIGITAL ELECTRONICS
DIGITAL ELECTRONICS
 
Number system utm notes
Number system utm notesNumber system utm notes
Number system utm notes
 
Digital electronics
Digital electronicsDigital electronics
Digital electronics
 
Digital Electronics Codes.pdf
Digital Electronics Codes.pdfDigital Electronics Codes.pdf
Digital Electronics Codes.pdf
 
Alu1
Alu1Alu1
Alu1
 

More from arunachalamr16

08 logic simplification
08 logic simplification08 logic simplification
08 logic simplificationarunachalamr16
 
Boolean variables r010
Boolean variables   r010Boolean variables   r010
Boolean variables r010arunachalamr16
 
Central processing unit and stack organization r013
Central processing unit and stack organization   r013Central processing unit and stack organization   r013
Central processing unit and stack organization r013arunachalamr16
 
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theoremsarunachalamr16
 
1sand2scomplement r004
1sand2scomplement  r0041sand2scomplement  r004
1sand2scomplement r004arunachalamr16
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complementsarunachalamr16
 

More from arunachalamr16 (14)

Pipeline r014
Pipeline   r014Pipeline   r014
Pipeline r014
 
Registers r011
Registers   r011Registers   r011
Registers r011
 
08 logic simplification
08 logic simplification08 logic simplification
08 logic simplification
 
Boolean algebra r009
Boolean algebra   r009Boolean algebra   r009
Boolean algebra r009
 
Boolean variables r010
Boolean variables   r010Boolean variables   r010
Boolean variables r010
 
Central processing unit and stack organization r013
Central processing unit and stack organization   r013Central processing unit and stack organization   r013
Central processing unit and stack organization r013
 
Counters r012
Counters  r012Counters  r012
Counters r012
 
Flipflop r012
Flipflop   r012Flipflop   r012
Flipflop r012
 
Universal gates r008
Universal gates   r008Universal gates   r008
Universal gates r008
 
Logic gates r007
Logic gates   r007Logic gates   r007
Logic gates r007
 
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
18 pc09 1.2_ digital logic gates _ boolean algebra_basic theorems
 
1sand2scomplement r004
1sand2scomplement  r0041sand2scomplement  r004
1sand2scomplement r004
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
Pill camera
Pill cameraPill camera
Pill camera
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

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