Notes and Comments on the ASCII Code

ASCII (American Standard Code for Information Interchange) is a 7-bit code that was originally designed for Teletype machines and paper tape. It is now the most commonly used code for transmitting English text, numbers, symbols, and control codes.

The textbook has a section on the ASCII code beginning on page 167. However, the material there also covers parity, which we will learn about later, and so may have a little more information than you may want at this time. It also presents ASCII as an 8-bit code, although the leftmost bit is always a zero.

You can locate a very complete web page on the ASCII code at http://www.asciitable.com. I have placed binary and hexadecimal versions of the code at the ENT 283 section of my faculty web page. Let us know via the discussion board if you locate any other useful web pages on ASCII. You should print out those pages before you attempt any assignments. You definitely do not have to understand decimal or hexadecimal numbers to see how the code works.

This is how the binary table works --locate a character on the table and then look for the three "most significant bits" at the top of the table and the four "least significant bits" at the left of the table. Write them in that order, the most significant bits (MSBs) followed by the least significant bits (LSBs). The letter "A" is thus 1000001; the number "6" is 0110110; and a form feed (FF) is 0001100.

The hexadecimal table works in a similar manner. The letter "X" is thus 58, the number "9" is 39, and the carriage return (CR) code is 0D.

Here are some interesting sidelights on ASCII. If you look at the binary ASCII table, you can see that for any upper and lower case version of a letter (capital and small letter), the four LSB's are always identical, and the three MSB's are almost identical. The middle MSB is always a 0 for uppercase letters and a 1 for lower case letters. Whenever you hit the shift key or caps lock on a keyboard, that key is forcing the middle MSB to go to 0.

If you look at the hexadecimal table, you see that the space (SP) character is 20. When spaces are used as part of file or directory names, you will often see the "20" printed in the spot where the space belongs. You often see this when you do a print-screen of a web page, and the URL of the page is printed out at the top or bottom of the printed page.

Remember that true ASCII is a 7-bit code, but that there are 8 bits to a byte. Since characters are typically expressed in bytes, that leaves one more bit that can be used in an unofficial 8-bit ASCII code. Eight bits allows 256 total possibilities, or an additional 128 characters. These characters have many different possible uses, such as italic text, symbols used for foreign languages, and various graphics. Different printer manufacturers make their own non-standard "upper-level ASCII," or "extended ASCII," which can produce some very strange results if you accidentally mix up printer drivers. Along these lines, when you see a printer spew out page after page filled with short bursts of "garbage" characters, you can be fairly certain that some ASCII control codes and upper-level ASCII characters have been somehow misinterpreted. The web site http://www.jimprice.com/jim-asc.htm has examples of attempts by IBM and Microsoft to standardize ASCII's extended character set.

The web site http://tronweb.super-nova.co.jp/characcodehist.html has an extensive history of character codes (probably more than you'd ever want to know) plus information on other codes in use today.