The text of a manual · part 10 of 16
A760 Two-Color Thermal/Impact Hybrid Printer User Guide: Programming Supplement, pages 89 to 98
Pages 89 to 98 of 154
The original document is the PDF (2.3 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 A760
Page 89
Revision F January 2010
A760 User Guide: Programming Supplement
89
Chapter 4: Programming commands Slip paper status (n = 3 or n = 51)
Flash memory user sector status (n = 4 or n = 52)
Value of byte returned
Slip Status
Bit Off/On Hex
Decimal
Status for transmit status
0
–
–
–
Undefined. Fixed to off.
0
There is no more printing space on the current slip, or the slip paper is not selected.
1
–
–
–
Undefined. Fixed to off.
2 Off 00 0
User data storage write successful
On 04 4
User data storage write failed, specified area not erased.
3
Flash logo area adequate, definition stored.
On 08 8
Flash logo area not adequate for recent definition.
4
Not used. Fixed to off.
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 9 lines remaining.
Off
Off
00
00
0
0
5 Off 00 00
No thermal user-defined characters written to flash.
On 20 32
Thermal user-defined characters written to flash.
6 Off 00 0
No impact user-defined characters written to flash.
On 04 64
Impact user-defined characters written to flash.
7
Undefined.
–
–
–
Send printer software version ASCII Hexadecimal Decimal
AX V 1F 56 31 86
The printer returns 8 bytes containing the boot and flash software version. The first 4 bytes returned are an ASCII string for the boot version.
The second 4 bytes are an ASCII string for the flash version. Example: For 1.234.56 (8 bytes), the boot version is 1.23 and the flash version is 4.56.
Page 90
90
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Real-time commands The real time commands provide an application interface to the printer even when the printer is not handling other commands: • Real-time status transmission: GS (Hex 1D) sequence and DLE (Hex 10) sequence • Real-time request to printer: GS (Hex 1D) sequence and DLE (Hex 10) 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 were 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, 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 in order to overcome the limitations of batch mode status commands. Both implementations offer the same functionality; which one you choose depends on the current usage of your application.
Preferred implementation
Alternate 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.
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 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.
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.
Page 91
Revision F January 2010
A760 User Guide: Programming Supplement
91
Chapter 4: Programming commands
Rules for using real-time commands Three situations must be understood when using real time commands. First, the printer executes the real time command within a few msec of detecting it in the input buffer and will transmit status regardless of the condition of the DSR signal. 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 Applications should not 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 to 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 (0×10) sequences are being used, the last byte stored when the buffer fills up could be the DLE (0×10) code, with no room for the subsequent EOT or ENQ. When this lone DLE (0x10) byte is finally processed out of the buffer it will be interpreted as a clear printer command. Similarly, when the GS (1D) sequences are being used, the last byte stored when the buffer fills up could be the GS (1D) code, with no room for the subsequent EOT or ETX or ENQ. When this lone GS (1D) byte is finally processed out of the buffer it will use the next byte, whatever it is, as the second byte in its GS (1D) sequence. To guard against this situation, the application must determine the cause of a busy condition and take appropriate action or pace the real time commands to avoid filling the buffer. There is a minimum of 256 bytes available in the printer’s buffer when it goes busy.
Page 92
92
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Busy line and fault conditions If the printer is in error condition (cover is open, paper is exhausted…), the printer will still accept data, respond to the batch mode status commands (1B 76 and 1B 75 0), handle the cash drawer commands, and not go busy until it actually tries to execute a print command. Then it will stay busy and stop processing data out of the receive buffer until the condition clears. It will respond to the real time commands as described below.
Real-time status transmission GS sequence
DLE sequence
ASCII Hexadecimal Decimal
GS EOT n 1D 04 n 29 4 n
DLE EOT n 10 04 n 16 4 n
Value of n:
GS/DLE sequence
Related information
1 = Transmit printer status 2 = Transmit RS-232C busy status 3 = Transmit error status 4 = Transmit receipt paper status 5 = Slip paper status
1 = Transmit printer status
Transmits the selected one byte printer status specified by n command within a few msec according to the following parameters. This command includes two sequences: GS (1D) and DLE (0×10). Exceptions
The command is ignored if n is out of range. An application using DLE (0×10) 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 ID 04 n sequence, which is handled exactly the same as 10 04 n. Unlike the A756, that had a dedicated connector and resultant dedicated status reporting for each cash drawer, the A760 has a single connector that shares data reporting from either cash drawer. When either cash drawer is open, an open status is reported by the printer.
Bit Status Hex Decimal Function 0
Off
00
0
Fixed to Off.
1
On
02
2
Fixed to On.
2 Off 00 0
On 04 4
One or both cash drawers open. Both cash drawers closed.
3 Off 00 0
On 08 8
Not busy at the RS-232C interface. Printer is busy at the RS-232C interface.
4
Fixed to on.
On
10
16
5
Undefined.
6
Undefined.
7
Fixed to off.
Off
Continued...
00
0
Page 93
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
2 = Transmit RS-232C Busy Status
4 = Transmit receipt paper status
Bit Status Hex Decimal Function
Bit Status Hex Decimal Function
0
Off
00
0
Fixed to off.
0
Off
00
0
Fixed to off
1
On
02
2
Fixed to on.
1
On
02
2
Fixed to on
2 Off 00 0
On 04 4
Receipt and cassette cover closed. Receipt and cassette cover open.
2
Off 00 0 On 04 4
Receipt Paper adequate Receipt Paper low
3
3 Off 00 0
On 08 8
Paper feed button is not pressed. Paper feed button is pressed.
Off 00 0 On 08 8
Receipt Paper adequate Receipt Paper low
4
On
10
16
Fixed to on
4
Fixed to on.
5
5 Off 00 0
On 20 32
Printing not stopped due to paper condition. Printing stopped due to paper condition.
Off On
00 20
0 32
Receipt Paper present Receipt Paper exhausted
6
Off On
00 40
0 64
Receipt Paper present Receipt Paper exhausted
6
Off 00 0 On 40 64
No error condition. Error condition exists in the printer.
7
Off
00
0
Fixed to off
7
Fixed to off.
On
Off
10
00
16
0
5 = Transmit Slip Paper Status Bit Status Hex Decimal Function 0
Off
00
0
Fixed to Off
3 = Transmit error status
1
On
02
2
Fixed to On
Bit Status Hex Decimal Function
2
Off On
00 04
0 4
Slip paper selected Receipt paper selected
3
Off On
00 08
0 8
Not waiting for slip Waiting for slip
4
On
10
16
Fixed to On
0
Off
00
0
Fixed to off.
1
On
02
2
Fixed to on.
2
Off
00
0
Fixed to off.
3
Off On
00 08
0 8
No knife error. Knife error occurred.
4
On
10
16
Fixed to on.
5
Off On
00 20
0 32
No unrecoverable error. Unrecoverable error occurred.
6 Off 00 0
On 40 64
Thermal printhead temp. and power supply voltage are in range. Thermal print head temp. or power supply voltage are out of range.
7
Fixed to off
Off
00
0
5 Off 00 0
On 20 32
Slip leading edge sensor: paper preset Slip leading edge sensor: no paper
6 Off 00 0
On 40 64
Slip trailing edge sensor: paper preset Slip trailing edge sensor: no paper
7
Fixed to Off
Off
00
0
93
Page 94
94
A760 User Guide: Programming Supplement
Revision F January 2010
Chapter 4: Programming commands
Real-time request to printer GS sequence
DLE sequence
ASCII Hexadecimal
GS ETX n 1D 03 n 29 3 n
DLE ENQ n 10 05 n 16 5 n
Value of n:
1 = recover and restart 2 = recover and clear buffers
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. 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. 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. 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. 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.
Page 95
Revision F January 2010
A760 User Guide: Programming Supplement
95
Chapter 4: Programming commands
Real-time printer status transmission ASCII Hexadecimal Decimal
GS ENQ 1D 05 29 5
Transmits one byte status of the printer in real time. 0
Off 00 0 On 01 1
Paper adequate. Paper low (if paper low sensor enabled).
1
Off 00 0 On 02 2
Paper adequate. Paper low (if paper low sensor enabled).
2 Off 00 0
On 04 4
Both receipt and cassette door closed. Both receipt and cassette door open.
3 Off 00 0
On 08 8
Not busy at the RS-232C interface. Printer is busy at the RS-232C interface.
4 Off 00 0
On 10 16
One or both cash drawers open. Both cash drawers closed.
5 Off 00 0
On 20 32
Paper present at both slip sensors. Paper not present at one or both sensors
6
Off 00 0 On 40 64
No error condition. Error condition exists in the printer.
7
Fixed to on.
On
80
128
Exceptions
Unlike the A756, that had a dedicated connector and resultant dedicated status reporting for each cash drawer, the A760 has a single connector that shares data reporting from either cash drawer. When either cash drawer is open, an open status is reported by the printer.
Real-time commands disable ASCII Hexadecimal Decimal
US z n 1F 7A n 31 122 n
Value of n:
0 = disable 1 = enable
This command is used to disable real time commands. They are disabled prior to sending graphic or other data to the printer that may contain embedded real time commands.
This command is a batch command and processed in the order received.
Page 96
96
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Unsolicited status mode Select or cancel unsolicited status mode (USM) ASCII: GS a n Hexadecimal: 1D 61 n Decimal: 29 97 n Value of n:
0 turns mode off; any non-zero value turns mode on
Default:
0 (USM disabled)
Enables or disables automatic return of 4 status bytes whenever one or more of the listed changes occurs. This command is a batch mode command; that is, it is processed after all prior data in the input buffer has been processed. There may be a time lag between the printer receiving this command and enabling unsolicited status mode (USM), depending on the pending input buffer contents. If an immediate return of printer status is desired, then any of the other status commands should be issued following this command. Once this mode is activated, the printer automatically transmits 4 status bytes whenever any of the conditions change. If an RS-232C connection with hardware flow control is used, all four status bytes will be transmitted without checking DSR. This command is a POS version of general printer unsolicited status functions; it uses the same command code as older versions of the POS command “automatic status back (ASB)” but has the following differences: • The parameter n is an on/off switch; it does not select trigger subset • There is no immediate return when this mode is turned on • All 4 status bytes are always returned
A change in any of the following conditions will trigger the USM response: • Cash Drawer • Receipt Cover • Knife Error • Out-of-Range Printhead Temperature • Out-of-Range Voltage • Paper Exhaust Status • Slip Paper Related information
When Unsolicited Status Mode is enabled using this command, the status transmitted by other commands and the USM status are differentiated according to the information found in Recognizing Data from the printer, which follows the USM return description. The status bytes to be transmitted are described in the following four tables. Byte 1 = printer information Byte 2 = error information Byte 3 = paper sensor information Byte 4 = paper sensor information
Page 97
Revision F January 2010
A760 User Guide: Programming Supplement
97
Chapter 4: Programming commands First Byte (printer Information)
Third byte (paper sensor information)
Bit Off/On Hex Decimal Status for USM
Bit Off/On Hex Decimal Status for USM
0
Off
00
0
Not used. Fixed to off.
0
1
Off
00
0
Not used. Fixed to off.
Off 00 0 On 01 1
Receipt paper adequate Receipt paper low (if paper low sensor enabled)
1
Off 00 0 On 02 2
Receipt paper adequate Receipt paper low (if paper low sensor enabled)
2
Off On
00 04
0 4
Receipt paper present. Receipt paper exhausted.
3
Off On
00 08
0 8
Receipt paper present. Receipt paper exhausted.
4
Off
00
0
Not used. Fixed to off.
2 Off 00 0
On 04 4
One or both cash drawers open. Both cash drawers closed.
3 Off 00 0
On 08 8
Not busy at the RS-232C interface. Printer is busy at the RS-232C interface.
4
On
10
16
Not used. Fixed to on.
5
Off On
00 20
0 32
Receipt cover closed. Receipt cover open.
6 Off 00 0
On 40 64
Paper feed button is not pressed. Paper feed button is pressed.
7
Not used. Fixed to off.
Off
00
0
Second byte (error information) Bit Off/On Hex Decimal Status for USM 0
–
–
–
Undefined
1
–
–
–
Undefined
2
Off On
00 04
0 4
No mechanical error Mechanical error occurred
3
Off On
00 08
0 8
No knife error. Knife error occurred.
4
Off
00
0
Not used. Fixed to off.
5
Off On
00 20
0 32
No unrecoverable error. Unrecoverable error occurred.
6
Off
00
0
No recoverable error.
On 40 64
Recoverable error: Cover open, paper out, temperature or voltage error is out of range.
7
Not used. Fixed to off.
Off
00
0
5 Off 00 0
On 20 32
Slip leading edge sensor: paper present Slip leading edge sensor: no paper
6 Off 00 0
On 40 64
Slip trailing edge sensor: paper present Slip trailing edge sensor: no paper
7
Not used. Fixed to off.
Off
00
0
Fourth byte (paper sensor information) Bit Off/On Hex Decimal Status for USM 0 Off On 01
00 1
0 Slip paper selected Receipt paper selected
Off 00 On 02
0 Possible to print on slip 2 Not possible to print on slip because no form has been inserted
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.
1
Page 98
98
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
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. Batch mode response
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.
Response recognized by:
ASCII
HEX
ECS 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
Response recognized by:
ASCII
HEX
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
Unsolicited status mode (USM)
Response recognized by:
USM Byte 1
0 x x
1 x x
0
0
Binary
USM Byte 2–4
0 x x
0 x x x x
Binary