This manual is laid out consistent with the product discussed and provides all of the information
required for printer programming.
This manual also incorporates the use of special information boxes. Examples of these boxes
and the type of information provided in each, are below.
WARNING: PROVIDES INFORMATION THAT, IF UNHEEDED, MAY
RESULT IN PRESONAL INJURY.
CAUTION: PROVIDES INFORMATION THAT, IF UNHEEDED, MAY
RESULT IN EQUIPMENT DAMAGE.
NOTE: Provides helpful hints to assist in performing the tasks at hand.
LCD DISPLAY: Provides the specific display that should be visible on the
LCD at that point.
A comprehensive Table Of Contents provided at the front of this manual facilitates rapid
movement within. The contents identify the different Units, Chapters, and Sections. Each
references the page number of their commencement.
The pages of this manual have embedded headers and footers to assist the user in identifying
his or her exact position within the manual. The header provides the unit number followed by its
name. The footer identifies the product on the left and the page number to the right side of the
page.
Page enumeration is two-part with each separated by a hyphen. The first character set
references the Unit and the second identifies the page number. Page numbers begin with the
numeral (1) one at the commencement of a new unit and ascends sequentially.
SATO GL4xxe SBPL Programming ReferencePage 1-2
Unit 1: Introduction
PRINT AREA CALCULATION
Many print applications may not require labels that fill the entire printable area of the printer.
Therefore it is important to understand how to calculate print size so that the printed image does
not exceed the label size.
There are two axis to consider when calculating for print position; horizontal and vertical. The
horizontal axis is lateral positioning parallel with the print head and is measured from the right
side of the media to the left. The vertical axis is the label length from the front to its rear.
This juncture point of the horizontal and vertical axis is referred to as the Base Reference Point
(or zero point) and all measurement is incremental along those axis’ from there. The allowable
ranges for these references is dependent on the particular printer to accommodate different print
widths and resolutions.
A1 COMMAND
The A1 command is the preferred method of configuring the printer for media size. If using media
smaller than the print head width, use this command to specify the media size and adjust the
start position corresponding to that. The backing paper must be included in media size
considerations. This command would be as follows:
<A1>aaaaabbbb
a = Height of Label
b = Width of Label
NOTE: The valid ranges for each of the above may be found in the product
manuals.
A3 COMMAND
Before beginning to send code, one must perform some simple calculations to determine print
positioning. Firstly, determine the print resolution and maximum print width of the printer. This
information is provided in the Technical Data unit of the Operator Manual and Service Manuals.
The print resolution of the print head has a direct bearing on the “dots per inch” (DPI) of print
density. The corresponding formula for a 203 Resolution print head on a printer with 4.1
Maximum Print Width would be:
Resolution (DPI) x Maximum Printable Width (Linear Inches) =
Maximum Printable Width (Linear Dots)
203 (DPI) x 4.1 (Linear Inches) = 832 (Linear Dots)
Once this is done, one must calculate the label width in linear dots. That formula would be as
follows for a 2 inch wide label:
Resolution (DPI) x Label Width (Linear Inches) =
Label Width (Linear Dots)
203 (DPI) x 2.0 (Linear Inches) = 406 (Linear Dots)
SATO GL4xxe SBPL Programming ReferencePage 1-3
Unit 1: Introduction
POWER
ON LINE
STATUS LABEL RIBBON
LINE
FEED
Print Head
LABEL
LABEL
Label Width
Label Length
Maximum Printable Width
Initial Base Reference Point
Print Offset
New Base Reference Point
Lastly, one must calculate the horizontal distance to offset printing to accommodate for the
difference in size from the printer’s maximum printable width to the label width. That formula
would be as follows using the above examples:
In the above example, 426 would be the required command entry to reset the initial base
reference point (or zero point) to the new base reference point (or zero point) based on the
label’s width.
Note that with each additional horizontal or vertical adjustment, the New Base Reference Point
will always be positioned relative to the last base reference point - not the Initial Base Reference
Point. In other words, the only way to return to the Initial Base Reference Point is to either
commands to reverse the prior commands or to delete all positioning commands to return the
printer to its default state.
Figure 1-1, Print Area Calculation
SATO GL4xxe SBPL Programming ReferencePage 1-4
PROGRAMMING
CONCEPTS
•Programming Language
•Selecting Protocol Codes
•Using Basic
•Print Position Commands
•GL-specific Commands
SATO GL4xxe SBPL Programming ReferencePage 2-1
Unit 2: Programming Concepts
PROGRAMMING LANGUAGE
A programming language for a printer is a familiar concept to most programmers. It is a group of
commands that are designed to use the internal intelligence of the printer. The commands, which
are referred to as SATO Command Codes, contain non-printable ASCII characters (such as
<STX>, <ETX>, <ESC>) and printable characters. These commands must be assembled into an
organized block of code to be sent as one data stream to the printer, which in turn interprets the
command codes and generates the desired label output. The programmer is free to use any
programming language available to send the desired data to the printer.
The printer command codes used are based upon “Escape” (1B hexadecimal) sequences.
Typically there are four types of command sequences:
<ESC>{Command}
These commands generally tell the printer to perform a specific action, like “clear the memory.”
<ESC>{Command} {Data}
Commands with this format tell the printer to perform a specific action which is dependent upon
the following data, like “print X labels”, where the value for X is contained in the data.
<ESC>{Command} {Parameter}
These commands set the operational parameters of the printer, like “set the print speed to 3.”
<ESC>{Command} {Parameter} {Data}
Some commands can contain both Parameter and Data elements, such as “print a Code 39
symbol containing the data.”
SATO GL4xxe SBPL Programming ReferencePage 2-2
Unit 2: Programming Concepts
SELECTING PROTOCOL CODES
Protocol codes are the special control characters that prepare the printer to receive instructions.
For example, the <ESC> character tells the printer that a command code will follow and the
<ENQ> character asks for the printer status.
There are two pre-defined different sets of Protocol Control codes to choose from. Each set is
made up of six special characters. The Standard Protocol Control codes are non-printable
characters, and the Non-Standard Protocol Control codes are printable characters. The NonStandard set may be useful on host computers using protocol converters or in an application
where non-printable ASCII characters cannot be sent from the host.
This manual uses the Standard Protocol Control codes for all of the
examples. Alternately, the user may define and download a set of custom
Protocol Control Codes (see Appendix D).
PROTOCOL CODES
CONTROL
CHARACTER
STX02 HexData start
ETX03 HexData end
ESC1B HexCommand Code to follow
ENQ05 HexGet printer status, Bi-Com Mode
CAN18 HexCancel print job, Bi-Com mode
Off-Line40 HexTake printer Off-Line
STANDARD
DSW2-7 OFF
DESCRIPTION
SATO GL4xxe SBPL Programming ReferencePage 2-3
Unit 2: Programming Concepts
USING BASIC
It may be useful to test your printer using a BASIC program on a PC or write your actual
production programs in BASIC. Whatever the reason, if working in BASIC, some of the following
hints may be helpful.
Set the WIDTH of the output device to 255 characters to avoid automatically sending <CR> and
<LF> characters after every line. The command string should be continuous and uninterrupted
by <CR> and/or <LF> commands. The examples given in this manual are printed on separate
lines because they will not fit on a single line and do not contain <CR> and/or <LF> characters. If
these characters are needed, they are explicitly noted by the inclusion of <CR> and <LF>
notations.
If using the printer’s RS232C interface, it is necessary to set the computer COM portion so the
CTS and DSR signals are ignored. Send OPEN “COM” statements as follows:
OPEN “COM1:9600,E,8,1,CS,DS”AS #1
This sets the host computer’s COM1 port RS232C communication parameters for 9600 baud,
Even parity, 8 Data bits, 1 Stop bit and directs the port to ignore the CTS and DSR control
signals.
It may be desirable to assign the <ESC> character to a string variable to reduce keystrokes since
this character is often used.
The following two examples use Standard Protocol codes in BASIC.
PRINTING WITH THE PARALLEL PORT
5 REM CL612 Parallel ExampleIdentifies the program as a CL612 parallel port
print label. The “REM” prevents this data from
being sent to the printer and is only displayed on
the screen.
10 E$=CHR$(27)Sets the “E$” string as an <ESC> character
20 WIDTH “LPT1”,255Sets the width of the output to 255 characters
30 LPRINT E$;"A";Sends an “<ESC>A” command code to the LPT1
parallel port
40 LPRINT E$;"H400";E$;"V100";E$;"XL1SATO";Sends the data “SATO” to be to be placed 400
dots horizontally and 100 dots vertically on the
label and printed in the “XL” font.
50 LPRINT E$;"Q1"; Instructs the printer to print one label.
60 LPRINT E$; “Z”;Tells the printer that the last command has been
sent. The printer can now create and print the job.
SATO GL4xxe SBPL Programming ReferencePage 2-4
Unit 2: Programming Concepts
PRINTING WITH THE RS232C PORT
5 REM CL612 Parallel ExampleIdentifies the program as a CL612e RS232C port
print label. The “REM” prevents this data from
being sent to the printer and displays it only on
the screen.
10 E$=CHR$(27)Sets the“E$”string as an <ESC>character.
OPEN “COM1:9600,N,8,1,CS,DS”AS #1Opens the COM1 port for output and sets the
parameters as 9600 baud, No parity, 8 Data bits,
1 Stop bit and instructs the port to ignore the CTS
and DSR control signals.
30 PRINT #1,CHR$ (2);Sends an <STX> (ASCII Code a decimal “2”) to
the printer instructing it to prepare to receive a
message.
50 PRINT #1,E$;"A";Sends an “<ESC>A” command code to Print Port
#1 opened by statement 20 above.
60 PRINT#1, E$; "H400"; E$; "V100"; E$;
"XL1SATO"
50 PRINT #1, E$;"Q1";Instructs the printer to print a quantity of one
60 PRINT #1, E$; “Z”;Informs the printer that the last command has
70 PRINT #1,CHR$ (3);Sends an <ETX> (ASCII Code decimal “3”)
Sends the data “SATO” to be placed 400 dots
horizontally and 100 dots vertically on the label
and printed in the “XL” auto smoothed font.
label.
been sent and printing can occur.
informs the printer of message end.
Identifies the program as a CL612e RS232C port
print label. The “REM” prevents this data from
being sent to the printer and displays it only on
the screen.
SATO GL4xxe SBPL Programming ReferencePage 2-5
Unit 2: Programming Concepts
LABEL
Label Width
Label Length
PRINT POSITION COMMANDS
There are three methods using command codes to properly orient print images on a label. They
are as follows:
MEDIA SIZE COMMAND
The Media Size Command (<ESC>A1) allows specification of the label width and
length so the printer may automatically adjust itself relative to the command entry.
However, the label size specified and the actual label size must match.
Example:<ESC>A1aaaaabbbb
a = Label Length
b = Label Width
Figure 2-1, Media Measurement
BASE REFERENCE POINT COMMAND
The Base Reference Point Command (<ESC>A3) establishes the zero point of
the Horizontal and Vertical axis so the distance may be calculated in dots from
that point to the label’s edge. This command immediately follows the Data Start
Command.
Example:Label Width = total dots - = 406 dots
New Base Ref Point = Max Print Width - Label Width
= (dot quantity) - (406 dots) = 426 dots
Issue Base Reference Point command <ESC>A3 after the data Start command.
<ESC>A<ESC>A3H0426V0001. . . . . .
HORIZONTAL OFFSET COMMAND
Allows print image orientation by combining a part of both methods above by
establishing the media size and then orienting it through base reference point
adjustment.
Example:A Printer with 8-dpmm:
Label Width = 2" x 25.4 mm/in x 8 dpmm = 406 dots
New Base Reference Point = Maximum Print Width - Label Width
= (832 dots) - (406 dots) = 426 dots
Each <ESC>H command would have the value “426” added to it to correctly
SATO GL4xxe SBPL Programming ReferencePage 2-6
position each field.
Unit 2: Programming Concepts
NOTE: The <ESC>A3 Base Reference Point command can also shift the
reference point in a negative direction (toward the outside edge of the label).
The Command Code subsection contains a sample label output for each command code. These
samples reflect how the printed information would appear on a 4.25 inch wide label.
If you want to test any of the sample label outputs and are using labels less than five inches in
width, it is recommended that the Base Reference Point command be added to the data stream
to print the image onto the label.
The addition of the Base Reference Point command to the data stream will help adjust the print.
See the following two examples or refer to the Base Reference Point command description.
If using a 2 inch wide label, the entire image may not appear on the label. By adding the following
Base Reference Point command to the second line of the data stream, the base reference point
will be changed, causing the image to shift toward the inside of the printer where it can be printed
on the narrower label.
Example:M8400RVe data stream results in a 2 inch wide label:
The image is moved horizontally to the right 2 inches (406 dots) so that itcan be printed on a 2
inch wide label. For more information, see the Base Reference Point command description.
SATO GL4xxe SBPL Programming ReferencePage 2-7
Unit 2: Programming Concepts
This page is left blank intentionally
SATO GL4xxe SBPL Programming ReferencePage 2-8
COMMAND QUICK
REFERENCE
•A through Z (all commands)
SATO GL4xxe SBPL Programming ReferencePage 3-1
Unit 3: Command Quick Reference
COMMAND QUICK REFERENCE
INSTRUCTIONDESCRIPTION
AStart Code. Begins all print jobs
~AaaaaCut, Label. Specifies the number of labels to print between each cut. It is
independent of the Quantity command.
aaaa=Number of labels between each cut
~aaaaCut, Job. Cuts labels at a specified interval in a print job. Quantity of labels
printed is equal to the product of the quantity specified x the value of aaaa.
aaaa=Number of labels between each cut (0001 to 9999)
~BCut, Last. Cuts any printed labels that remain in the printer.
AOaAuto Online. Allows the automatic online on power up setting to be
enabled or disabled.
a=0: Powers up in the online mode
1: Powers up in the offline mode
A1aaaabbbbMedia Size. Specifies the label size.
aaaa=Label height in dots (0 to Vmax)
bbbb=Label width in dots (0 to Hmax)
&Store Form Overlay. Stores a specified label image in the printer’s volatile
form overlay memory.
ARNormal Print Length. This command resets the printer to the Standard
print length (7 inches).
&RaaForm Overlay, Recall. Recalls a label image previously stored in
Expanded Memory.
aa=Storage number (00 to 99)
&S,aa,bbbb,ccccForm Overlay, Store. Stores a label image in Expanded Memory.
aa=Storage number (00 to 99)
bbbb=Horizontal size of window to be stored (50 to Hmax)
cccc=Vertical size of window to be stored (50 to Vmax)
SATO GL4xxe SBPL Programming ReferencePage 3-2
Unit 3: Command Quick Reference
COMMAND QUICK REFERENCE
INSTRUCTIONDESCRIPTION
*a,bbbClear Memory Card. Stores a label image in Expanded Memory.
a=Memory section to be cleared.
G: SATO graphics file (001 to 999)
P: PCX graphics file (001 to 999)
F: Stored formats (001 to 999)
O: TrueType fonts, memory card (001 to 009)
R: BMP graphic file (001 to 999)
bbb=BMP graphic file (001 to 999)
@,nn...nOffline/Pause. Signals the printer to go offline after upon job completion.
nn...n=Optional message to be displayed on the LCD (max 32
characters).
A3H-aaaa-VbbbbBase Reference Point. Establishes a new base reference point position
for the current label. Units of measurement are dots.
- =Optional character.If included, will shift reference point in
negative direction.
aaaa=Horizontal reference point
bbbb=Vertical reference point
AXPrint Area Enlargement. This command sets the printer to the Expanded
print length (14 inches). <ESC>EX0 is the recommended replacement.