SlideShare a Scribd company logo
1 of 39
BCD, ASCII, Excess-3, Gray
Code, Error Detecting &
Correcting Code
Slide Prepared by: Roshan Kandel
1
BCD Code
2
Binary-Coded-Decimal (BCD)
• Conversions between decimal and binary can become long and complicated for
large numbers.
• For example, convert 87410 to binary. The answer is 11011010102, but it takes quite
a lot of time and effort to make this conversion. We call this straight binary coding.
3
Binary-Coded-Decimal (BCD)
• The Binary-Coded-Decimal (BCD) code makes conversion much easier.
Each decimal digit, 0 through 9, is represented with a 4-Bit BCD code as
shown below. The BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are not
used.
4
• Conversion between BCD and decimal is accomplished by replacing a 4-bit
BCD for each decimal digit. For example, 87410 = 1000 0111 0100BCD.
• BCD is not another number system like binary, octal, decimal and
hexadecimal. It is in fact the decimal system with each digit encoded in its
binary equivalent. A BCD code is not the same as a straight binary number.
For example, the BCD code requires 12 bits, while the straight binary
number requires only 10 bits to represent 87310.
Decimal  BCD Conversion
5
• A BCD code is converted into a decimal number by taking groups of 4 bits,
starting from LSB, and replacing them with a BCD code. For example, 1
1001 0111 1000 BCD = 197810
BCD  Decimal Conversion
6
7
8421 BCD Code (Natural BCD Code)
 Each decimal digit, 0 through 9, is coded by 4-bit binary number
 8, 4, 2 and 1 weights are attached to each bit
 BCD code is weighted code
 1010, 1011, 1100, 1101, 1110 and 1111 are illegal codes
 Less efficient than pure binary
 Arithmetic operations are more complex than in pure binary
 Example
1 4
0100
0001
Decimal
BCD
Binary 1110
8
Binary Codes
Decimal Binary BCD
0 0 0000
1 1 0001
2 10 0010
3 11 0011
4 100 0100
5 101 0101
6 110 0110
7 111 0111
Decimal Binary BCD
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
12 1100 0001 0010
13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101
9
BCD Addition
 Example - 1
0 0 1 0
0 0 0 1
0 0 1 1
+
0 1 0 1
0 0 1 1
1 0 0 0
2 5
1 3
+
3 8
No carry, no illegal code. So, this is
the correct sum.
1
1
1
Rule: If there is an illegal code or carry is generated as a result of
addition, then add 0110 (6) to particular that 4 bits of result.
10
BCD Addition
 Example - 2
0110 0111 1001
+
.0110
679.6
536.8
+
1216.4 All are illegal codes
0101 0011 0110 .1000
1011 1010 1111 .1110
+0110 +0110 +0110 +.0110
10001 10000 10101 1.0100
1
+
1
+
1
+
1
+
0010 0001 0110 .0100
0001
Add 0110 to
each
Propagate
carry
Corrected sum
1
1
1
1
11
BCD Subtraction
 Example - 1
0 0 1 1
0 0 0 1
0 0 1 0
-
1 0 0 0
0 1 0 1
0 0 1 1
3 8
1 5
-
2 3
No borrow. So, this is the correct
difference.
Rule: If one 4-bit group needs to take borrow from neighbor, then
subtract 0110 from the group which is receiving borrow.
12
BCD Subtraction
 Example - 2
0010 0000 0110
-
.0111
206.7
147.8
-
58.9
Borrows are
present
0001 0100 0111 .1000
0000 1011 1110 .1111
-0110 -0110 -.0110
0101 1000 .1001
Subtract 0110
Corrected
difference
The Gray Code
13
The Gray Code
• The Gray code is un-weighted and is not an arithmetic code; that is,
there are no specific weights assigned to the bit positions.
• The important feature of the Gray code is that it exhibits only a single
bit change from one code word to the next in sequence
• This property is important in many applications, such as shaft position
encoders, where error susceptibility increases with the number of bit
changes between adjacent numbers in a sequence.
14
Table below is a listing of the 4-bit Gray code
for decimal numbers 0 through 15.
15
The Gray Code
• Notice the single-bit change between successive Gray code words.
• For instance, in going from decimal 3 to decimal 4, the Gray code
changes from 0010 to 0110, while the binary code changes from 0011
to 0100, a change of three bits. The only bit change in the Gray code is
in the third bit from the right: the other bits remain the same.
16
Binary-to-Gray Code Conversion
The following rules explain how to convert from a binary number to a
Gray code word:
• 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 next Gray code bit. Discard carries.
17
Binary-to-Gray Code Conversion
• For example, the conversion of the binary number 10110 to Gray code
is as follows:
18
Gray-to-Binary Code Conversion
To convert from Gray code to binary, use a similar method; however,
there are some differences. The following rules apply:
• 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.
19
Gray-to-Binary Code Conversion
• For example, the conversion of the Gray code word 11011 to binary is
as follows:
20
Gray-to-Binary Code Conversion
21
ASCII
22
ASCII
• ASCII is the abbreviation for American Standard Code for Information
Interchange.
• Pronounced “askee,” ASCII is a universally accepted alphanumeric
code used in most computers and other electronic equipment.
• Most computer keyboards are standardized with the ASCII. When you
enter a letter, a number, or control command, the corresponding ASCII
code goes into the computer
• ASCII has 128 characters and symbols represented by a 7-bit binary
code. Actually, ASCII can be considered an 8-bit code with the MSB
always 0.
23
• The first thirty-two ASCII characters are nongraphic commands that
are never printed or displayed and are used only for control purposes.
Examples of the control characters are “null,” “line feed,” “start of
text,” and “escape.”
• The other characters are graphic symbols that can be printed or
displayed and include the letters of the alphabet (lowercase and
uppercase), the ten decimal digits, punctuation signs, and other
commonly used symbols.
24
25
26
Error Detecting & Correcting
Codes
27
Error Detecting Codes
• When data is transmitted from one point to another, like in wireless
transmission, or it is just stored, like in hard disks and memories, there
are chances that data may get corrupted. To detect these data errors,
we use special codes, which are error detection codes
• Error detection is the process of detecting the errors that are present in
the data transmitted from transmitter to receiver . We use some
redundancy codes to detect these errors, by adding to the data while it
is transmitted from source (transmitter). These codes are called “Error
detecting codes”.
28
Types of Error detection
• Parity Checking
• Check Sum
• Cyclic Redundancy Check (CRC)
• Longitudinal Redundancy Check (LRC)
29
Parity Checking
• Parity bit means nothing but an additional bit added to the data at the
transmitter before transmitting the data.
• Before adding the parity bit, number of 1’s or zeros is calculated in the
data.
• Based on this calculation of data an extra bit is added to the actual
information / data.
• The addition of parity bit to the data will result in the change of data
string size.
30
• This means if we have an 8 bit data, then after adding a parity bit to
the data binary string it will become a 9 bit binary data string.
• Parity check is also called as “Vertical Redundancy Check (VRC)”.
• There is two types of parity bits in error detection, they are
a) Even parity
b) Odd parity
31
• A parity bit is attached to a group of bits to make the total number of
1s in a group always even or always odd.
• An even parity bit makes the total number of 1s even, and an odd
parity bit makes the total odd.
32
33
Limitations of Parity Error Detection
• It detects any odd number of errors. However, it cannot detect an even
number of error because such error will destroy the parity of the
transmitted group of bits.
• Other is that it cannot identify the location of erroneous bit. Thus, it
cannot correct the error.
34
Error Correcting Codes
35
Error Correcting Codes
• The codes which are used for both error detecting and error correction
are called as “Error Correction Codes”. The error correction
techniques are of two types. They are,
a) Single bit error correction
b) Burst error correction
• The process or method of correcting single bit errors is called “single
bit error correction”. The method of detecting and correcting burst
errors in the data sequence is called “Burst error correction”.
36
Hamming code
• Hamming code or Hamming Distance Code is the best error correcting
code we use in most of the communication network and digital
systems.
37
Hamming code
• This error detecting and correcting code technique is developed by
R.W.Hamming .
• This code not only identifies the error bit, in the whole data sequence
and it also corrects it.
• This code uses a number of parity bits located at certain positions in
the codeword.
• The number of parity bits depends upon the number of information
bits.
• These parity bits are placed at bit positions 2^n (n = 0, 1, 2, 3) within
the original data bits
38
39

More Related Content

What's hot

Digital notes
Digital notesDigital notes
Digital notesstivengo2
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representationAnil Pokhrel
 
Combinational circuits r011
Combinational circuits   r011Combinational circuits   r011
Combinational circuits r011arunachalamr16
 
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
 
Data Representation
Data RepresentationData Representation
Data RepresentationDilum Bandara
 
Finite word lenth effects
Finite word lenth effectsFinite word lenth effects
Finite word lenth effectstamil arasan
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codesGargiKhanna1
 
Logic design and switching theory
Logic design and switching theoryLogic design and switching theory
Logic design and switching theoryjomerson remorosa
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsSSE_AndyLi
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...Arti Parab Academics
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Asif Iqbal
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2Abdul Khan
 
Error detection & correction codes
Error detection & correction codesError detection & correction codes
Error detection & correction codesRevathi Subramaniam
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversionkanyuma jitjumnong
 
chapter one && two.pdf
chapter one && two.pdfchapter one && two.pdf
chapter one && two.pdfmiftah88
 
Binary codes
Binary codesBinary codes
Binary codesGargiKhanna1
 

What's hot (20)

Number system
Number system Number system
Number system
 
Digital notes
Digital notesDigital notes
Digital notes
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representation
 
Basics of digital electronics
Basics of digital electronicsBasics of digital electronics
Basics of digital electronics
 
Combinational circuits r011
Combinational circuits   r011Combinational circuits   r011
Combinational circuits r011
 
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
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Finite word lenth effects
Finite word lenth effectsFinite word lenth effects
Finite word lenth effects
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codes
 
Logic design and switching theory
Logic design and switching theoryLogic design and switching theory
Logic design and switching theory
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
Objective Questions Digital Electronics
Objective Questions Digital ElectronicsObjective Questions Digital Electronics
Objective Questions Digital Electronics
 
Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:Unit-1 Digital Design and Binary Numbers:
Unit-1 Digital Design and Binary Numbers:
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2
 
Error detection & correction codes
Error detection & correction codesError detection & correction codes
Error detection & correction codes
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
 
chapter one && two.pdf
chapter one && two.pdfchapter one && two.pdf
chapter one && two.pdf
 
Binary codes
Binary codesBinary codes
Binary codes
 
Number System
Number SystemNumber System
Number System
 

Similar to Digital Logic BCA TU Chapter 2.2

Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006arunachalamr16
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfUmerKhan147799
 
review of number systems and codes
review of number systems and codesreview of number systems and codes
review of number systems and codessrinu247
 
Switching theory Unit 1
Switching theory Unit 1Switching theory Unit 1
Switching theory Unit 1SURBHI SAROHA
 
DCN Error Detection & Correction
DCN Error Detection & CorrectionDCN Error Detection & Correction
DCN Error Detection & CorrectionRohan Bhatkar
 
Digital logic designing presentation
Digital logic designing presentationDigital logic designing presentation
Digital logic designing presentationHassan Hashmi
 
3F4ecc.ppt
3F4ecc.ppt3F4ecc.ppt
3F4ecc.pptAnnymus
 
Student IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptStudent IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptjohnBronson6
 
crc_checksum.pdf
crc_checksum.pdfcrc_checksum.pdf
crc_checksum.pdfssuser8b4eb21
 
Unit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxUnit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxBunnyYadav7
 
data representation
 data representation data representation
data representationHaroon_007
 
Satellite error detection and correction presentation
Satellite error detection and correction presentationSatellite error detection and correction presentation
Satellite error detection and correction presentationAhmedMuhumed2
 
Error Detection and Correction presentation
Error Detection and Correction presentation Error Detection and Correction presentation
Error Detection and Correction presentation Badrul Alam
 
Error Detection and correction concepts in Data communication and networks
Error Detection and correction concepts in Data communication and networksError Detection and correction concepts in Data communication and networks
Error Detection and correction concepts in Data communication and networksNt Arvind
 

Similar to Digital Logic BCA TU Chapter 2.2 (20)

Binary and EC codes
Binary and EC codesBinary and EC codes
Binary and EC codes
 
Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdf
 
Number codes students
Number codes studentsNumber codes students
Number codes students
 
review of number systems and codes
review of number systems and codesreview of number systems and codes
review of number systems and codes
 
Switching theory Unit 1
Switching theory Unit 1Switching theory Unit 1
Switching theory Unit 1
 
DCN Error Detection & Correction
DCN Error Detection & CorrectionDCN Error Detection & Correction
DCN Error Detection & Correction
 
Digital logic designing presentation
Digital logic designing presentationDigital logic designing presentation
Digital logic designing presentation
 
Number system
Number systemNumber system
Number system
 
3F4ecc.ppt
3F4ecc.ppt3F4ecc.ppt
3F4ecc.ppt
 
Bcd
BcdBcd
Bcd
 
Number codes
Number codesNumber codes
Number codes
 
Student IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.pptStudent IP Addressing Tutorial.ppt
Student IP Addressing Tutorial.ppt
 
crc_checksum.pdf
crc_checksum.pdfcrc_checksum.pdf
crc_checksum.pdf
 
Unit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptxUnit-1 (DLD) Lecture 2.pptx
Unit-1 (DLD) Lecture 2.pptx
 
DLD-W3-L1.pptx
DLD-W3-L1.pptxDLD-W3-L1.pptx
DLD-W3-L1.pptx
 
data representation
 data representation data representation
data representation
 
Satellite error detection and correction presentation
Satellite error detection and correction presentationSatellite error detection and correction presentation
Satellite error detection and correction presentation
 
Error Detection and Correction presentation
Error Detection and Correction presentation Error Detection and Correction presentation
Error Detection and Correction presentation
 
Error Detection and correction concepts in Data communication and networks
Error Detection and correction concepts in Data communication and networksError Detection and correction concepts in Data communication and networks
Error Detection and correction concepts in Data communication and networks
 

More from ISMT College

Time delays & counter.ppt
Time delays & counter.pptTime delays & counter.ppt
Time delays & counter.pptISMT College
 
Timing Diagram.pptx
Timing Diagram.pptxTiming Diagram.pptx
Timing Diagram.pptxISMT College
 
4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptxISMT College
 
Instruction.pdf
Instruction.pdfInstruction.pdf
Instruction.pdfISMT College
 
3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptxISMT College
 
2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptx2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptxISMT College
 
1. Introduction to Microprocessor.pptx
1. Introduction to Microprocessor.pptx1. Introduction to Microprocessor.pptx
1. Introduction to Microprocessor.pptxISMT College
 
Chapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicChapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicISMT College
 
Access Control List (ACL)
Access Control List (ACL)Access Control List (ACL)
Access Control List (ACL)ISMT College
 
Introduction to Counters
Introduction to CountersIntroduction to Counters
Introduction to CountersISMT College
 
Chapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicChapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicISMT College
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devicesISMT College
 
Basic Gates in Digital Logic
Basic Gates in Digital LogicBasic Gates in Digital Logic
Basic Gates in Digital LogicISMT College
 
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)ISMT College
 
Register in Digital Logic
Register in Digital LogicRegister in Digital Logic
Register in Digital LogicISMT College
 

More from ISMT College (17)

Attack.pptx
Attack.pptxAttack.pptx
Attack.pptx
 
Time delays & counter.ppt
Time delays & counter.pptTime delays & counter.ppt
Time delays & counter.ppt
 
Timing Diagram.pptx
Timing Diagram.pptxTiming Diagram.pptx
Timing Diagram.pptx
 
4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx
 
Instruction.pdf
Instruction.pdfInstruction.pdf
Instruction.pdf
 
3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx3. Addressing Modes in 8085 microprocessor.pptx
3. Addressing Modes in 8085 microprocessor.pptx
 
2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptx2. 8085-Microprocessor.pptx
2. 8085-Microprocessor.pptx
 
1. Introduction to Microprocessor.pptx
1. Introduction to Microprocessor.pptx1. Introduction to Microprocessor.pptx
1. Introduction to Microprocessor.pptx
 
Chapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicChapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital Logic
 
VLAN
VLANVLAN
VLAN
 
Access Control List (ACL)
Access Control List (ACL)Access Control List (ACL)
Access Control List (ACL)
 
Introduction to Counters
Introduction to CountersIntroduction to Counters
Introduction to Counters
 
Chapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital LogicChapter 1 Introduction to Digital Logic
Chapter 1 Introduction to Digital Logic
 
Programmable logic devices
Programmable logic devicesProgrammable logic devices
Programmable logic devices
 
Basic Gates in Digital Logic
Basic Gates in Digital LogicBasic Gates in Digital Logic
Basic Gates in Digital Logic
 
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
Adder & subtractor (Half adder, Full adder, Half subtractor, Full subtractor)
 
Register in Digital Logic
Register in Digital LogicRegister in Digital Logic
Register in Digital Logic
 

Recently uploaded

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(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
 
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
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
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
 
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
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
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
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
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
 

Recently uploaded (20)

Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(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...
 
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
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
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
 
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...
 
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)
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
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🔝
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
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
 
★ 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
 

Digital Logic BCA TU Chapter 2.2

  • 1. BCD, ASCII, Excess-3, Gray Code, Error Detecting & Correcting Code Slide Prepared by: Roshan Kandel 1
  • 3. Binary-Coded-Decimal (BCD) • Conversions between decimal and binary can become long and complicated for large numbers. • For example, convert 87410 to binary. The answer is 11011010102, but it takes quite a lot of time and effort to make this conversion. We call this straight binary coding. 3
  • 4. Binary-Coded-Decimal (BCD) • The Binary-Coded-Decimal (BCD) code makes conversion much easier. Each decimal digit, 0 through 9, is represented with a 4-Bit BCD code as shown below. The BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are not used. 4
  • 5. • Conversion between BCD and decimal is accomplished by replacing a 4-bit BCD for each decimal digit. For example, 87410 = 1000 0111 0100BCD. • BCD is not another number system like binary, octal, decimal and hexadecimal. It is in fact the decimal system with each digit encoded in its binary equivalent. A BCD code is not the same as a straight binary number. For example, the BCD code requires 12 bits, while the straight binary number requires only 10 bits to represent 87310. Decimal  BCD Conversion 5
  • 6. • A BCD code is converted into a decimal number by taking groups of 4 bits, starting from LSB, and replacing them with a BCD code. For example, 1 1001 0111 1000 BCD = 197810 BCD  Decimal Conversion 6
  • 7. 7 8421 BCD Code (Natural BCD Code)  Each decimal digit, 0 through 9, is coded by 4-bit binary number  8, 4, 2 and 1 weights are attached to each bit  BCD code is weighted code  1010, 1011, 1100, 1101, 1110 and 1111 are illegal codes  Less efficient than pure binary  Arithmetic operations are more complex than in pure binary  Example 1 4 0100 0001 Decimal BCD Binary 1110
  • 8. 8 Binary Codes Decimal Binary BCD 0 0 0000 1 1 0001 2 10 0010 3 11 0011 4 100 0100 5 101 0101 6 110 0110 7 111 0111 Decimal Binary BCD 8 1000 1000 9 1001 1001 10 1010 0001 0000 11 1011 0001 0001 12 1100 0001 0010 13 1101 0001 0011 14 1110 0001 0100 15 1111 0001 0101
  • 9. 9 BCD Addition  Example - 1 0 0 1 0 0 0 0 1 0 0 1 1 + 0 1 0 1 0 0 1 1 1 0 0 0 2 5 1 3 + 3 8 No carry, no illegal code. So, this is the correct sum. 1 1 1 Rule: If there is an illegal code or carry is generated as a result of addition, then add 0110 (6) to particular that 4 bits of result.
  • 10. 10 BCD Addition  Example - 2 0110 0111 1001 + .0110 679.6 536.8 + 1216.4 All are illegal codes 0101 0011 0110 .1000 1011 1010 1111 .1110 +0110 +0110 +0110 +.0110 10001 10000 10101 1.0100 1 + 1 + 1 + 1 + 0010 0001 0110 .0100 0001 Add 0110 to each Propagate carry Corrected sum 1 1 1 1
  • 11. 11 BCD Subtraction  Example - 1 0 0 1 1 0 0 0 1 0 0 1 0 - 1 0 0 0 0 1 0 1 0 0 1 1 3 8 1 5 - 2 3 No borrow. So, this is the correct difference. Rule: If one 4-bit group needs to take borrow from neighbor, then subtract 0110 from the group which is receiving borrow.
  • 12. 12 BCD Subtraction  Example - 2 0010 0000 0110 - .0111 206.7 147.8 - 58.9 Borrows are present 0001 0100 0111 .1000 0000 1011 1110 .1111 -0110 -0110 -.0110 0101 1000 .1001 Subtract 0110 Corrected difference
  • 14. The Gray Code • The Gray code is un-weighted and is not an arithmetic code; that is, there are no specific weights assigned to the bit positions. • The important feature of the Gray code is that it exhibits only a single bit change from one code word to the next in sequence • This property is important in many applications, such as shaft position encoders, where error susceptibility increases with the number of bit changes between adjacent numbers in a sequence. 14
  • 15. Table below is a listing of the 4-bit Gray code for decimal numbers 0 through 15. 15
  • 16. The Gray Code • Notice the single-bit change between successive Gray code words. • For instance, in going from decimal 3 to decimal 4, the Gray code changes from 0010 to 0110, while the binary code changes from 0011 to 0100, a change of three bits. The only bit change in the Gray code is in the third bit from the right: the other bits remain the same. 16
  • 17. Binary-to-Gray Code Conversion The following rules explain how to convert from a binary number to a Gray code word: • 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 next Gray code bit. Discard carries. 17
  • 18. Binary-to-Gray Code Conversion • For example, the conversion of the binary number 10110 to Gray code is as follows: 18
  • 19. Gray-to-Binary Code Conversion To convert from Gray code to binary, use a similar method; however, there are some differences. The following rules apply: • 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. 19
  • 20. Gray-to-Binary Code Conversion • For example, the conversion of the Gray code word 11011 to binary is as follows: 20
  • 23. ASCII • ASCII is the abbreviation for American Standard Code for Information Interchange. • Pronounced “askee,” ASCII is a universally accepted alphanumeric code used in most computers and other electronic equipment. • Most computer keyboards are standardized with the ASCII. When you enter a letter, a number, or control command, the corresponding ASCII code goes into the computer • ASCII has 128 characters and symbols represented by a 7-bit binary code. Actually, ASCII can be considered an 8-bit code with the MSB always 0. 23
  • 24. • The first thirty-two ASCII characters are nongraphic commands that are never printed or displayed and are used only for control purposes. Examples of the control characters are “null,” “line feed,” “start of text,” and “escape.” • The other characters are graphic symbols that can be printed or displayed and include the letters of the alphabet (lowercase and uppercase), the ten decimal digits, punctuation signs, and other commonly used symbols. 24
  • 25. 25
  • 26. 26
  • 27. Error Detecting & Correcting Codes 27
  • 28. Error Detecting Codes • When data is transmitted from one point to another, like in wireless transmission, or it is just stored, like in hard disks and memories, there are chances that data may get corrupted. To detect these data errors, we use special codes, which are error detection codes • Error detection is the process of detecting the errors that are present in the data transmitted from transmitter to receiver . We use some redundancy codes to detect these errors, by adding to the data while it is transmitted from source (transmitter). These codes are called “Error detecting codes”. 28
  • 29. Types of Error detection • Parity Checking • Check Sum • Cyclic Redundancy Check (CRC) • Longitudinal Redundancy Check (LRC) 29
  • 30. Parity Checking • Parity bit means nothing but an additional bit added to the data at the transmitter before transmitting the data. • Before adding the parity bit, number of 1’s or zeros is calculated in the data. • Based on this calculation of data an extra bit is added to the actual information / data. • The addition of parity bit to the data will result in the change of data string size. 30
  • 31. • This means if we have an 8 bit data, then after adding a parity bit to the data binary string it will become a 9 bit binary data string. • Parity check is also called as “Vertical Redundancy Check (VRC)”. • There is two types of parity bits in error detection, they are a) Even parity b) Odd parity 31
  • 32. • A parity bit is attached to a group of bits to make the total number of 1s in a group always even or always odd. • An even parity bit makes the total number of 1s even, and an odd parity bit makes the total odd. 32
  • 33. 33
  • 34. Limitations of Parity Error Detection • It detects any odd number of errors. However, it cannot detect an even number of error because such error will destroy the parity of the transmitted group of bits. • Other is that it cannot identify the location of erroneous bit. Thus, it cannot correct the error. 34
  • 36. Error Correcting Codes • The codes which are used for both error detecting and error correction are called as “Error Correction Codes”. The error correction techniques are of two types. They are, a) Single bit error correction b) Burst error correction • The process or method of correcting single bit errors is called “single bit error correction”. The method of detecting and correcting burst errors in the data sequence is called “Burst error correction”. 36
  • 37. Hamming code • Hamming code or Hamming Distance Code is the best error correcting code we use in most of the communication network and digital systems. 37
  • 38. Hamming code • This error detecting and correcting code technique is developed by R.W.Hamming . • This code not only identifies the error bit, in the whole data sequence and it also corrects it. • This code uses a number of parity bits located at certain positions in the codeword. • The number of parity bits depends upon the number of information bits. • These parity bits are placed at bit positions 2^n (n = 0, 1, 2, 3) within the original data bits 38
  • 39. 39