Microsoft KB Archive/22303

Meaning of “Printer Control Codes”

PSS ID Number: Q22303 Article last modified on 11-02-1994

1.x 2.x 3.x

MS-DOS

Question:

What are “control codes”?

Response:

Technically, a “control code” is a single ASCII numeric code below 33. Whereas decimal codes 33-126 represent standard characters, decimal codes 0-32 represent standard control functions. For example, decimal ASCII numeric code 12 represents FF, which means “Form Feed,” 15 represents SO, which means “Shift Out,” and 27 represents ESC, which means “Escape.” Each of these is a control code. The names of these codes are standard from company to company.

However, whereas all printer companies may have their printers issue a form feed upon receiving an FF, they may not all agree on what their printer does upon receiving an SO. On an Epson, for example, reception of an SO (ASCII decimal 15) causes the printer to begin compressed print. On another printer SO might begin expanded print.

In general usage when speaking of printers, though, a “control code” is a sequence of ASCII numeric codes that are sent to the printer to control the printer’s functioning. Such “control sequences,” as they might be better called, can consist of any number and combination of single ASCII codes from 0 to 255. Each printer has its own set of control sequences that it recognizes as valid. Control sequences always begin with an ASCII numeric code either below 33 (usually) or above 126 (occasionally). A control sequence would never start with an ASCII numeric code from decimal 33 to decimal 126 since all printers recognize these as representing normal printable characters, and therefore the character would be printed.

An “Escape code” or “Escape sequence” is simply a control sequence that begins with the ASCII code decimal 27, which represents ESC (“Escape”).

KBCategory: kbother KBSubcategory: Additional reference words:

=
================================================================ Copyright Microsoft Corporation 1994.