The text of a manual · part 14 of 16
PcOS Series 150 Receipt/Validation/Journal Printers Programmer's Guide, pages 131 to 140
Pages 131 to 140 of 151
The original document is the PDF (746 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Ithaca Model 151, Ithaca Model 153 and Ithaca Model 152
Page 131
Programmer's Guide
PcOS Series 150
Communications Serial Port
The following flow chart illustrates how the print controller takes information from the buffer and controls flow. At the top of the chart, the print control software asks for data. If there is no data in the buffer, a no data flag is returned. The print software must then wait for data. If there is data in the buffer, it is read and pointers are updated. The buffer is then checked to see how much information is left. If the buffer is below a low watermark (about 100 bytes left), the communication driver is notified, and DTR is reasserted. If XON/XOFF flow control is being used, the flow is similar to DTR flow except that DTR is not used and XON/XOFF control characters are transmitted back to the host on the serial link. XON/XOFF has an advantage over DTR in that only three wires are required to interconnect to a printer. The disadvantage is that a serial port receiver driver must be written for the host.
12/14/99
Rev G
Page 121
Page 132
Communications
PcOS Series 150
Programmer's Guide
Serial Port
The print controller needs data to print or a command to decode.
Is there any data in the buffer?
Loop through idle task, and then look for more data.
No
Return to print controller with no data available.
Yes
Set DTR or transmit XON.
Aquire data from the buffer.
Move buffer pointers to the next data byte.
Is the buffer below the low watermark?
No DTR = Data Terminal Ready Return data to print controller.
Figure 23 Print controller using data The print controller is always looking for data when the printer is on-line and not printing. It continuously asks the buffer if it has any data. If there is no data in the buffer, it does housekeeping chores like keyboard scanning. If there is data, it processes it. The flow control is done when the data is taken from the buffer and the amount of data in the buffer is less than a prescribed amount. This low watermark is set based on the expected environment. The Series 150 Printer sets this at 200 characters, which gives the host application time to get more data to the printer before the printer uses up what it has.
Page 122
Rev G
12/14/99
Page 133
Programmer's Guide
PcOS Series 150
Communications Serial Port
When XON/XOFF protocol is implemented, it is possible for the host to miss an XON or an XOFF. To prevent this from causing a communication lockup, the printer will send an XOFF for every character received after the high watermark is reached. Whenever the printer detects that the serial data link is inactive, it will send out an XON. This results in an XON being sent out about every two seconds. When the printer is selected or deselected (with the SELECT key), an XON or XOFF will also be sent. This happens even if the internal data buffer is past the high watermark16 and tells the host that the SELECT key has been pressed. If the buffer is full and an XON is sent, the next character sent by the host will cause an XOFF to be sent. The data that was sent by the host will not be lost unless the 255-character pad buffer is depleted.
Printer Buffer Size The Series 150 Printer has a configurable buffer size. It can be set from 256 bytes to 6144 bytes (This does not include the 64-character high-speed buffer). This allows an application to control how far ahead of the printer it can get before being asked to wait. The smaller the buffer is, the tighter the control. It is up to the application developer to select the optimal buffer size.
One-line Mode The Series 150 Printer supports a one-line mode of operation. In this mode, the input buffer is set to 1024 bytes; however, the printer will go busy after every [CR] is received by the printer. In this mode, the printer will stay busy after the [CR] is received and remain busy until the previous information is printed. This mode is not recommended for serial operation unless the application looks for the line terminator handshake. Several features must be considered when using this mode. 1. 2.
3. 4.
5.
The printer only looks at [CR]’s. [LF] will cause the printer to print but will not set busy. If a [CR] character is received as part of another command, i.e., as part of graphical data, the printer will go busy after the [CR] is received and will go ready after the [CR] is processed. By definition, one-line mode is slow. The printer will not allow the application to get ahead of it. In serial mode, one-line mode is difficult to control. Because of the 64-character highspeed FIFO buffer, the printer will not go busy immediately after the [CR] is sent. It may take up to 25 milliseconds for the printer to process the [CR]. During this time, it is possible for the application to send up to 48 bytes of data to the printer. When the [CR] is found in the input stream, the busy status will be set. If the application continues to send information, the input buffer will be overrun as it only has 16 bytes left. In addition, the application will not truly be in one-line operation. The application must wait for at least 100 milliseconds after a [CR] before looking for busy status or trying to send more data. In XON/XOFF mode, the printer is heavily burdened by the task of transmitting XOFF characters while printing and receiving data. The application should be written to look for the XOFF after every [CR]. The Series 150 Printer will lose data if too many characters follow the XOFF.
16If the host sends more information, it will be responded to by an XOFF.
12/14/99
Rev G
Page 123
Page 134
Communications
PcOS Series 150
Programmer's Guide
Serial Port
Serial Port Inquire The serial port inquire is more straightforward than parallel mode. The serial acknowledge (ACK) or not-acknowledge (NAK) responses follow a uniform format. The ACK or NAK is always followed by the command ID that requested it. This makes the design of the host application easier because the response can be identified and always follows the same format. Figure 24 is an example of a host/printer inquiry response exchange.
The host sends an [ENQ] to the printer asking for the form sensor status.
The printer receives the request and preprocesses it.
The printer responds with an [ACK] <id> or [NAK] <id> indicating the form sensor status. The host receives the response and decodes it.
Figure 24 Inquire flow The host sends an [ENQ]<id> (form sensor status) request to the printer. The printer responds with an [ACK]<id> indicating that the request was identified, and the status is true. Inquire (ENQ) commands effect the printer’s performance. The priority for communication in the printer is very high. ENQ commands take processing away from print tasks. It is possible to ask for so much status that the printer slows. In serial mode, it is important that the response to an inquire be received by the host before another command is issued. When an inquire is received by the printer, it is buffered in a highspeed process queue. When the printer has time, it empties the queue and processes the inquires. The printer responds to the command as soon as the second byte of the command is taken from the high-speed buffer. If the host is looking for a form to be inserted, it should not send status requests as fast as it can. The host will get a response to all of them, and if the host did not wait for a response to each, there would be unnecessary responses. In IEEE 1284 mode, inquiry responses are placed in an IEEE 1284 transmit queue. When the IEEE 1284 reverse channel is opened, the responses are returned to the host. It is important that after each request, the reverse channel be opened. Inquire responses will remain in the queue until read. If the [ENQ] <9> command is sent to the printer, the IEEE 1284 buffer will be cleared and only the response to the [ENQ] <9> will remain.
Page 124
Rev G
12/14/99
Page 135
Programmer's Guide
PcOS Series 150
Communications Programmer’s Notes
Remote Printer Reset Reset in Serial Mode It is possible to generate a printer reset in serial mode. The [ENQ] <10> command will request that the printer reset. (This is not a hardware reset). It will, however, completely initialize the hardware and software but will not recover from a loss of software control. Note: If the printer mode was changed by the [ESC] y <2> or [ESC] y <3> command, a soft reset will not return to the power on default. The command flow follows. 1. The [ENQ] <10> will be acknowledged, and then the software will reset. 2. The printer will be placed off-line. 3. The hardware and software will be reinitialized. 4. The printer will then go back on-line. Any information sent to the printer while it is off-line will be lost.
Reset in Parallel Mode In parallel mode, driving the INIT signal on the parallel port for 100 milliseconds will generate a software reset. It will take about two seconds for the printer to recover from a reset. The [ENQ] <10> command will be rejected if parallel mode is active.
Power-cycle Recovery There are times when the host needs to know if the printer was power cycled. An example would be after changing the receipt tape. It is not necessary to turn off the printer to change the receipt. However, if the operator does, any information sent to the printer before the power cycle will be lost. The Series 150 Printer has a flag that is set after a reset. The flag stays set until it is requested by the host; at which time, it is reset. The [ENQ] <11> command reads the flag. If the command returns power-cycled status, the power has been reset or power cycled since the last request and all unprinted information has been lost. If the print operation is critical, it is a good idea to check the flag before and after all transactions. An alternate approach is to check the flag after every off-line to on-line transition. Note: If the printer mode was changed by the [ESC] y <2> or [ESC] y <3> command, a power-cycle reset will return to the power on default.
12/14/99
Rev G
Page 125
Page 136
Communications
PcOS Series 150
Programmer's Guide
Remote Printer Reset
Programmer’s Notes When the serial port is being used, it is important that the output lines from the printer not be shorted or back driven. If the signals are not to be used, they should be left open. Pins 3, 4, and 7 are outputs from the printer. If any one of these signals is grounded or back driven, the other two outputs will be degraded. The best time to configure the printer by the host is during system setup or software update. The printer should be power cycled after configuration to assure that the new configuration takes effect. In serial mode, one-line mode should be avoided, particularly in XON/XOFF mode. The high speed FIFO input buffer makes one-line mode difficult to process. If the knife module fails at any time, the configuration can be changed to deactivate the option and the printer will not ask it for status. This will allow the printer to be used without the option until the printer can be repaired.
Page 126
Rev G
12/14/99
Page 137
Programmer’s Guide
PcOS Series 150
Cash Drawer Interface
Chapter 11: Cash Drawer Interface Interface Description The Series 150 Printer supports dual cash drawers with status. The driver in the printer is capable of supplying 24 VDC at up to 1.5 amps and 250 milliseconds. The Series 150 Printer defines cash drawer closed as switch open. If the drawer is disconnected, it will be viewed by the printer as closed. Since the printer does not act on the cash drawer status, the application can interpret cash drawer status any way it wants.
Interface Connectors There are two cash drawer connectors. One is configured as Cash Drawer 1, the other as Drawer 2. The pin out is as follows: Function
Drawer 1
Drawer 2
Drawer Drive +
Pin 4
Pin 4
Drawer Drive -
Pin 5
Pin 1
Status Signal
Pin 2
Pin 2
Status Ground
Pin 3
Pin 3
Frame Ground
Pin 6
Pin 6
No Connect
Pin 1
Pin 5
Pin 1
Table 16 Ithaca cash drawer connector Note: Cash Drawer 2 can be factory configured to be the same as Drawer 1.
Function
Drawer 1
Drawer 2
Drawer Drive -
Pin 2
Pin 2
Pin 5
Drawer Drive +
Pin 3
Pin 3
Pin 2
Status Signal
Pin 6
Pin 6
Pin 1
Pin 1
Drawer 1
Drawer 2
Drawer Drive +
Pin 4
Pin 4
Drawer Drive -
Pin 2
No Connect
Pin 5
Function
Status Signal
Pin 3
Pin 3
Frame Ground
Status Ground
Pin 6
Pin 6
No Connect
Pin 4
Pin 4
Frame Ground
Pin 1
Pin 1
No Connect
Pin 5
Pin 5
Table 18 Star cash drawer connector
Table 17 Epson/Axiohm cash drawer connector
12/14/99
Rev G
Page 127
Page 138
Printing Graphics
PcOS Series 150
Programmer’s Guide
Chapter 12: Printing Graphics The Series 150 Printer has bit image graphic capabilities and a full PC-compatible graphic character set. The bit image format is similar to that used on other personal computer printers. There are three modes of operation: single-density, half-speed double-density, and full-speed double-density. Single-density is the fastest mode. It makes a single, unidirectional, 60 dpi print pass. The full-speed double-density makes two passes with a half-dot offset. This mode is half the speed of single-density print but will print at 120 dpi. Half-speed double-density is half the speed of full-speed double-density; however, the print quality is enhanced.
Character Graphics Character graphics are created by joining individual characters together to produce a mosaic of characters that form a graphic image. The simplest method is to use the * (or any other character) to form an image. For example, ITHACA might be formed as follows. *** * * * ***
*** * * * *
* * * * ***** * * * *
** * * **** * * * *
*** * * *
* * ***
** * * **** * * * *
The extended character set of the printer supports line graphic characters that can be combined to form windows and other shapes. For the shapes to join from line to line, the line spacing must be set properly. All characters are in a 9-dot-high character cell. The dots are 1/60 inch apart. Therefore, the line spacing should be 10/60 or 1/6 inch. The set fine line space command can be used to set this line spacing. If possible, the spacing should be reduced slightly to overlap the rows. This prevents any white space from appearing between the lines. The following example illustrates the use of extended graphic characters.
Page 128
Rev G
12/14/99
Page 139
Programmer's Guide
PcOS Series 150
Printing Graphics
[ESC]U<1> Select unidirectional print for better alignment. [ESC]: Select 12 cpi. [ESC]3<34> Set line spacing to 0.157 inch. (This is slightly smaller than 1/6 inch.) <201> Send the line graphic characters to the printer. <205><205><205><205><205><205><205><205><205> <205><205><205><205><205><205><205><205><205> <205><205><205><205> <187>[CR][LF] <186> PcOS PRINTERS <186>[CR][LF] <186> <186>[CR][LF] <186> MADE TO ORDER <186>[CR][LF] <186> BUILT TO LAST <186>[CR][LF] <200> <205><205><205><205><205><205><205><205><205> <205><205><205><205><205><205><205><205><205> <205><205><205><205> <188>[CR][LF] This finishes the line graphics. [ESC]U<0> Reenable bidirectional printing. [ESC]0 Set standard 1/8-inch line spacing. [SI] Set 17 cpi. [CR][LF] Finish the form. ST# 2000 OP# 00067 TE# 021 0035[CR][LF] KLEENEX FAM D04 QTY 1 1.68 J[CR][LF] RITZ D01 QTY 1 2.50 D[CR][LF] CHIPS D01 QTY 1 1.50 D[CR][LF] STORAGE BAG D04 QTY 1 1.50 J[CR][LF] SUB TOTAL 7.18[CR][LF] SALES TAX 1 .50[CR][LF] ------[CR][LF] TOTAL 7.68[CR][LF] CASH TEND 20.00[CR][LF] CHANGE DUE 12.23[CR][LF] [CR][LF] [ESC]a<1> THANK YOU FOR SHOPPING WITH US[CR][LF] [ESC]a<0> [CR][LF] {DATE:0} {TIME:0}[CR][LF]
Figure 25 Receipt with extended graphic characters
12/14/99
Rev G
Page 129
Page 140
Printing Graphics
PcOS Series 150
Programmer's Guide
When printing line graphics, the data path to the printer must be eight bits. Seven-bit serial protocols will not access the extended characters. The extended characters require that the form be reverse fed. This means that printing line graphics on the receipt may be less than acceptable.
APA Graphics The printer is capable of all-points-addressable (APA) graphics. Generating a graphic image by hand is time consuming and tedious. It is possible to use a graphic package to create a graphic image. The following procedure will help with the setup. 1. 2. 3.
4. 5. 6.
Generate the graphic image in the program of your choice. Make sure the paper size you choose will fit the printer station. If the paper size cannot be set, print a portion of the page. Print the graphic to a file using a generic, IBM, graphic, 9-pin driver. The standard IBM resolutions are: 240 x 216 dpi, 120 x 72 dpi, and 60 x 72 dpi. The Series 150 Printer supports all three resolutions. For good resolution with reasonable speed, use 120 x 72 dpi. Print the graphic image to a file. Edit the resulting file to remove any unwanted form control, and insert the Series 150 form control. Make the resulting file available to your application, so it will be sent to the printer when required.
Figure 26 Receipt with APA graphics As with all graphics, the data path to the printer must be eight bits; 7-bit protocols will not work. The quad-density graphic resolution will give the best rendition of your graphic image; however, this mode is slow and prints dark. The printer is setup to provide the best performance in normal operation. For this reason, quad-density graphics should be limited. The APA graphic example above was done with double-density graphics. The graphic driver used made an approximation of the graphic image. The first part of the graphic file is listed here in hex. This is a hex dump of the first 512 bytes of the graphic file printed on the above receipt.
Page 130
Rev G
12/14/99