4-10
a decimal value of 27.) With this information, you can construct
the following program to print ‘Hello World’ in a 7-characters-
per-inch font.
OPEN “COM1:9600,n,8,1” FOR OUTPUT AS #1
PRINT #1, CHR$(27); “T”;
PRINT #1, “HELLO WORLD”
In a nutshell, that’s all there is to programming for the
LabelWriter. Any formatting or special effect that you may need
for your output can be specified simply and easily by sending the
appropriate command characters and the data to be printed.
Below, we’ll cover the ins, outs and general information that you
should know before programming the LabelWriter.
Resetting the Printer
Each print job should begin with a printer reset command. This
ensures that the printer always begins in a known state.
The command characters used to reset the LabelWriter are ESC
(decimal value 27) and * (decimal value 42).
Command Parameters
When sending a command, all of the command characters and
parameters that make up a command must be sent. This is
especially important when using the bar code and graphics
commands. Sending too few characters to fill the required
parameters for a command will either cause the command to fail
or result in subsequent data being lost.
Character Evaluation
Most of the parameters that are sent to the LabelWriter are
evaluated based on their decimal value. It is very important to
have a good understanding of what this means.
The ASCII character that is represented by a ‘3’ does not have a
decimal value of 3 (the character '3's decimal value is 51, as listed
in the ASCII table in Appendix G).