ASCII Table and Hexadecimal Number Format

Started by Kalyan, May 09, 2009, 10:08 PM

Previous topic - Next topic

Kalyan

ASCII Table and Hexadecimal Number Format

Computers store information in a form of numbers. We humans are more comfortable reading letters.

That's why at the very birth of personal computers ASCII table was created. This table gives computer information on how to map human readable symbols to the numerical codes.

There are 128 symbols in ASCII table numbered from 0 to 127 (or from 00000000 to 11111111 in binary codes and 00 to 7F in hexadecimal).

Before going into more details about ASCII table let's quickly review what is hexadecimal number format. Knowing about this numbering system is quite useful since most low level computer manipulations are done in it. Also ASCII table digits are often encoded in this format.

Decimal system digits are from 0 to 9 while hexadecimal are from 0 to F (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F to be precise). So instead of 10 digits it has 16. And if you start counting from 0 you will be at A in hexadecimal at the same time you reach 10 in decimal. And when you reach F it will be 15.

Counting in hexadecimal is quite similar to decimal system and when you reach maximum digit in the last position you need to increment a digit in previous position. So when we add 1 to F we will get 10 since F is a maximum digit in hexadecimal system. Translation between two systems is also quite easy. If XY is a number in hexadecimal system (where X and Y are digits) to get decimal number you need to take X*16+Y.

You would be surprised but almost all of us who have ever used Windows operating system had an encounter with hexadecimal number format. You probably remember that back in Windows 95-98 and even XP days lots people were complaining about BSOD (or blue screen of death). And we still see these screens now from time to time. If you look at almost any BSOD you will see that it has "memory dump section" which has only hexadecimal numbers in it. Also you will see that all errors codes are in this format too.

With this knowledge let's get back to ASCII table. Not all symbols in this table are readable. Symbols numbered from 0 to 31 are used to encode special control codes which were very popular in DOS operating systems. At this moment that part of ASCII table is rarely used.

Elements from 48 (hex 30) to 57 (hex 39) represent numbers while elements in ranges 65 (hex 41) - 90 (hex 5A) and 97 (hex 61) - 122 (hex 7A) represent alphabet. The rest of the table is used to encode other symbols used in text like braces, dot, comma, quotes.

So when you type some text on the computer it is stored in form of ASCII codes. For example word "cat" would be coded as 63 61 74 (in hexadecimal) where c is encoded as 63, a as 61 and t as 74.

About 15 years ago when computers were able to display only textual information ASCII art was very popular. ASCII art is a way to represent graphic images using characters from ASCII table. Even though they don't look very fancy it is very easy to recognize what is displayed on the picture. You can see some pictures in ASCII art section of our website.

In the modern computer ASCII table was mostly replaced by UNICODE and UTF which are more advanced encoding tables but even in them English text is encoded with the same numbers as in ASCII.




courtesy : ezine