Download presentation
Presentation is loading. Please wait.
Published byAngela Simon Modified over 9 years ago
1
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT
2
The necessity and advantages of coding The variety of coding systems You will learn: 2
3
He/She can justify the need of coding 3 Coding can be defined as the integrity of strict rules between two clusters In other words, representing any member of a cluster by a code The advantage of coding The simplicity of arithmetic operations Helps to discover errors Helps to recover from errors Better performance for memory operations Better understanding of data operations Coding can be defined as the integrity of strict rules between two clusters In other words, representing any member of a cluster by a code The advantage of coding The simplicity of arithmetic operations Helps to discover errors Helps to recover from errors Better performance for memory operations Better understanding of data operations
4
He/She can justify the need of coding 4 Numeric Codes 1,2,3,4,5,6…. Examples: BCD, 8 4 -2 -1, 2 4 2 1, +3Code, Gray and Parity Alphanumeric Codes 1,2,3,A,B,C,+,%,&,/, (, ) …… Examples: ASCII, Unicode Numeric Codes 1,2,3,4,5,6…. Examples: BCD, 8 4 -2 -1, 2 4 2 1, +3Code, Gray and Parity Alphanumeric Codes 1,2,3,A,B,C,+,%,&,/, (, ) …… Examples: ASCII, Unicode
5
He/She can justify the need of coding 5 BCD Coding : Binary Coded Decimal The decimal numbers are represented as 4-bit binary numbers BCD Coding : Binary Coded Decimal The decimal numbers are represented as 4-bit binary numbers Digit BCD Code 00000 10001 20010 ….….. 70111 81000 91001 Examples BCD Code 100001 0000 230010 0011 1220001 0010 0010 871000 0111 2340010 0011 0100 8971000 1001 0111 1000001 0000 0000
6
He/She can justify the need of coding 6 Example-1: Convert (1001 0011 0110) BCD into decimal 1001 -> 9, 0011-> 3, 0110-> 6 Example-2: Convert (0001 1000 0101 0100) BCD into decimal 0001 -> 1, 1000-> 8, 0101-> 5, 0100->4 Example-1: Convert (1001 0011 0110) BCD into decimal 1001 -> 9, 0011-> 3, 0110-> 6 Example-2: Convert (0001 1000 0101 0100) BCD into decimal 0001 -> 1, 1000-> 8, 0101-> 5, 0100->4
7
He/She can justify the need of coding 7 8 4 -2 -1 2 3 2 2 -2 1 -2 0 8 4 -2 -1 2 3 2 2 -2 1 -2 0 Decimal8 4 -2 -1 code 00000 10111 20110 30101 40100 51011 61010 71001 81000 91111 Examples Decimal 8 4 -2 -1 code 2750110 1001 1011 230110 0101 1220111 0110 0110 8971000 1111 1001
8
He/She can justify the need of coding 8 Decimal2 4 2 1 code 00000 10001 20010 30011 40100 51011 61100 71101 81110 91111 Examples Decimal 2 4 2 1 code 2750110 1001 1011 230110 0101 1220111 0110 0110 8971000 1111 1001
9
He/She can justify the need of coding 9 The primary advantage of +3 coding over non-biased coding is that a decimal number can be nines' complemented (for subtraction) as easily as a binary number can be ones' complemented; just invert all bits. In addition, when the sum of two +3 digits is greater than 9, the carry bit of a four bit adder will be set high. This works because, when adding two numbers that are greater than or equal to zero, an "excess" value of six results in the sum. Since a four bit integer can only hold values 0 to 15, an excess of six means that any sum over nine will overflow. https://www.youtube.com/watch?v=MXGZ 4wXM7_M 0: 0011 1: 0100 2: 0101 3: 0110 4: 0111 5: 1000 6: 1001 7: 1010 8: 1011 9: 1100
10
He/She can justify the need of coding 10 Gray coding has no radix weight Gray code cannot be used in arithmetic operations It reduces error in control signals since it is based on columns Gray code can be converted easily into binary and vice versa Gray coding has no radix weight Gray code cannot be used in arithmetic operations It reduces error in control signals since it is based on columns Gray code can be converted easily into binary and vice versa
11
He/She can justify the need of coding 11
12
12
13
13
14
He/She can justify the need of coding 14 0 0 1 0 0 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 sensors Binary coded: 111 110 000 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 0 mis-aligned sensors 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 mis-aligned sensors Gray coded: 111 101
15
He/She can justify the need of coding 15 Computers also handle textual data. Character set frequently used: alphabets: ‘A’ … ‘Z’, ‘a’ … ‘z’ digits:‘0’ … ‘9’ special symbols: ‘$’, ‘.’, ‘@’, ‘*’, etc. non-printable:NULL, BELL, CR, etc. Examples – ASCII (8 bits), Unicode (8-bit, 16-bit, and 32-bit)
16
He/She can justify the need of coding 16 ASCII American Standard Code for Information Interchange 7 bits, plus a parity bit for error detection Odd or even parity 8-bit extended ASCII: code pages for different languages
17
He/She can justify the need of coding 17 Parity bit – Even parity: additional bit added to make total number of 1’s even. – Odd parity: additional bit added to make total number of 1’s odd. Example of odd parity on ASCII values. Parity bits
18
He/She can justify the need of coding 18 Parity bit can detect odd number of errors but not even number of errors. – Example: Assume odd parity, 10011 10001 (detected) 10011 10101 (not detected) Parity bits can also be applied to a block of data. Column-wise parity Row-wise parity
19
19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.