CognitiveTPG A798 User Manual

Page 74

Advertising
background image

Chapter 4: Programming Commands

74

Revision C 12/09

A798-PG00001C

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.

Real time status transmission

GS sequence

DLE sequence

ASCII

GS EOT n

DLE EOT n

Hexadecimal 1D 04 n

10 04 n

Decimal

29 4 n

16 4 n

Value of n:

GS/DLE sequence

1 = Transmit printer status

2 = Transmit RS-232C busy status

3 = Transmit error status

4 = Transmit receipt 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 (1D) and DLE (0x10).
Exceptions

The command is ignored if n is out of range.

Continued...

Advertising