The text of a manual · part 19 of 24
A758 USB Thermal Receipt and Impact Slip Printer Owner's Guide, pages 181 to 190
Pages 181 to 190 of 235
The original document is the PDF (3.8 MB). 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 TPG A758
Page 181
Chapter 7: Programming Guide 173 Cash Drawer Status (n = 2 or n = 50) Bit Off/ Hex Decimal On
Status for Transmit Status
0
Off On
00 01
0 1
One or both cash drawers open. Both cash drawers closed.
1
Off On
00 02
0 2
One or both cash drawers open. Both cash drawers closed.
2
-
-
-
Undefined
3
-
-
-
Undefined
4
Off
00
0
Not used. Fixed to off.
5
-
-
-
Undefined
6
-
-
-
Undefined
7
Off
00
0
Not used. Fixed to off.
Slip Paper Status (n = 3 or n = 51) Value of Byte Returned Slip Status
0
There is no more printing space on the current slip, or the slip paper is not selected.
1 to 8
Remaining print area on the current slip, in number of lines, at the currently set line spacing, when the trailing edge sensor has become uncovered. Until the trailing edge sensor becomes uncovered the value reported will be 6, because there are at least 6 lines remaining. There can be 7 or 8 lines remaining when the slip line spacing has been set to less than 7.2 lines per inch.
Flash Memory Status (n = 4 or n = 52) Bit Off/On Hex Decimal Status for Transmit Status
0
Off
00
0
Undefined. Fixed to off.
1
Off
00
0
Undefined. Fixed to off.
2
Off On
00 04
0 4
User data storage write successful. User data storage write failed. Specified area not erased.
3
Off On
00 08
0 8
Flash logo area adequate. Definition stored. Flash logo area not adequate for recent definition.
4
Off
00
0
Not used. Fixed to off.
5
Off On
00 20
0 32
No thermal user-defined characters written to Flash Thermal user-defined characters written to Flash.
6
Off On
00 04
0 64
No impact user-defined characters written to Flash. Impact user-defined characters written to Flash.
7
Off
00
0
Not used. Fixed to off.
Range of n:
1–4 49 - 52
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 182
174 Chapter 7: Programming Guide See exceptions on the next page. Exceptions: When n is out of the specified range, the command is ignored. Unlike the A756, that had a dedicated connector and resultant dedicated status reporting for each cash drawer. The A758 has a single connector that shares data reporting from either cash drawer. When either cash drawer is opened, an open status is reported by the printer. Recognizing Data from the Printer An application sending various Real Time and non-Real Time commands to which the printer responds can determine which command a response belongs to by the table below. Responses to Transmit Peripheral Device Status (1B 75) and Transmit Paper Sensor Status (1B 76) are non-Real Time responses and will arrive in the order in which they were solicited. Batch Mode Response
A758-D100 12/04
Response Recognized By:
ASCII
HEX
ESC u 0
1B 75 0
0
0
0
0
0
0 x x
Binary
ESC v
1B 76
0 x x
0
0 x x x
Binary
GS I n
1D 49 n
0 x x
0 x x x x
Binary
GS r n
1D 72 n
0 x x
0 x x x x
Binary
Real-Time Response ASCII HEX
Response Recognized By:
GS EOT n
1D 04 n
0 x x
1 x x
1
0
Binary
DLE EOT n
10 04 n
0 x x
1 x x
1
0
Binary
GS ENQ
1D 05
1 x x x x x x x
Binary
XON
0
0
0
1
0
0
0
1
Binary
XOFF
0
0
0
1
0
0
1
1
Binary
Auto Status Back (ASB)
Response Recognized By:
ASB Byte 1
0 x x
1 x x
0
0
Binary
ASB Bytes 2-4
0 x x
0 x x x x
Binary
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 183
Chapter 7: Programming Guide 175
Real Time Commands These commands provide an application interface to the printer even when the printer is not handling other commands (RS-232C communication interface only): ♦
Real Time Status Transmission (GS Sequence and DLE Sequence)
♦
Real Time Request to Printer (GS Sequence and DLE Sequence)
♦
Real Time Printer Status Transmission
The Batch Mode Printer Status commands are placed in the printer’s data buffer as they are received and handled by the firmware in the order in which they are received. If the paper exhausts while printing data that was in the buffer ahead of the status command, the printer goes busy at the RS-232C interface and suspends processing the data in the buffer until paper is reloaded. This is true for all error conditions: knife home error, slip paper jam, thermal printhead overheat, etc. In addition, there is no way to restart the printer after a paper jam, or to cancel a slip waiting condition when using the Wait for Slip command. The Real Time commands are implemented in two ways to correct these problems. Both implementations offer the same functionality; which one you choose depends on the current usage of your application. Preferred Implementation For a new application the GS (1D) sequences are recommended to avoid possible misinterpretation of a DLE (0x10) sequence as a Clear Printer (0x10 0, ASCII DLE NUL) command. An application using these GS (1D) sequences, does not need to distinguish for the printer between the new real time commands and the Clear Printer command. This implementation is ideal for an existing A756 application that already uses the Clear Printer command or for a new application being developed. Alternate Implementation The alternate implementation uses the DLE (0x10) sequences as implemented on other printers. An application using these DLE (0x10) sequences and the original A756 Clear Printer command (0x10) must distinguish for the printer between the new real time commands and the Clear Printer command by adding a NUL (0x00) to the Clear Printer command. An application using these DLE (0x10) sequences must also send the second byte of the sequence within 100 milliseconds of the first, to prevent the first byte being mistaken for a Clear Printer command. Rules for Using Real Time Commands Three situations must be understood when using real time commands. First, the printer executes the Real Time command upon receiving it and will transmit status regardless of the condition of the DSR signal.
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 184
176 Chapter 7: Programming Guide Second, the printer transmits status whenever it recognizes a Real Time Status Transmission command sequence, even if that sequence happens to occur naturally within the data of another command, such as graphics data. In this case the sequence will also be handled correctly as the graphics data it is intended to be when the graphics command is executed from the buffer. Third, care must be taken not to insert a Real Time command into the data sequence of another command that consists of two or more bytes. In this case the printer will use the real time command sequence bytes instead of the other command’s parameter bytes when finally executing that other command from the buffer; the other command will NOT be executed correctly. These three situations generally preclude use of standard DOS drivers for the serial communication ports when using real time commands. Moving Data Through the Buffer Another consideration is that an application should take care not to let the buffer fill up with real time commands when the printer is busy at the RS-232C interface. A busy condition at the RS-232C interface can be determined by bit 3 of the response to 1D 05 or 1D 04 1 or 10 04 1. The reason for a particular busy condition can be determined by other responses to 1D 04 n or 10 04 n. Although the printer responds to Real Time commands when it is busy, it will place them into the buffer behind any other data there, and flush them out in the order in which they were received. When the printer is busy due simply to buffer full (that is, it can’t print data as fast as it can receive it), then data continues to be processed out of the buffer at approximately print speed and the Real Time commands will eventually get flushed out. When the printer is busy due to an error condition, then data stops being processed out of the buffer until the condition clears one way or another. In either case, but more quickly in the case of an error condition, the buffer can fill with real time commands. When the DLE sequences are being used, the last byte stored when the buffer fills up could be the DLE code, with no room for the subsequent EOT or ENQ. When this lone DLE byte is finally processed out of the buffer it will be interpreted as a Clear Printer command. Similarly, when the GS sequences are being used, the last byte stored when the buffer fills up could be the GS code, with no room for the subsequent EOT or ETX or ENQ. When this lone GS byte is finally processed out of the buffer it will use the next byte, whatever it is, as the second byte in its GS sequence. To guard against this situation, an application should determine the cause of a busy condition and take appropriate action or pace further real time commands to avoid filling the buffer. There are a minimum of 256 bytes available in the printer’s buffer when it goes busy.
A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 185
Chapter 7: Programming Guide 177
Real Time Status Transmission GS Sequence ASCII: GS EOT n Hexadecimal: 1D 04 n Decimal: 29 4 n Value of n:
DLE Sequence DLE EOT n 10 04 n 16 4 n
GS/DLE Sequence 1 = Transmit printer status 2 = Transmit RS-232C busy status 3 = Transmit error status 4 = Transmit receipt paper status 5 = Slip paper status
Transmits the selected one-byte printer status specified by n in Real Time according to the following parameters. This command includes two sequences: GS and DLE. Exceptions: The command is ignored if n is out of range. Unlike the A756, that had a dedicated connector and resultant dedicated status reporting for each cash drawer. The A758 has a single connector that shares data reporting from either cash drawer. When either cash drawer is opened, an open status is reported by the printer. An application using the DLE sequence must send EOT within 100 milliseconds of DLE or the printer will misinterpret the DLE and execute a Clear Printer command. Avoid this possibility by using the 1D 04 n sequence, which is handled exactly the same as 10 04 n. Related Information: 1 = Transmit Printer Status Bit
Status Hex
Decimal
Function
0
Off
00
0
Fixed to Off
1
On
02
2
Fixed to On
2
Off On
00 04
0 4
One or both cash drawers open Both cash drawers closed
3
Off On
00 08
0 8
Not busy at the RS-232C interface Printer is Busy at the RS-232C interface
4
On
10
16
Fixed to On
5
Undefined
6
Undefined
7
Off
00
0
Fixed to Off
(Real Time Status Transmission - continued on the next page)
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 186
178 Chapter 7: Programming Guide
2 = Transmit RS-232C Busy Status Bit
Status Hex
Decimal
Function
0
Off
00
0
Fixed to Off
1
On
02
2
Fixed to On
2
Off
00
0
Both receipt and cassette doors closed
On
04
4
Receipt or cassette door open
Off
00
0
Paper Feed Button is not pressed
On
08
8
Paper Feed Button is pressed
4
On
10
16
Fixed to On
5
Off
00
0
Printing not stopped due to paper condition
On
20
32
Printing stopped due to paper condition
Off
00
0
No error condition
On
40
64
Error condition exists in the printer
Off
00
0
Fixed to Off
3
6 7
3 = Transmit Error Status Bit
Status Hex
Decimal
Function
0
Off
00
0
Fixed to Off
1
On
02
2
Fixed to On
2
Off
00
0
No slip motor or flip jam
On
04
4
Slip motor or flip jam occurred
Off
00
0
No knife error
On
08
8
Knife error occurred
4
On
10
16
Fixed to On
5
Off
00
0
No unrecoverable error
On
20
32
Unrecoverable error occurred
Off
00
0
Thermal printhead temp./power supply voltage are in range
On
40
64
Thermal printhead temp./power supply voltage are out of range
Off
00
0
Fixed to Off
3
6
7
(Real Time Status Transmission - continued on the next page)
A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 187
Chapter 7: Programming Guide 179
4 = Transmit Receipt Paper Status Bit
Status Hex
Decimal
Function
0
Off
00
0
Fixed to Off
1
On
02
2
Fixed to On
2
Off
00
0
Receipt paper adequate
On
04
4
Receipt paper low
Off
00
0
Receipt paper adequate
On
08
8
Receipt paper low
4
On
10
16
Fixed to On
5
Off
00
0
Receipt paper present
On
20
32
Receipt paper exhausted
Off
00
0
Receipt paper present
On
40
64
Receipt paper exhausted
Off
00
0
Fixed to Off
3
6 7
5 = Transmit Slip Paper Status Bit
Status
Hex
Decimal
Function
0
Off
00
0
Fixed to Off
1
On
02
2
Fixed to On
2
Off
00
0
Slip paper selected
On
04
4
Receipt paper selected
Off
00
0
Not waiting for slip
On
08
8
Waiting for slip
4
On
10
16
Fixed to On
5
Off
00
0
Slip leading edge sensor: paper preset
On
20
32
Slip leading edge sensor: no paper
Off
00
0
Slip trailing edge sensor: paper preset
On
40
64
Slip trailing edge sensor: no paper
Off
00
0
Fixed to Off
3
6
7
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 188
180 Chapter 7: Programming Guide
Real Time Request to Printer GS Sequence ASCII: GS ETX n Hexadecimal: 1D 03 n Decimal: 29 3 n Value of n:
or or or
DLE Sequence DLE ENQ n 10 05 n 16 5 n
1 = Recover and restart 2 = Recover and clear buffers 3 = Cancel slip waiting
The printer responds to a request from the host specified by n. This command includes two sequences: GS and DLE. The operations performed depend on the value of n, according to the following parameters. n = 1: Restarts printing from the beginning of the line where an error occurred, after recovering from the error. Print settings that are normally preserved from line to line, such as character height and width, are still preserved with this command. This sequence is ignored except when the printer is busy due to an error condition. If the receipt is selected, this command will attempt recovery from a knife error. Other errors associated with the receipt, such as paper out or printhead overheating, can be recovered from only by clearing the specific condition, such as loading paper or letting the printhead cool down. If the slip is selected, this command will attempt recovery from a slip motor or flip jam by re-homing the printhead and waiting for a slip to be inserted before restarting the print. Other errors associated with the slip, such as cassette door open, can be recovered from only by clearing the specific condition, such as closing the cassette door. n = 2: Recovers from an error after clearing the receive and print buffers. Print settings that are normally preserved from line to line, such as character height and width, are still preserved with this command. This sequence is ignored except when the printer is busy due to an error condition. If the slip was selected when the error occurred, the receipt becomes selected when the buffers are cleared. When printing on the slip is to continue, the slip must be selected again. The same error recovery possibilities exist as for n = 1. n = 3: Cancels the slip waiting status. This sequence is ignored except when the printer is waiting for a slip to be inserted. When slip waiting is canceled, the receive and print buffers are cleared and the receipt is selected. When printing on the slip is to continue, the slip must be selected again. A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 189
Chapter 7: Programming Guide 181 (Real Time Request to Printer - continued on the next page)
Exceptions: The command is ignored if n is out of range An application using the DLE sequence must send ENQ within 100 milliseconds of DLE or the printer will misinterpret the DLE and execute a Clear Printer command. Avoid this possibility by using the 1D 03 n sequence that is handled exactly the same as 10 05 n. Real Time Printer Status Transmission ASCII: GS ENQ Hexadecimal: 1D 05 Decimal: 29 5 Transmits one byte status of the printer in real time. Value of Byte: Bit
Status Hex
Decimal
Function
0
Off
00
0
Receipt paper adequate
On
01
1
Receipt paper low
Off
00
0
Receipt paper adequate
On
02
2
Receipt paper low
Off
00
0
Both receipt and cassette doors closed
On
04
4
Receipt or cassette door open
Off
00
0
Not busy at the RS-232C interface
On
08
8
Printer is busy at the RS-232C interface
Off
00
0
One or both cash drawers open
On
1
16
Both cash drawers closed
Off
00
0
Paper present at both slip sensors
On
20
32
Paper not present at one or both slip sensors
Off
00
0
No error condition
On
40
64
Error condition exists in the printer
On
80
128
Fixed to On
1 2 3 4 5 6 7
Exception: Unlike the A756, that had a dedicated connector and resultant dedicated status reporting for each cash drawer. The A758 has a single connector that shares data reporting from either cash drawer. When either cash drawer is opened, an open status is reported by the printer.
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 190
182 Chapter 7: Programming Guide
Auto Status Back Select or Cancel Automatic Status Back ASCII: GS a n Hexadecimal: 1D 61 n Decimal: 29 97 n Value of n:
Status of ASB
Enables or disables automatic status back (ASB) and specifies the status items. This command is a batch mode command; that is, it is processed after all prior data in the receive buffer has been processed. There may be a time lag between the printer receiving this command and changing the ASB response, depending on the receive buffer status. If any of the status items listed are selected, ASB is enabled and the printer automatically transmits 4 status bytes whenever the selected status changes. If no status is selected, ASB is disabled. All four status bytes are transmitted without checking DSR. If the error status is enabled, a change in the following conditions will trigger the ASB: ♦
Cash Drawer
♦
Receipt Cover
♦
Knife Error
♦
Out-of-Range Printhead Temperature
♦
Out-of-Range Voltage
♦
Paper Exhaust Status
♦
Slip Paper
The bits of n are defined in the table.
A758-D100 12/04
Bit
Off/On
Hex
Decimal
Status for ASB
0
Off On
00 01
0 1
Cash drawer status disabled. Cash drawer status enabled.
1
Off On
00 02
0 2
RS-232C Busy status disabled. RS-232C Busy status enabled.
2
Off On
00 04
0 4
Error status disabled. Error status enabled.
3
Off On
00 08
0 8
Receipt paper roll status disabled. Receipt paper roll status enabled.
4
-
-
-
Undefined
5
Off On
00 20
0 32
Slip detector, slip paper status disabled. Slip detector, slip paper status enabled.
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide