The text of a manual · part 10 of 14
A795 Two-Color Thermal Receipt Printer User Guide: Programming Supplement, pages 91 to 100
Pages 91 to 100 of 136
The original document is the PDF (980 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 Axiohm A795
Page 91
Revision E May 2005
A795 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.
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.
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.
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 (0x10) sequences are being used, the last byte stored when the buffer fills up could be the DLE (0x10) 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.
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 on the next page.
Page 92
92
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
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
Exceptions
1 = Transmit printer status 2 = Transmit RS-232C busy status 3 = Transmit error status 4 = Transmit receipt paper status
The command is ignored if n is out of range.
Transmits the selected one byte printer status specified by n in real time according to the following parameters. This command includes two sequences: GS (1D) and DLE (0x10).
An application using DLE (0x10) 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 A793, that had a dedicated connector and resultant dedicated status reporting for each cash drawer, the A795 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.
Related information 1 = Transmit printer status
2 = Transmit RS-232C Busy 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
2
Off On
00 04
0 4
Cover closed. Cover open.
On
04
4
One or both cash drawers open. Both cash drawers closed.
3
Off
00
0
Off
00
0
On
08
8
Paper feed button is not pressed. Paper feed button is pressed.
On
08
8
3
4
On
10
16
Not busy at the RS-232Cinterface. Printer is busy at the RS-232C interface.
4
On
10
16
Fixed to on.
Fixed to on.
5
Off
00
0
On
20
32
Printing not stopped due to paper condition. Printing stopped due to paper condition.
6
Off On
00 40
0 64
No error condition. Error condition exists in the printer.
7
Off
00
0
Fixed to off.
5
Undefined.
6
Undefined.
7
Off
00
0
Fixed to off.
Real time status transmission (continued)
Page 93
A795 User Guide: Programming Supplement
Revision E May 2005
93
Chapter 4: Programming commands
3 = Transmit error 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
Fixed to off.
2
Off On
00 04
0 4
3
Off On
00 08
0 8
No knife error. Knife error occurred.
Paper adequate Paper low (if paper low sensor enabled)
3 4
On
10
16
Fixed to on.
Off On
00 08
0 8
Paper adequate Paper low (if paper low sensor enabled)
5
Off On
00 20
0 32
No unrecoverable error. Unrecoverable error occurred.
4
On
10
16
Fixed to on
5
Off On
00 20
0 32
Paper present Paper exhausted
6
Off On
00 40
0 64
Paper present Paper exhausted
7
Off
00
0
Fixed to off
6
Off
On
7
Off
00
40
00
0
64
0
Thermal printhead temp. and power supply voltage are in range. Thermal print head temp. or power supply voltage are out of range. Fixed to off
Real time request to printer GS sequence ASCII GS ETX n Hexadecimal 1D 03 n 29 3 n Value of n:
DLE sequence DLE ENQ n 10 05 n 16 5 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. Exceptions
The command is ignored if n is out of range. An application using DLE (0x10) 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 ID 03 n sequence, that is handled exactly the same as 10 05 n.
Page 94
94
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
Real time printer status transmission ASCII GS ENQ Hexadecimal 1D 05 Decimal 29 5
Transmits one byte status of the printer in real time.
Exceptions
Value of byte:
Unlike the A793, that had a dedicated connector and resultant dedicated status reporting for each cash drawer, the A795 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 On
00 01
0 1
Paper adequate. Paper low (if paper low sensor enabled).
1
Off On
00 02
0 2
Paper adequate. Paper low (if paper low sensor enabled).
2
Off On
00 04
0 4
Cover closed. Cover open.
3
Off
00
0
On
08
8
Not busy at the RS-232C interface. Printer is busy at the RS-232C interface.
Off
00
0
On
10
16
One or both cash drawers open. Both cash drawers closed.
5
Off
00
0
Fixed to off.
6
Off On
00 40
0 64
No error condition. Error condition exists in the printer.
7
On
80
128
Fixed to on.
4
Real time commands disabled ASCII US z n Hexadecimal 1F 7A n Decimal 31 122 n Value of n:
0 = enable 1 = disable
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. the disable command (n=1) is acted on in real time.
The re-enable command (n=0) is treated as a batch command and processed in the order received.
Page 95
Revision E May 2005
A795 User Guide: Programming Supplement
95
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
A change in any of the following conditions will trigger the USM response:
Default:
0 (USM disabled)
• Cash Drawer
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
• 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 96
A795 User Guide: Programming Supplement
96
Revision E May 2005
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
Off On
00 01
0 1
1
Off
00
0
Not used. Fixed to off.
Receipt paper adequate Receipt paper low (if paper low sensor enabled)
2
Off
00
0
1
Off On
00 02
0 2
On
04
4
One or both cash drawers open. Both cash drawers closed.
Receipt paper present Receipt paper low (if paper low sensor enabled)
Off
00
0
2
Off On
00 04
0 4
Receipt paper present. Receipt paper exhausted.
On
08
8
Not busy at the RS232C interface. Printer is busy at the RS232C interface.
3
Off On
00 08
0 8
Receipt paper present. Receipt paper exhausted.
4
Off
00
0
Not used. Fixed to off.
5
–
–
–
Undefined
6
–
–
–
Undefined
7
Off
00
0
Not used. Fixed to off.
3
4
On
10
16
Not used. Fixed to on.
5
Off On
00 20
0 32
Receipt cover closed. Receipt cover open.
Off
00
0
On
40
64
Paper feed button is not pressed. Paper feed button is pressed.
Off
00
0
Not used. Fixed to off.
6
7
Fourth byte (paper sensor information) Second byte (error information) Bit Off/On Hex Decimal Status for USM
Bit Off/On Hex Decimal Status for USM 0
–
–
–
Undefined
0
–
–
–
Undefined
1
–
–
–
Undefined
1
–
–
–
Undefined
2
–
–
–
Undefined
2
Off On
00 04
0 4
No mechanical error Mechnical error occurred
3
–
–
–
Undefined
4
Off
00
0
Not used. Fixed to off.
3
Off On
00 08
0 8
No knife error. Knife error occurred.
5
–
–
–
Undefined
4
Off
00
0
Not used. Fixed to off.
6
–
–
–
Undefined
5
Off On
00 20
0 32
No unrecoverable error. Unrecoverable error occurred.
7
Off
00
0
Not used. Fixed to off.
6
Off
00
0
No recoverable error.
On
40
64
Recoverable error: Cover open, paper out, temperature or voltage error is out of range.
Off
00
0
Not used. Fixed to off.
7
Page 97
A795 User Guide: Programming Supplement
Revision E May 2005
97
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
Page 98
98
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
Bar codes These commands format and print bar codes and are described in order of their hexadecimal codes. These commands describe operation for 80mm paper. If the printer supports 82.5mm paper, the dot spacing is the same but there are 640 printable dots rather than the 576 printable dots on 80mm paper.
Select printing position of HRI characters ASCII GS H n Hexadecimal 1D 48 n Decimal
29 72 n
Value of n:
Printing position 0 = Not printed 1 = Above the bar code
2 = Below the bar code 3 = Both above and below the bar code Default:
0 (Not printed)
Prints HRI (human readable interface) characters above or below the bar code.
Select pitch of HRI characters ASCII
GS f n
Hexadecimal 1D 66 n Decimal 29 102 n Value of n:
1 = Compressed Pitch at 20 CPI Default:
0 (Standard Pitch at 15 CPI)
0 = Standard Pitch at 15 CPI
Selects standard and compressed font for printing bar code characters.
Select bar code height ASCII
GS h n
Hexadecimal 1D 68 n Decimal 29 104 n Value of n:
Number of dots
Range of n:
1–255
Default:
216
Sets the bar code height to (n/154 inch).
Page 99
A795 User Guide: Programming Supplement
Revision E May 2005
99
Chapter 4: Programming commands
Print bar code First Variation
Second Variation
ASCII GS k m d1…dk NUL GS k m n d1…dn Hexadecimal 1D 6B m d1…dk 00 1D 6B m n d1…dn Decimal 29 107 m d1 dk 0 29 107 m n d1…dn (0 = End of command)
Selects the bar code type and prints a bar code for the ASCII characters entered. If the width of the bar code exceeds one line, the bar code is not printed. There are two variations to this command. The first variation uses a NUL character to terminate the string; the second uses a length byte at the beginning of the string to compensate for the code 128 bar code, which can accept a NUL character as part of the data. With the second variation, the length of byte is specified at the beginning of the string. Bar codes can be aligned left, center, or right using the align positions command (1B 61).
The check digit is calculated for UPC and JAN (EAN) codes if it is not sent from the host computer. Sixcharacter zero-suppressed UPC-E tags are generated from full 11 or 12 characters sent from the host computer according to standard UPC-E rules. Start/stop characters are added for code 39 if they are not included. Rotated barcodes set with small modules (select bar code width command 1D 77 n , with n=1 or 2) and PDF 417 barcodes in any orientation are printed at low speed, for better readability. Exceptions
The command is only valid at the beginning of a line. Illegal data cancels the command. Values:
First variation: String terminated with NUL character m
Bar code d1...dk n, length
0
UPC-A
48–57 (ASCII numerals)
Fixed length: 11, 12
1
UPC-E
48–57
Fixed length: 11, 12
2
JAN13 (EAN)
48–57
Fixed length: 12, 13
3
JAN8 (EAN)
48–57
Fixed length: 7, 8
4
Code 39
48- 57, 65- 90 (ASCII alphabet), 32, 36, 37, 43, 45, 46, 47 (ASCII special characters) d1 = dk = 42 (start/stop code is supplied by printer if necessary)
Variable length
5
Interleaved 2 of 5
48–57
Variable length (even number)
6
Codabar
65–68, start code 48–57, 36, 43, 45, 46, 47, 58
Variable length
10
PDF 417
32–255
Variable length
Print bar code (continued)
Page 100
100
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
Second variation length of byte specified at beginning of string. The value of m selects the bar code system as described in the table. When details present in the print buffer, the printer processes the data following m as normal data.
The variable d indicates the character code to be encoded into the specified bar code system. See the table. If character code d cannot be encoded, the printer prints the bar code data processed so far, and the following data is treated as normal data.
m
Bar code d1...dk n, length
65
UPC-A
48–57 (ASCII numerals)
Fixed length: 11, 12
66
UPC-E
48–57
Fixed length: 11, 12
67
JAN13 (EAN)
48–57
Fixed length: 12, 13
68
JAN8 (EAN)
48–57
Fixed length: 7, 8
69
CODE39
48–57, 65–90 (ASCII alphabet), 32, 36, 37, 43, 45, 46, 47 (ASCII special characters) d1 = dk = 42 (start/stop code is supplied by printer if necessary)
Variable
70
Interleaved 2 of 5 (ITF)
48–57
Variable (even number)
71
CODABAR (NW-7)
65–68, start code 48- 57, 36, 43, 45, 46, 47, 58
Variable
72
Code 93
00–127
Variable
73
Code 128
0–105 d1 = 103-105 (must be a start code) d2 = 0–102 (data bytes) (Stop code is provided by the printer)
Variable
75
PDF 417
0–255
Variable length
Exceptions
Code 93 and PDF 417 are only available in A795 native mode.