ASCII - SCLM

 

 

Conversion

The decimal representations of these ASCII codes are not very enlightening. However, the hexadecimal representation of these ASCII codes reveals something very important; the low order nibble of the ASCII code is the binary equivalent of the represented number.

By stripping away (i.e., setting to zero) the high order nibble of a numeric character, you can convert that character code to the corresponding binary representation. Conversely, you can convert a binary value in the range 0 through 9 to its ASCII character representation by simply setting the high order nibble to three. Note that you can use the logical-AND operation to force the high order bits to zero; likewise, you can use the logical-OR operation to force the high order bits to 0011 (three).

Note that you cannot convert a string of numeric characters to their equivalent binary representation by simply stripping the high order nibble from each digit in the string. Converting 123 (31h 32h 33h) in this fashion yields three bytes: 010203h, not the correct value which is 7Bh. Converting a string of digits to an integer requires more sophistication than this; the conversion above works only for single digits.

Bit seven in standard ASCII is always zero. This means that the ASCII character set consumes only half of the possible character codes in an eight bit byte. The PC uses the remaining 128 character codes for various special characters including international characters (those with accents, etc.), math symbols, and line drawing characters. Note that these extra characters are a non-standard extension to the ASCII character set. Most printers support the PC's extended character set.

previous next

   
Home Inlab Solution