Communication overview, Interface, Sending commands – M-S Cash Drawer A794 User Manual
Page 47
Chapter 5: Communication Interface
A794 Owner’s Guide
December 1999
42
Communication Overview
In order for a receipt to be printed, a program must be in place that translates the data
from the host computer into a language that the printer can understand. This program
must tell the printer exactly how to print each character. This chapter describes how to
create such a program or modify an existing one.
Interface
In order for the printer to communicate with the host, a communication link must be set
up. The printer supports the RS-232C Serial and IEEE 1284 Parallel interface.
The interfaces have a protocol associated with them that the host must understand and
adhere to. Only when the interface parameters are matched and the proper protocol is
used, will the host and the printer be able to communicate.
For more information about
See this section
Protocol description
“RS-232C Interface”
Sending Commands
Once the communication link is established, commands can be sent to the printer. This
section describes how to send commands to the printer using DOS and BASIC. This
section does not take into account the necessary protocol, but is meant as a general
introduction to how the printer functions.
Using DOS to Send Commands
One way of getting commands to the printer is to send them directly from DOS. For
example, the command
COPY CON: COM1:
sets the computer up such that the hexadecimal code corresponding to any key that was
pressed would be sent to the communication port COM1 when the COPY mode is
exited. If the printer is connected to COM1, then the data will go to the printer.
Exit the COPY mode by typing
CTRL Z
and then pressing the ENTER key. Once the computer knows to direct data from any
print command to the proper port, commands can be sent from any software program.
Using BASIC to Send Commands
In BASIC, printer commands are sent as a string of characters that are preceded by the
LPRINT command. For example,
LPRINT CHR$(&H0A)
sends the hexadecimal number 0A to the printer, which causes the printer to print the
contents of its print buffer. Previously sent commands tell the printer exactly how this
data should appear on the paper. For example,
LPRINT CHR$(&H12); "ABC"; CHR$(&H0A)
sends the hexadecimal numbers 12 41 42 43 0A to the printer. This causes the printer to
set itself to double wide mode (12), load the print buffer with “ABC” (41 42 43), and
finally, print (0A). Again, the communication link that the BASIC program outputs to
must be matched to that of the printer.