Technical data

Table Of Contents
Unit 2: Programming Concepts
i Programming Reference
2-4 PN: 9001158B
USING BASIC
It may be useful to test your printer using a BASIC program on a PC or to 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 port on 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 example uses Standard Protocol codes in BASIC.
PRINTING WITH THE RS232C PORT
5 REM Parallel Example Identifies the program as a printer 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 #1 Opens 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"
Sends the data “SATO” to be placed 400 dots horizontally
and 100 dots vertically on the label and printed in the“XL”
autosmoothed font.
50 PRINT #1, E$;"Q1"; Instructs the printer to print a quantity of one label.
60 PRINT #1, E$; “Z”; Informs the printer that the last command has been sent
and printing can occur.
70 PRINT #1,CHR$ (3); Sends an <ETX> (ASCII Code decimal “3”) informs the
printer of message end.
Identifies the program as a printer RS232C port print label.
The “REM” prevents this data from being sent to the
printer and displays it only on the screen.