
Controlcodesmostlyhandlecommunicationsbetweenyourcomputerand theprinteratthelowestlevel,atcablelevel.Forexample,a coupleofcontrol codesmakesurethe printerbuffer(yourprinter’sstoragememory)doesn’t overflow. In this book we’ll indicate control codes enclosed by angle
bracketsto their abbreviationsin the table: =&I%means- the Form Feed controlcode,whichadvancestheprinterto thenextpagejust as thePRINT button.does.
1.2.4Escape sequences
Control code 27, cESG or Escape, is a particularlyimportantone for printers.To tellyourprinterallthethingsyoumightneed- settingmargins, sayingwhere to print, choosinga particularfont, startinggraphicsand so on- requiresmanymorethanjust two or threedozencontrolcodes.So the <ESC> control code has a special meaning: <ESC> means “the next characterspecifiesa command,not somethingto be printed”.
Thereforeif you sendjust the character4 to the printerit will print a 4 and that’sall. Butif yousendthe cESC> codejustbefore the4 thentheprinter (in
In this book we’ll leave spacesbetweencharacterswhen we show escape sequences.You’llfind
<ESC>(S@ IOh 12vos 3T
a bit more readablethan
<ESC> (sOp10h12vOs3T
But rememberthat you arenot to sendthosespacesif you sendcommands to the printer.
To sumup, printercommandsare of two types.A controlcode is a single- charactercommandthattellsyourprinterto do something,likemovedown one line. An Escapesequencecontrolsa printeroperationtoo, but is more thanonecharacterlong.Sincetheyarecommands,neithercontrolcodesnor escapesequencesare usuallyprintablecharacter.
8