AN-02
September 23, 2005
OVERVIEW OF THERMAL LINE PRINTER MODE
Line printer mode is the simplest protocol supported by the O’Neil thermal printers. Send a line of text as a sequence of
characters down to the printer followed by a carriage return (0x0D), and/or a line feed (0x0A), or a form feed (0x0C) and
the printer will print that line of text. Commands can be used to change the way the printout looks, and to select different
fonts (fonts are available as the common IBM PC Code Page 437 mapping as well as many other mapping s and
international character sets – see AN-3 or AN-13)
Commands are usually either a single non-printable character, or a
character such as ESCape (0x1b). Although these commands can be placed anywhere in the text, they will usually take
effect exactly where they are placed. So you must be careful to place them where you want the effect to take place. For
example, to change fonts you send ESC w n, where ‘n’ is the single character name of the font (seen AN-3 or AN-12). If
you do this at the beginning of the line, it will affect the entire line. But if you place this in the center of a line, it will affect
only those characters that come after. If you place this at the end of the line, it will have no effect on that line at all, but
will affect the next line.
sequence of characters beginning with a non printable
COMMAND MEANING
LF (0x0A)1 Print any characters received and advance to the next line X X
FF (0x0C)
CR (0x0D) 1 Print any characters received and advance to the next line X X
SO (0x0E) Sets double width printing X X
SI (0x0F) Cancels double width printing X X
CAN (0x18)
ESC @
(0x1B ‘@’)
ESC ! n
(0x1B ‘!’ n)
ESC A n
(0x1B ‘A’ n)
ESC B
(0x1B ‘B’)
ESC C n
(0x1B ‘C’ n)
ESC E
ESC EZ
(0x1B “EZ”)
Print any characters received and advance to the next
page
Cancels any characters sent to the printer on the current
line that have not yet been printed
Resets the printing engine - cancels any command
currently in effect and resets the font as if the printer had
just been turned ON
Sets double wide and double tall. The ‘n’ is a bit field
where double wide is set if Bit 5 is set, and double high is
set if Bit 4 is set
Sets line spacing to add n dotlines between each text line.
Default is zero
Beginning of Run Length Encoded graphics image (see
ESC E and AN-5). This command is followed by the Run
Length encoded graphic image data
Set form length to n lines, each line is the height of the
CURRENT font
End of a Run Length Encoded graphics image (see ESC s
n and AN-5)
Toggle to Easy Print mode X X
ORIGINAL
MF2/MF3/2t/4t
X
X X
X X
X X
X X
X X
X
RADIO READY
2t/3l/4t
Configurable
option – default
is OFF
X
(Note FF must
be ON to use)
ESC H n
(0x1B ‘H’ n)
ESC I n
(ESC ‘I’ n)
ESC Q n1n2
(0x1B ‘Q’ n1n2)
ESC R n
(0x1B ‘R’ n)
ESC V n1n2
ESC e
(0x1B ‘e’)
ESC i
(0x1B ‘I’)
ESC m
(0x1B ‘m’)
ESC s n
(0x1B ‘s’ n)
ESC t n
ESC w n
(0x1B ‘w’ n)
Apply a vertical multiplier of n to the normal height of a
character – n = 0x02 will give double high characters, n =
0x03 will give triple high characters etc.
If n = 0x01 or n = ‘1’ (0x31) will turn inverse (white on black
printing) ON and if n=0x00 or n = ‘0’ will turn inverse OFF
When this command is received, the printer stops imaging
and starts advancing, looking for a “Q” mark, then going an
additional n1n2 dotlines after the “Q” mark is found
Remaps some international characters when used with a
224 character CP437 font (Values below in HEX)
0 – USA 1 – France 2 – Germany
3 – UK 4 – Denmark 5 – Sweeden
6 – Italy 7 – Spain
Marks the beginning of a bitmap graphics image sent to the
printer. The n1n2 are the number of dotlines in the image,
the graphics image follows
Marks the end of a print job for “Job Status Reporting” (see
ESC s n for start)
Thrown away (for compatibility with another printer) X
Thrown away (for compatibility with another printer) X
Turns ON Job Status Reporting. The ‘n’ is a bit field that
allows various status to be reported to the host
automatically upon detection (e.g. paper out and end of
job)
Can be used to cancel the printer system timeout. If n =
0x01 or ‘1’ (0x31), then the timeout is cancelled. If n =
0x00 or ‘0’ (0x30) then the timeout is enabled, which is the
default
Selects the font with a single character name of ‘n’. A list
of the values of n for each font is given in the self test and
in AN-3
X
X X
X X
X X
X X
X X
X
X X
1 Note: A single LF, CR, or combinations of CRLF or LFCR are all considered line terminations and cause the printer to
print and advance
Example 1
To print a single line of data, send the string to print terminate
8 ASCII characters A-H, followed by Carriage Return (0x0D) and Line Feed (0x0A) you will see a single printed line of text
containing ABCDEFGH:
ABCDEFGH 0x0D 0x0A
Example 2
To change to a different font, send ESC w followed by the single ch
or in the documentation. For example, if you send the string from Example 1 followed by ESC w & IJKLMNOP you will
see A-H on one line in the default font (or whatever font was active from the last print job) followed by a second line in a
larger font. The ESC character is a single byte 0x1B
ABCDEFGH 0x0D 0x0A
0x1B w & IJKLMNOP 0x0D 0x0A
d by CR, LF, CRLF, or LFCR. For example, if you send the
aracter font name as indicated on the self test printout