SlideShare a Scribd company logo
Information Science in Action
Week 3: Codes
Spring 2024
Valentinus Roby HANANTO
College of Information Science and Engineering
Ritsumeikan University
2
Today’s class outline
l Previous lecture overview
– Number systems: decimal, binary, octal, hexadecimal
– Binary arithmetic: addition, subtraction, multiplication,
division
l BSD code
l Gray code
l Hamming code
l ASCII code
3
l Digital circuits use binary signals but are required
to handle data which may be alphabetic, numeric,
or special characters.
l Hence the signals that are available in some other
form other than binary have to be converted into
suitable binary form before they can be processed
further by digital circuits.
l To achieve this, a process of coding is required
where each letter, special character, or numeral is
coded in a unique combination of 0s and 1s using
a coding scheme known as code.
Introduction
4
l In digital systems a variety of codes are used to
serve different purposes, such as data entry,
arithmetic operation, error detection and
correction, etc.
l Selection of a particular code depends on the
requirement.
l Even in a single digital system a number of
different codes may be used for different
operations, and it may even be necessary to
convert data from one type of code to another.
Introduction
5
l The full form of BCD is ‘Binary-Coded Decimal.’
Since this is a coding scheme relating decimal
and binary numbers, four bits are required to code
each decimal number.
l For example, (35)10 is represented as 0011 0101
using BCD code, rather than (100011)2.
l From the example it is clear that it requires a
greater number of bits to code a decimal number
using BCD code than using the straight binary
code.
l However, in spite of this disadvantage it is
convenient to use BCD code for input and output
operations in digital systems.
Binary coding: BCD
6
l I/O equipment of modern computers mostly deals
with decimal digits, while computing is realized in
binary codes.
l The easiest way is to code each decimal digit
separately by a binary equivalent, e.g.
l The above coding is called as binary-coded-
decimal (BCD)
Binary coding: BCD
7
l BCD: 8-4-2-1
BCD
8
l BCD: 8-4-2-1
BCD
9
l BCD: 8-4-2-1
l 6-3-1-1
6-3-1-1
10
l BCD: 8-4-2-1
l 6-3-1-1
l Excess-3: BCD plus 3 to each code
Excess-3
11
l BCD: 8-4-2-1
l 6-3-1-1
l Excess-3: BCD plus 3 to each code
Excess-3
12
l Gray code belongs to a class of code known
as minimum change code, in which a number
changes by only one bit as it proceeds from
one number to the next.
l Hence this code is not useful for arithmetic
operations. This code finds extensive use for
position encoders to minimize errors.
Gray code
13
Gray code
14
l Convert binary to gray code
– Gray code belongs to a class of code known as
minimum change code
– the MSB of the Gray code is the same as the
MSB of the binary number
– the second bit next to the MSB of the Gray code
equals the Ex-OR of the MSB and second bit of
the binary number; it will be 0 if there are same
binary bits or it will be 1 for different binary bits;
– the third bit for Gray code equals the exclusive-
OR of the second and third bits of the binary
number, and similarly all the next lower order bits
follow the same mechanism.
Gray code
0⊕0=0,1⊕0=1,0⊕1=1,1⊕1=0
15
Gray code
16
Gray code
17
Gray code
18
l Convert gray code to binary
– the MSB of the binary number is the same as the
MSB of the Gray code;
– the second bit next to the MSB of the binary
number equals the Ex-OR of the MSB of the
binary number and second bit of the Gray code; it
will be 0 if there are same binary bits or it will be 1
for different binary bits;
– the third bit for the binary number equals the
exclusive-OR of the second bit of the binary
number and third bit of the Gray code, and
similarly all the next lower order bits follow the
same mechanism.
Gray code
19
Gray code
20
Gray code
21
l Data can be corrupted during transmission. For
reliable communication, errors must be detected and
corrected.
l Developed by R. W. Hamming where one or more
parity bits are added to a data character
methodically in order to detect and correct errors.
Hamming code
22
Hamming code
l Encoding: from binary to Hamming code
23
Hamming code
24
Hamming code
l Decoding: from Hamming code to binary
25
Hamming code
26
Hamming code
27
Hamming code
28
l ASCII : American Standard Code for Information
Interchange
l We need to code not only digits, but also symbols,
letters, signs
l Originally, 7-bit code (128 symbols can be coded),
fragment of code:
ASCII code
29
l BCD: 8-4-2-1
l 6-3-1-1
l Excess-3 : BCD plus 3 to each code
l Gray code
l Hamming code
l ASCII code
Summary
30
l Basic Boolean operators
–NOT, AND, OR
l Boolean functions
l DeMorgan's theorem
l Logic gates
Next class

More Related Content

PDF
Binary_Codes.pdfhfkhvfkdhvbhfvfdhfgffhfdhyf
PPTX
DE and LD [Autosave gyideffgfd] (1).pptx
PPTX
BCDCONVERTER.pptx
PPTX
Digital Logic-Lecture19.pptx
PDF
Reed Solomon Coding For Error Detection and Correction
PPTX
Introduction to Computer Logical Organization
PPTX
Reed solomon code
PDF
Lecture5 Chapter1- Binary Codes.pdf
Binary_Codes.pdfhfkhvfkdhvbhfvfdhfgffhfdhyf
DE and LD [Autosave gyideffgfd] (1).pptx
BCDCONVERTER.pptx
Digital Logic-Lecture19.pptx
Reed Solomon Coding For Error Detection and Correction
Introduction to Computer Logical Organization
Reed solomon code
Lecture5 Chapter1- Binary Codes.pdf

Similar to Information Science in Action Week 3 Codes (20)

PPTX
Digital Logic BCA TU Chapter 2.2
PPTX
analog ppt on diffderent types of codes.pptx
PDF
CODES_2.elictronicjajajajsjjsjdjdjcjdjjsksjs
PPTX
Switching theory Unit 1
PDF
Unit 1 Class Notes Printed digital Electronics.pdf
DOCX
Manoch1raw 160512091436
PDF
International Journal of Computational Engineering Research(IJCER)
PPTX
Reed Soloman and convolution codes
PPTX
Digital Electronics - Logic Gates Lectures-2.pptx
PPTX
Implementation of reed solomon codes basics
PDF
Binary to gray converter using xor
PPTX
lec5_13.pptx
PPTX
Digital Fundamental - Binary Codes-Logic Gates
PPTX
unit 1 introudction of the file and sepm
PDF
C04922125
PPT
Unit-4_Bus_Encoding_Part_1.ppt
PPTX
Combinational Circuits digital design logic
PPTX
Digital electronica RSS vvvdmsASmCMmmmmmcdsdvfssc
PDF
Csc 2313 (lecture 3)
PDF
Csc 2313 (lecture 3)
Digital Logic BCA TU Chapter 2.2
analog ppt on diffderent types of codes.pptx
CODES_2.elictronicjajajajsjjsjdjdjcjdjjsksjs
Switching theory Unit 1
Unit 1 Class Notes Printed digital Electronics.pdf
Manoch1raw 160512091436
International Journal of Computational Engineering Research(IJCER)
Reed Soloman and convolution codes
Digital Electronics - Logic Gates Lectures-2.pptx
Implementation of reed solomon codes basics
Binary to gray converter using xor
lec5_13.pptx
Digital Fundamental - Binary Codes-Logic Gates
unit 1 introudction of the file and sepm
C04922125
Unit-4_Bus_Encoding_Part_1.ppt
Combinational Circuits digital design logic
Digital electronica RSS vvvdmsASmCMmmmmmcdsdvfssc
Csc 2313 (lecture 3)
Csc 2313 (lecture 3)
Ad

Recently uploaded (20)

PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPT
ISS -ESG Data flows What is ESG and HowHow
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
Business Analytics and business intelligence.pdf
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PPTX
1_Introduction to advance data techniques.pptx
PDF
Foundation of Data Science unit number two notes
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
Database Infoormation System (DBIS).pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Business Acumen Training GuidePresentation.pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
IBA_Chapter_11_Slides_Final_Accessible.pptx
ISS -ESG Data flows What is ESG and HowHow
Galatica Smart Energy Infrastructure Startup Pitch Deck
Business Analytics and business intelligence.pdf
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Qualitative Qantitative and Mixed Methods.pptx
1_Introduction to advance data techniques.pptx
Foundation of Data Science unit number two notes
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Data_Analytics_and_PowerBI_Presentation.pptx
Miokarditis (Inflamasi pada Otot Jantung)
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Database Infoormation System (DBIS).pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Business Acumen Training GuidePresentation.pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Reliability_Chapter_ presentation 1221.5784
Microsoft-Fabric-Unifying-Analytics-for-the-Modern-Enterprise Solution.pptx
Ad

Information Science in Action Week 3 Codes

  • 1. Information Science in Action Week 3: Codes Spring 2024 Valentinus Roby HANANTO College of Information Science and Engineering Ritsumeikan University
  • 2. 2 Today’s class outline l Previous lecture overview – Number systems: decimal, binary, octal, hexadecimal – Binary arithmetic: addition, subtraction, multiplication, division l BSD code l Gray code l Hamming code l ASCII code
  • 3. 3 l Digital circuits use binary signals but are required to handle data which may be alphabetic, numeric, or special characters. l Hence the signals that are available in some other form other than binary have to be converted into suitable binary form before they can be processed further by digital circuits. l To achieve this, a process of coding is required where each letter, special character, or numeral is coded in a unique combination of 0s and 1s using a coding scheme known as code. Introduction
  • 4. 4 l In digital systems a variety of codes are used to serve different purposes, such as data entry, arithmetic operation, error detection and correction, etc. l Selection of a particular code depends on the requirement. l Even in a single digital system a number of different codes may be used for different operations, and it may even be necessary to convert data from one type of code to another. Introduction
  • 5. 5 l The full form of BCD is ‘Binary-Coded Decimal.’ Since this is a coding scheme relating decimal and binary numbers, four bits are required to code each decimal number. l For example, (35)10 is represented as 0011 0101 using BCD code, rather than (100011)2. l From the example it is clear that it requires a greater number of bits to code a decimal number using BCD code than using the straight binary code. l However, in spite of this disadvantage it is convenient to use BCD code for input and output operations in digital systems. Binary coding: BCD
  • 6. 6 l I/O equipment of modern computers mostly deals with decimal digits, while computing is realized in binary codes. l The easiest way is to code each decimal digit separately by a binary equivalent, e.g. l The above coding is called as binary-coded- decimal (BCD) Binary coding: BCD
  • 9. 9 l BCD: 8-4-2-1 l 6-3-1-1 6-3-1-1
  • 10. 10 l BCD: 8-4-2-1 l 6-3-1-1 l Excess-3: BCD plus 3 to each code Excess-3
  • 11. 11 l BCD: 8-4-2-1 l 6-3-1-1 l Excess-3: BCD plus 3 to each code Excess-3
  • 12. 12 l Gray code belongs to a class of code known as minimum change code, in which a number changes by only one bit as it proceeds from one number to the next. l Hence this code is not useful for arithmetic operations. This code finds extensive use for position encoders to minimize errors. Gray code
  • 14. 14 l Convert binary to gray code – Gray code belongs to a class of code known as minimum change code – the MSB of the Gray code is the same as the MSB of the binary number – the second bit next to the MSB of the Gray code equals the Ex-OR of the MSB and second bit of the binary number; it will be 0 if there are same binary bits or it will be 1 for different binary bits; – the third bit for Gray code equals the exclusive- OR of the second and third bits of the binary number, and similarly all the next lower order bits follow the same mechanism. Gray code 0⊕0=0,1⊕0=1,0⊕1=1,1⊕1=0
  • 18. 18 l Convert gray code to binary – the MSB of the binary number is the same as the MSB of the Gray code; – the second bit next to the MSB of the binary number equals the Ex-OR of the MSB of the binary number and second bit of the Gray code; it will be 0 if there are same binary bits or it will be 1 for different binary bits; – the third bit for the binary number equals the exclusive-OR of the second bit of the binary number and third bit of the Gray code, and similarly all the next lower order bits follow the same mechanism. Gray code
  • 21. 21 l Data can be corrupted during transmission. For reliable communication, errors must be detected and corrected. l Developed by R. W. Hamming where one or more parity bits are added to a data character methodically in order to detect and correct errors. Hamming code
  • 22. 22 Hamming code l Encoding: from binary to Hamming code
  • 25. l Decoding: from Hamming code to binary 25 Hamming code
  • 28. 28 l ASCII : American Standard Code for Information Interchange l We need to code not only digits, but also symbols, letters, signs l Originally, 7-bit code (128 symbols can be coded), fragment of code: ASCII code
  • 29. 29 l BCD: 8-4-2-1 l 6-3-1-1 l Excess-3 : BCD plus 3 to each code l Gray code l Hamming code l ASCII code Summary
  • 30. 30 l Basic Boolean operators –NOT, AND, OR l Boolean functions l DeMorgan's theorem l Logic gates Next class