4-9
Chapter 3
Programming Overview and Notes
About This Chapter
This chapter covers all the points that need to be understood in
order to program the LabelWriter correctly.
Both basic and advanced topics will be explained so that you get
a clear idea of how the LabelWriter work.
Programming for the LabelWriter
The first step in programming the LabelWriter is to understand
how the printer works.
As an ASCII-based printer, the LabelWriter accepts 8-bit ASCII
characters as both data and commands. The ASCII table in
Appendix G shows the relationship between the 8-bit values and
the characters they represent. Most environments either use the
ASCII character table as the default for character values or
support an ASCII mode where characters are interpreted by the
ASCII values. This means that sending data and commands to the
printer is usually as simple as transmitting the characters from
your program to the port to which the LabelWriter is connected.
A simple program to print ‘Hello World’ on the LabelWriter
might look as follows in Qbasic for DOS.
OPEN “COM1:9600,n,8,1” FOR OUTPUT AS #1
PRINT #1, “HELLO WORLD”
The “OPEN…” line above opens the selected COM port for
printing and initializes the communication settings while the
“PRINT…” line sends the data to the printer.
Commands can be sent to the printer in exactly the same way. For
example, if you wanted to change the font which “Hello World”
was printed into a 7-characters-per-inch font, you could look in
this manual and find that the required command characters to do
this are ESC and T. (ESC refers to the Escape character. By
checking Appendix G, you would find that the ESC character has