nASCII codes and the CHR$ function
You can talk to your computer in BASIC, but your computer and your printer talk to each other in what are known as ASCII codes. In the ASCII code, each number from 0 to 255 has a par- ticular meaning - 36, for example, makes the printer print a dollar sign. Some numbers cause the printer to do other things, too. For instance, sending a 7 sounds the printer’s bell.
Taken together, these numbers and their meanings make up the ASCII code (pronounced
There are a number of different ways to represent an ASCII code, depending on how you are using it. For example, the ASCII codes for the
BASIC uses the CHR$ function to represent ASCII characters and many functions. To print the letter “A” we would enter LPRINT CHR$(65). To make the printer’s bell sound, we would enter LPRINT CHR$(7). In general, we print a character by entering LPRINT CHR$(ASCII code) to the printer.
We can also use hex ASCII codes. Although we use only decimal ASCII codes in this manual, in some applications it will help if you understand what a hex code is. “Hex” is short for hex- adecimal and refers to a
nControl codes
ASCII codes with values of 32 or less do not correspond to keys on the keyboard. These codes control many of the printer’s functions, so we call them control codes. To enter a control code from the keyboard, we have to press two keys at the same time