following chart shows many different ways of referring to the code for the carriage return function.
Carriage return | Its common name |
CR | The abbreviation of its name |
13 | The decimal ASCII code |
0DH | Its hexadecimal ASCII code |
CTRL/M | Its |
CHR$(13) | Its usage in BASIC |
As you can see there are many different ways to refer to a single code. This information helps you identify what code is being referenced. Your computer manual may refer to ASCII 13 while your software program refers to CTRL/M. You now know that both refer to the same code.
ASCII Codes as CHR$(n)
The ASCII codes take on a new form when you use them with programming languages. For example, in BASIC, the ASCII codes take the form of CHR$(n), where n represents the desired code. The capital letter A, which is the ASCII code 65, is CHR$(65). You are telling the computer which code you want by inserting the number within the parentheses following the CHR$. Depending on the code, you instruct your printer to print a character, or perform a function (such as execute a line feed or print italics).
The ESCape code
So many features have been added to printers that even 256 ASCII codes are inadequate if only
Each ESCape code sequence consists of the ESCape code (usually abbreviated (ESC)), which is CHR$(27), plus one or more of the other
For example, the ESCape code used to turn the italic print function on is <ESC>“4”. The (ESC) is the abbreviation for CHR$(27) and the numeral 4 is the ASCII equivalent of CHR$(52). The <ESC>“4” is easier to remember than CHR$(27)CHR$(52).
29