SlideShare a Scribd company logo
1 of 20
EE122 Digtial Logic Desgin
TOPICS: NUMBER SYSTEMS AND BINARY CODES
WEEK: 3
LECTURE: 1 OVERALL LECTURE NO. 5
LEVEL: 2ND SEMESTER
PROGRAM: BE ELECTRICAL ENGINEERING
Electrical Engineering Department, SUIT Peshawar
Recap
Hexadecimal Number System
◦ Binary-Hexadecimal Conversion
◦ Decimal-Hexadecimal Conversion
Octal Number System
◦ Binary-Octal Conversion
◦ Decimal-Octal Conversion
Arithmetic Operations of Octal and Hexadecimal numbers systems
Arithmetic Operations of Signed, Unsigned and 2’s Complement Numbers
Range of Numbers
Floating Point Format
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 2
2’s Complement
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 3
Example
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 4
Example
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 5
Example
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 6
Today’s Lecture
Alternate Representations
◦BCD Code
◦ BCD Arithmetic
◦Gray Code
Error Detection Codes
Even and Odd parity Bit
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 7
Alternate Representations
BCD (Binary Coded Decimal) Code
Decimal BCD Decimal BCD
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
Chapter 1 9
Binary Numbers and Binary Coding
Flexibility of representation
◦ Within constraints below, can assign any binary combination (called a code word)
to any data as long as data is uniquely encoded.
Information Types
◦ Numeric
◦ Must represent range of data needed
◦ Very desirable to represent data such that simple, straightforward computation for common
arithmetic operations permitted
◦ Tight relation to binary numbers
◦ Non-numeric
◦ Greater flexibility since arithmetic operations not applied.
◦ Not tied to binary numbers
Chapter 1 10
Given n binary digits (called bits), a binary code is a mapping
from a set of represented elements to a subset of the 2n
binary numbers.
Example: A binary code
for the seven colors of the
rainbow Code 100 is
not used
Non-numeric Binary Codes
Binary Number
000
001
010
011
101
110
111
Color
Red
Orange
Yellow
Green
Blue
Indigo
Violet
Chapter 1 11
Binary Codes for Decimal Digits
Decimal 8,4,2,1 Excess3 Gray
0 0000 0011 0000
1 0001 0100 0100
2 0010 0101 0101
3 0011 0110 0111
4 0100 0111 0110
5 0101 1000 0010
6 0110 1001 0011
7 0111 1010 0001
8 1000 1011 1001
9 1001 1100 1000
There are over 8,000 ways that you can chose 10 elements
from the 16 binary numbers of 4 bits. A few are useful:
Chapter 1 12
Binary Coded Decimal (BCD)
The BCD code is the 8,4,2,1 code.
This code is the simplest, most intuitive binary code for decimal
digits and uses the same powers of 2 as a binary number, but only
encodes the first ten values from 0 to 9.
Example: 1001 (9) = 1000 (8) + 0001 (1)
Binary to Gray Code Conversion
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
TWO STEPS:
1. The most significant bit (left-most) in the Gray code is the same as the
corresponding MSB in the binary number.
2. Going from left to right, add each adjacent pair of binary code bits to get the
nextGray code bit. Discard carries.
Gray Code
Decimal Gray Binary
0 0000 0000
1 0001 0001
2 0011 0010
3 0010 0011
4 0110 0100
5 0111 0101
6 0101 0110
7 0100 0111
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
Gray-to-Binary Code Conversion
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
To convert from Gray code to binary:
1. The most significant bit (left-most) in the binary code is the same as the
corresponding bit in the Gray code.
2. Add each binary code bit generated to the Gray code bit in the next adjacent
position. Discard carries.
Chapter 1 16
BCD Addition Example
Add 2905BCD to 1897BCD showing carries and digit
corrections.
0001 1000 1001 0111
+ 0010 1001 0000 0101
0
Chapter 1 17
Error-Detection Codes
Redundancy (e.g. extra information), in the form of extra bits, can be
incorporated into binary code words to detect and correct errors.
A simple form of redundancy is parity, an extra bit appended onto the
code word to make the number of 1’s odd or even. Parity can detect all
single-bit errors and some multiple-bit errors.
A code word has even parity if the number of 1’s in the code word is
even.
A code word has odd parity if the number of 1’s in the code word is odd.
Error Detection
Digital Systems are very Reliable
Errors during storage or transmission
Parity Bit
◦Even Parity
◦Odd Parity
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 18
Chapter 1 19
4-Bit Parity Code Example
Fill in the even and odd parity bits:
The codeword "1111" has even parity and the codeword
"1110" has odd parity. Both can be used to represent 3-bit
data.
Even Parity Odd Parity
Message - Parity Message - Parity
000 - 000 -
001 - 001 -
010 - 010 -
011 - 011 -
100 - 100 -
101 - 101 -
110 - 110 -
111 - 111 -
END OF LECTURE
DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 20

More Related Content

Similar to DLD-W3-L1.pptx (20)

Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)
 
Quantitative Analysis 2
Quantitative Analysis 2Quantitative Analysis 2
Quantitative Analysis 2
 
Binary no
Binary noBinary no
Binary no
 
Digital Electronics Notes
Digital Electronics Notes Digital Electronics Notes
Digital Electronics Notes
 
Linear Block Codes
Linear Block CodesLinear Block Codes
Linear Block Codes
 
DEL LAB MANUAL
DEL LAB MANUALDEL LAB MANUAL
DEL LAB MANUAL
 
Binary codes
Binary codesBinary codes
Binary codes
 
Conclusion in this titty tittle 106_1.ppt
Conclusion in this titty tittle 106_1.pptConclusion in this titty tittle 106_1.ppt
Conclusion in this titty tittle 106_1.ppt
 
MODULE_2_Ch4_01082014.pptx .
MODULE_2_Ch4_01082014.pptx                   .MODULE_2_Ch4_01082014.pptx                   .
MODULE_2_Ch4_01082014.pptx .
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
Number codes students
Number codes studentsNumber codes students
Number codes students
 
Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006
 
Number system
Number systemNumber system
Number system
 
Number system
Number systemNumber system
Number system
 
Chapter 1 number and code system sss
Chapter 1 number and code system sssChapter 1 number and code system sss
Chapter 1 number and code system sss
 
Chapter 10: Error Correction and Detection
Chapter 10: Error Correction and DetectionChapter 10: Error Correction and Detection
Chapter 10: Error Correction and Detection
 
Dr.naveen electronics binary codes
Dr.naveen electronics binary codesDr.naveen electronics binary codes
Dr.naveen electronics binary codes
 
Lecture 5 binary_codes
Lecture 5 binary_codesLecture 5 binary_codes
Lecture 5 binary_codes
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx
 

More from aneesurrehman54

More from aneesurrehman54 (8)

DLD-W3-L2.pptx
DLD-W3-L2.pptxDLD-W3-L2.pptx
DLD-W3-L2.pptx
 
Corrona Effect.ppt
Corrona Effect.pptCorrona Effect.ppt
Corrona Effect.ppt
 
Electronegative gases and time lag.pptx
Electronegative gases and time lag.pptxElectronegative gases and time lag.pptx
Electronegative gases and time lag.pptx
 
Week 11
Week 11Week 11
Week 11
 
Week 5
Week 5Week 5
Week 5
 
Week 16
Week 16Week 16
Week 16
 
Week 15 high voltage AC gener
Week 15 high voltage AC generWeek 15 high voltage AC gener
Week 15 high voltage AC gener
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 

Recently uploaded

Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

DLD-W3-L1.pptx

  • 1. EE122 Digtial Logic Desgin TOPICS: NUMBER SYSTEMS AND BINARY CODES WEEK: 3 LECTURE: 1 OVERALL LECTURE NO. 5 LEVEL: 2ND SEMESTER PROGRAM: BE ELECTRICAL ENGINEERING Electrical Engineering Department, SUIT Peshawar
  • 2. Recap Hexadecimal Number System ◦ Binary-Hexadecimal Conversion ◦ Decimal-Hexadecimal Conversion Octal Number System ◦ Binary-Octal Conversion ◦ Decimal-Octal Conversion Arithmetic Operations of Octal and Hexadecimal numbers systems Arithmetic Operations of Signed, Unsigned and 2’s Complement Numbers Range of Numbers Floating Point Format DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 2
  • 3. 2’s Complement DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 3
  • 4. Example DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 4
  • 5. Example DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 5
  • 6. Example DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 6
  • 7. Today’s Lecture Alternate Representations ◦BCD Code ◦ BCD Arithmetic ◦Gray Code Error Detection Codes Even and Odd parity Bit DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 7
  • 8. Alternate Representations BCD (Binary Coded Decimal) Code Decimal BCD Decimal BCD 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001 DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
  • 9. Chapter 1 9 Binary Numbers and Binary Coding Flexibility of representation ◦ Within constraints below, can assign any binary combination (called a code word) to any data as long as data is uniquely encoded. Information Types ◦ Numeric ◦ Must represent range of data needed ◦ Very desirable to represent data such that simple, straightforward computation for common arithmetic operations permitted ◦ Tight relation to binary numbers ◦ Non-numeric ◦ Greater flexibility since arithmetic operations not applied. ◦ Not tied to binary numbers
  • 10. Chapter 1 10 Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2n binary numbers. Example: A binary code for the seven colors of the rainbow Code 100 is not used Non-numeric Binary Codes Binary Number 000 001 010 011 101 110 111 Color Red Orange Yellow Green Blue Indigo Violet
  • 11. Chapter 1 11 Binary Codes for Decimal Digits Decimal 8,4,2,1 Excess3 Gray 0 0000 0011 0000 1 0001 0100 0100 2 0010 0101 0101 3 0011 0110 0111 4 0100 0111 0110 5 0101 1000 0010 6 0110 1001 0011 7 0111 1010 0001 8 1000 1011 1001 9 1001 1100 1000 There are over 8,000 ways that you can chose 10 elements from the 16 binary numbers of 4 bits. A few are useful:
  • 12. Chapter 1 12 Binary Coded Decimal (BCD) The BCD code is the 8,4,2,1 code. This code is the simplest, most intuitive binary code for decimal digits and uses the same powers of 2 as a binary number, but only encodes the first ten values from 0 to 9. Example: 1001 (9) = 1000 (8) + 0001 (1)
  • 13. Binary to Gray Code Conversion DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK TWO STEPS: 1. The most significant bit (left-most) in the Gray code is the same as the corresponding MSB in the binary number. 2. Going from left to right, add each adjacent pair of binary code bits to get the nextGray code bit. Discard carries.
  • 14. Gray Code Decimal Gray Binary 0 0000 0000 1 0001 0001 2 0011 0010 3 0010 0011 4 0110 0100 5 0111 0101 6 0101 0110 7 0100 0111 DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK
  • 15. Gray-to-Binary Code Conversion DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK To convert from Gray code to binary: 1. The most significant bit (left-most) in the binary code is the same as the corresponding bit in the Gray code. 2. Add each binary code bit generated to the Gray code bit in the next adjacent position. Discard carries.
  • 16. Chapter 1 16 BCD Addition Example Add 2905BCD to 1897BCD showing carries and digit corrections. 0001 1000 1001 0111 + 0010 1001 0000 0101 0
  • 17. Chapter 1 17 Error-Detection Codes Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors. A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors. A code word has even parity if the number of 1’s in the code word is even. A code word has odd parity if the number of 1’s in the code word is odd.
  • 18. Error Detection Digital Systems are very Reliable Errors during storage or transmission Parity Bit ◦Even Parity ◦Odd Parity DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 18
  • 19. Chapter 1 19 4-Bit Parity Code Example Fill in the even and odd parity bits: The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data. Even Parity Odd Parity Message - Parity Message - Parity 000 - 000 - 001 - 001 - 010 - 010 - 011 - 011 - 100 - 100 - 101 - 101 - 110 - 110 - 111 - 111 -
  • 20. END OF LECTURE DR. JAVED IQBAL (SUIT PESHAWAR) JAVED.EE@SUIT.EDU.PK 20