SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
4/9/2012
1
Digital Logic & Design
Dr. Sajjad Ahmed Nadeem
Department of Computer Science & IT
University of Azad Jammu & Kashmir
Muzaffarabad
Module 03
Computer Codes.
BCD.
EBCDIC.
ASCII.
Assignment-2
4/9/2012
2
Data Types
Computer Codes (1)
4/9/2012
3
Computer Codes (2)
Binary-Coded Decimal (BCD)
Four bits per digit Digit Bit pattern
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Note: the following bit
patterns are not used:
1010
1011
1100
1101
1110
1111
4/9/2012
4
Example
709310 = ? (in BCD)
7 0 9 3
0111 0000 1001 0011
Chapter 1 8
Warning: Conversion or Coding?
Do NOT mix up conversion of a decimal
number to a binary number with coding a
decimal number with a BINARY CODE.
1310 = 11012 (This is conversion)
13 ⇔ 0001|0011 (This is coding)
4/9/2012
5
Addition-Example-1
410 0100
+510 +0101
_________________
910 1001
410 0100
+810 +1000
_________________
1100
+0110
_________________
1210 1 0010
Addition-Example-2
1 1
18410 0001 1000 0100
+57610 0101 0111 0110
______________________________________________
Binary Sum 0111 10000 1010
Add 6 0110 0110
______________________________________________
76010 0111 0110 0000
4/9/2012
6
Other Decimal Codes-Binary Codes for
Decimal Digits
Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray
0 0000 0011 0000 0000
1 0001 0100 0111 0100
2 0010 0101 0110 0101
3 0011 0110 0101 0111
4 0100 0111 0100 0110
5 0101 1000 1011 0010
6 0110 1001 1010 0011
7 0111 1010 1001 0001
8 1000 1011 1000 1001
9 1001 1100 1111 1000
BCD
2421
0000
0001
0010
0011
0100
1011
1100
1101
1110
1111
Other Decimal Codes-Binary Codes for Decimal Digits
• Excess-3
• Is unweighted code
• Is obtained from the corresponding values + 3
• has been used in some older computers.
• Some digits in 2421 can be coded in two possible
ways e.g. 4 = 0100 and 4=1010
4/9/2012
7
13
What special property does the Gray code
have in relation to adjacent decimal digits?
GRAY CODE – Decimal
Decimal 8,4,2,1 Gray
0 0000 0000
1 0001 0100
2 0010 0101
3 0011 0111
4 0100 0110
5 0101 0010
6 0110 0011
7 0111 0001
8 1000 1001
9 1001 1000
EBCDIC
Extended BCD Interchange Code
8-bit code (28 = 256 different characters)
Developed by IBM
Rarely used today
IBM mainframes only
4/9/2012
8
Coding of Alphabetic and Numeric
Characters in EBCDIC
Coding of Alphabetic and Numeric
Characters in EBCDIC
4/9/2012
9
EBCDIC
The Problem
Representing text strings, such as
“Hello, world”, in a computer
4/9/2012
10
ASCII
ASCII-7 Features
7-bit code
8th bit is unused (or used for a parity bit)
27 = 128 codes
Two general types of codes:
◦ 95 are “Graphic” codes (displayable on a
console)
◦ 33 are “Control” codes (control features of
the console or communications channel)
4/9/2012
11
ASCII-7 Chart
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
4/9/2012
12
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Most significant bit
Least significant bit
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
e.g., ‘a’ = 1100001
4/9/2012
13
95 Graphic codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
33 Control codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
4/9/2012
14
Alphabetic codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Numeric codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
4/9/2012
15
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Punctuation, etc.
“Hello, world” Example
=
=
=
=
=
=
=
=
=
=
=
=
Binary
01001000
01100101
01101100
01101100
01101111
00101100
00100000
01110111
01100111
01110010
01101100
01100100
Hexadecimal
48
65
6C
6C
6F
2C
20
77
67
72
6C
64
Decimal
72
101
108
108
111
44
32
119
103
114
108
100
H
e
l
l
o
,
w
o
r
l
d
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
4/9/2012
16
Common Control Codes
CR 0D carriage return
LF 0A line feed
HT 09 horizontal tab
DEL 7F delete
NULL 00 null
Hexadecimal code
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
4/9/2012
17
Terminology
Learn the names of the special symbols
◦ [ ] brackets
◦ { } braces
◦ ( ) parentheses
◦ @ commercial ‘at’ sign
◦ & ampersand
◦ ~ tilde
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
4/9/2012
18
Coding of Alphabetic and Numeric
Characters in ASCII
Coding of Alphabetic and Numeric
Characters in ASCII
4/9/2012
19
Coding of Alphabetic and Numeric
Characters in ASCII
PARITY BIT 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.
4/9/2012
20
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 -
Assignment-2
BCD subtraction
UNICODE

Mais conteúdo relacionado

Destaque (20)

Dld lecture module 02
Dld lecture module 02Dld lecture module 02
Dld lecture module 02
 
Uncdtalk
UncdtalkUncdtalk
Uncdtalk
 
Chapter10
Chapter10Chapter10
Chapter10
 
Dld lecture module 06
Dld lecture module 06Dld lecture module 06
Dld lecture module 06
 
Basic+machine+organization
Basic+machine+organizationBasic+machine+organization
Basic+machine+organization
 
Dld lecture module 01
Dld lecture module 01Dld lecture module 01
Dld lecture module 01
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Dld lecture module 05
Dld lecture module 05Dld lecture module 05
Dld lecture module 05
 
Algorithm defination, design & Implementation
Algorithm defination, design & ImplementationAlgorithm defination, design & Implementation
Algorithm defination, design & Implementation
 
Good
GoodGood
Good
 
Dld lecture module 04 01
Dld lecture module 04  01Dld lecture module 04  01
Dld lecture module 04 01
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Internet
InternetInternet
Internet
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
An introduction to software
An introduction to softwareAn introduction to software
An introduction to software
 
Notes of programming
Notes of programmingNotes of programming
Notes of programming
 
Boolean+logic
Boolean+logicBoolean+logic
Boolean+logic
 
Computer networks
Computer networksComputer networks
Computer networks
 

Semelhante a Dld lecture module 03

1401-ROYAL-VISTAWAY-A-2.0
1401-ROYAL-VISTAWAY-A-2.01401-ROYAL-VISTAWAY-A-2.0
1401-ROYAL-VISTAWAY-A-2.0
Tessa Hewlett
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mp
MSc CST
 

Semelhante a Dld lecture module 03 (20)

Codes
CodesCodes
Codes
 
Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021Demystifying Unicode - Longhorn PHP 2021
Demystifying Unicode - Longhorn PHP 2021
 
Buffer Overflows Presentation
Buffer Overflows PresentationBuffer Overflows Presentation
Buffer Overflows Presentation
 
Number system | Representation and conversion | low level programming
Number system | Representation and conversion | low level programmingNumber system | Representation and conversion | low level programming
Number system | Representation and conversion | low level programming
 
1401-ROYAL-VISTAWAY-A-2.0
1401-ROYAL-VISTAWAY-A-2.01401-ROYAL-VISTAWAY-A-2.0
1401-ROYAL-VISTAWAY-A-2.0
 
Week 5 - Number Systems.pdf
Week 5 - Number Systems.pdfWeek 5 - Number Systems.pdf
Week 5 - Number Systems.pdf
 
Computer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption StandardComputer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption Standard
 
Computer archi&mp
Computer archi&mpComputer archi&mp
Computer archi&mp
 
3rd Semester (Dec; Jan-2016) Civil Engineering Question Paper
3rd Semester (Dec; Jan-2016) Civil Engineering Question Paper3rd Semester (Dec; Jan-2016) Civil Engineering Question Paper
3rd Semester (Dec; Jan-2016) Civil Engineering Question Paper
 
6th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
6th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...6th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
6th Semeste Electronics and Communication Engineering (Dec-2015; Jan-2016) Qu...
 
Fadal 104D Wiring Diagram - ITSCNC.com
Fadal 104D Wiring Diagram - ITSCNC.comFadal 104D Wiring Diagram - ITSCNC.com
Fadal 104D Wiring Diagram - ITSCNC.com
 
CAT-320DL-Electrical-Schematic.pdf
CAT-320DL-Electrical-Schematic.pdfCAT-320DL-Electrical-Schematic.pdf
CAT-320DL-Electrical-Schematic.pdf
 
Information sheet/Kertas Penerangan
Information sheet/Kertas PeneranganInformation sheet/Kertas Penerangan
Information sheet/Kertas Penerangan
 
ipad2 full Schematic Diagram
ipad2 full Schematic Diagramipad2 full Schematic Diagram
ipad2 full Schematic Diagram
 
I pad 2 full schematic diagram
I pad 2 full schematic diagramI pad 2 full schematic diagram
I pad 2 full schematic diagram
 
Theory and Methods for Unsupervised Anomaly Detection in Sounds Based on Deep...
Theory and Methods for Unsupervised Anomaly Detection in Sounds Based on Deep...Theory and Methods for Unsupervised Anomaly Detection in Sounds Based on Deep...
Theory and Methods for Unsupervised Anomaly Detection in Sounds Based on Deep...
 
11-PLDs.pdf
11-PLDs.pdf11-PLDs.pdf
11-PLDs.pdf
 
Assembler Numerical in system programming
Assembler Numerical in system programmingAssembler Numerical in system programming
Assembler Numerical in system programming
 
เซตและระบบจำนวนจริง
เซตและระบบจำนวนจริงเซตและระบบจำนวนจริง
เซตและระบบจำนวนจริง
 
Digital Notes
Digital NotesDigital Notes
Digital Notes
 

Mais de Bilal Maqbool ツ

Mais de Bilal Maqbool ツ (19)

Lecture 3 report writtng
Lecture 3 report writtngLecture 3 report writtng
Lecture 3 report writtng
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1 report writing
Lecture 1 report writingLecture 1 report writing
Lecture 1 report writing
 
Bill gates
Bill gatesBill gates
Bill gates
 
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 02    (bilal maqbool 10) 2011Programming assignment 02    (bilal maqbool 10) 2011
Programming assignment 02 (bilal maqbool 10) 2011
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
 
Internet presentation
Internet presentationInternet presentation
Internet presentation
 
Presentation internet programming report
Presentation internet programming reportPresentation internet programming report
Presentation internet programming report
 
Magnetic storage devices
Magnetic storage devicesMagnetic storage devices
Magnetic storage devices
 
How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...
 
Math assignment Program
Math assignment ProgramMath assignment Program
Math assignment Program
 
Final of sentences PPT
Final of sentences PPTFinal of sentences PPT
Final of sentences PPT
 
Advantages and disadvantages of LCD
Advantages and disadvantages of LCDAdvantages and disadvantages of LCD
Advantages and disadvantages of LCD
 
A history of windows
A history of windowsA history of windows
A history of windows
 
Lcd
LcdLcd
Lcd
 
Bluetooth 27 01-12 PPT
Bluetooth 27 01-12 PPTBluetooth 27 01-12 PPT
Bluetooth 27 01-12 PPT
 
Bluetooth PPT Report
Bluetooth PPT ReportBluetooth PPT Report
Bluetooth PPT Report
 
Computing assignment 02 ms access (bilal maqbool 10) se-i
Computing assignment 02   ms access (bilal maqbool 10)          se-iComputing assignment 02   ms access (bilal maqbool 10)          se-i
Computing assignment 02 ms access (bilal maqbool 10) se-i
 
Bilal maqbool assignment no.01 computing
Bilal maqbool assignment no.01 computingBilal maqbool assignment no.01 computing
Bilal maqbool assignment no.01 computing
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

Dld lecture module 03

  • 1. 4/9/2012 1 Digital Logic & Design Dr. Sajjad Ahmed Nadeem Department of Computer Science & IT University of Azad Jammu & Kashmir Muzaffarabad Module 03 Computer Codes. BCD. EBCDIC. ASCII. Assignment-2
  • 3. 4/9/2012 3 Computer Codes (2) Binary-Coded Decimal (BCD) Four bits per digit Digit Bit pattern 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Note: the following bit patterns are not used: 1010 1011 1100 1101 1110 1111
  • 4. 4/9/2012 4 Example 709310 = ? (in BCD) 7 0 9 3 0111 0000 1001 0011 Chapter 1 8 Warning: Conversion or Coding? Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE. 1310 = 11012 (This is conversion) 13 ⇔ 0001|0011 (This is coding)
  • 5. 4/9/2012 5 Addition-Example-1 410 0100 +510 +0101 _________________ 910 1001 410 0100 +810 +1000 _________________ 1100 +0110 _________________ 1210 1 0010 Addition-Example-2 1 1 18410 0001 1000 0100 +57610 0101 0111 0110 ______________________________________________ Binary Sum 0111 10000 1010 Add 6 0110 0110 ______________________________________________ 76010 0111 0110 0000
  • 6. 4/9/2012 6 Other Decimal Codes-Binary Codes for Decimal Digits Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray 0 0000 0011 0000 0000 1 0001 0100 0111 0100 2 0010 0101 0110 0101 3 0011 0110 0101 0111 4 0100 0111 0100 0110 5 0101 1000 1011 0010 6 0110 1001 1010 0011 7 0111 1010 1001 0001 8 1000 1011 1000 1001 9 1001 1100 1111 1000 BCD 2421 0000 0001 0010 0011 0100 1011 1100 1101 1110 1111 Other Decimal Codes-Binary Codes for Decimal Digits • Excess-3 • Is unweighted code • Is obtained from the corresponding values + 3 • has been used in some older computers. • Some digits in 2421 can be coded in two possible ways e.g. 4 = 0100 and 4=1010
  • 7. 4/9/2012 7 13 What special property does the Gray code have in relation to adjacent decimal digits? GRAY CODE – Decimal Decimal 8,4,2,1 Gray 0 0000 0000 1 0001 0100 2 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1001 1000 EBCDIC Extended BCD Interchange Code 8-bit code (28 = 256 different characters) Developed by IBM Rarely used today IBM mainframes only
  • 8. 4/9/2012 8 Coding of Alphabetic and Numeric Characters in EBCDIC Coding of Alphabetic and Numeric Characters in EBCDIC
  • 9. 4/9/2012 9 EBCDIC The Problem Representing text strings, such as “Hello, world”, in a computer
  • 10. 4/9/2012 10 ASCII ASCII-7 Features 7-bit code 8th bit is unused (or used for a parity bit) 27 = 128 codes Two general types of codes: ◦ 95 are “Graphic” codes (displayable on a console) ◦ 33 are “Control” codes (control features of the console or communications channel)
  • 11. 4/9/2012 11 ASCII-7 Chart 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL
  • 12. 4/9/2012 12 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL Most significant bit Least significant bit 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL e.g., ‘a’ = 1100001
  • 13. 4/9/2012 13 95 Graphic codes 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL 33 Control codes 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL
  • 14. 4/9/2012 14 Alphabetic codes 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL Numeric codes 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL
  • 15. 4/9/2012 15 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL Punctuation, etc. “Hello, world” Example = = = = = = = = = = = = Binary 01001000 01100101 01101100 01101100 01101111 00101100 00100000 01110111 01100111 01110010 01101100 01100100 Hexadecimal 48 65 6C 6C 6F 2C 20 77 67 72 6C 64 Decimal 72 101 108 108 111 44 32 119 103 114 108 100 H e l l o , w o r l d = = = = = = = = = = = = = = = = = = = = = = = =
  • 16. 4/9/2012 16 Common Control Codes CR 0D carriage return LF 0A line feed HT 09 horizontal tab DEL 7F delete NULL 00 null Hexadecimal code 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL
  • 17. 4/9/2012 17 Terminology Learn the names of the special symbols ◦ [ ] brackets ◦ { } braces ◦ ( ) parentheses ◦ @ commercial ‘at’ sign ◦ & ampersand ◦ ~ tilde 000 001 010 011 100 101 110 111 0000 NULL DLE 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 " 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EDT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ' 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 SO RS . > N ^ n ~ 1111 SI US / ? O _ o DEL
  • 18. 4/9/2012 18 Coding of Alphabetic and Numeric Characters in ASCII Coding of Alphabetic and Numeric Characters in ASCII
  • 19. 4/9/2012 19 Coding of Alphabetic and Numeric Characters in ASCII PARITY BIT 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.
  • 20. 4/9/2012 20 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 - Assignment-2 BCD subtraction UNICODE