Coding of Information Assign a unique string of binary digits to each piece of information There are many standard coding groups –Decimal Codes (BCD – Binary Coded Decimal) Ways to encode the first 10 symbols of the decimal number system. –Unit-Distance Codes Only one bit changes between succesive values –Alphanumeric Codes Ways to encode characters and numeric data
BCD Codes To represent the first 10 digits in decimal (0-9), how many bits are needed? –With 3 bits, there are 8 different combinations –With 4 bits, there are 16 different combinations Since only 10 different combinations are needed, use 4 bits – 6 combinations will not be used.
Weighted Decimal Codes Decimal Digit8421 Code2421 Code5421 Code7536’ Code
BCD Codes (Decimal Codes) Weighted Code –8421 code Most common Default The corresponding decimal digit is determined by adding the weights associated with the 1s in the code group. **** The BCD representation is NOT the binary equivalent of the decimal number ***** – = –2421, 5421,7536, etc… codes The weights associated with the bits in each code group are given by the name of the code
BCD Codes (Decimal Codes) Nonweighted Codes –2-out-of-5 Actually weighted except for the digit 0 Used by the post office for scanning bar codes for zip codes Has error detection properties
Unit Distance Codes Important when an analog quantity must be converted to a digital representation. Only one bit changes between two successive integers which are being coded.
Unit-Distance Codes (Gray Code) Decimal DigitGray Code Decimal DigitGray Code
Alphanumeric Codes Codes to handle alphabetic and numeric information, special symbols, punctuation marks, and control characters. ASCII (American Standard Code for Information Interchange) is the best known. Unicode – a 16-bit coding system provides for foreign languages, mathematical symbols, geometrical shapes, dingbats, etc…
b6b5b4b6b5b4 b3b2b1b0b3b2b1b SOHDC1!1AQaq 0010STXDC2"2BRbr 0011ETXDC3#3CScs 0100EOTDC4$4DTdt 0101ENQNAK%5EUeu 0110ACKSYN&6FVfv 0111BELETB‘ 7GWgw 1000BSCAN(8HXhx 1001HTEM)9IYiy 1010LFSUB*:JZjz 1011VTESC,;K[k{ 1100FFFS,<L\l| 1101CRGS- M]m} 1110SORS. >N^n~ 1111SIUS/ ?O_oDEL ASCII Code
UNICODE UNICODE is a 16-bit code for representing alphanumeric data. With 16 bits, can represent 2 16 or different symbols. 16 bits = 2 Bytes per character. $ A A-Z $ A a-z Some other alphabet/symbol ranges $3400-3d2d Korean Hangul Symbols $ F Hiranga, Katakana, Bopomofo, Hangul $4E00-9FFF Han (Chinese, Japenese, Korean) UNICODE used by Web browsers, Java, most software these days.BR 2/00
Error Detection and Error Correction Codes
How Much Memory? Memory is purchased in bits – –How many bits do I need if I want to distinguish between 8 colors? –How many bits do I need if I want to represent 16 million different colors?
How Much Memory? How many bits do I need if I want to distinguish between 8 colors? 2 x-1 < 8 <= 2 x x = 3 (3 bits are needed) How many bits do I need if I want to represent 16 million different colors? 2 x-1 < 16 million <= 2 x 16M = 1Mx16 = 2 20 x2 4 = 2 24 x = 24 (24 bits are needed)
What do you need to know? Codes (Binary, Weighted BCD (8421 Code), Alphanumeric (ASCII), Unit Distance(Gray)) Number of bits needed?