Assoc. Prof. Dr. Ahmet Turan ÖZCERİT
The necessity and advantages of coding The variety of coding systems You will learn: 2
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
He/She can justify the need of coding 4 Numeric Codes 1,2,3,4,5,6…. Examples: BCD, , , +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, , , +3Code, Gray and Parity Alphanumeric Codes 1,2,3,A,B,C,+,%,&,/, (, ) …… Examples: ASCII, Unicode
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 ….… Examples BCD Code
He/She can justify the need of coding 6 Example-1: Convert ( ) BCD into decimal > 9, 0011-> 3, 0110-> 6 Example-2: Convert ( ) BCD into decimal > 1, 1000-> 8, 0101-> 5, 0100->4 Example-1: Convert ( ) BCD into decimal > 9, 0011-> 3, 0110-> 6 Example-2: Convert ( ) BCD into decimal > 1, 1000-> 8, 0101-> 5, 0100->4
He/She can justify the need of coding 7 Decimal code Examples Decimal code
He/She can justify the need of coding 8 Decimal code Examples Decimal code
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. 4wXM7_M 0: : : : : : : : : : 1100
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
He/She can justify the need of coding 11
12
13
He/She can justify the need of coding sensors Binary coded: 111 110 mis-aligned sensors mis-aligned sensors Gray coded: 111 101
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)
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
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
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, (detected) (not detected) Parity bits can also be applied to a block of data. Column-wise parity Row-wise parity
19