Theory of Operation
Note: The explanation below is based upon normal status mode.
When the printer reports status, it writes the data into its output buffer for the port. That data will reside there until one of three things happens.
- The data is read from the buffer
- The data buffer is overrun, at which point it will wrap around and overwrite the oldest data
- The printer is turned off
A user can read the data and typically find all the status byte available. It is important they read all the data and evaluate each byte returned in order to know the true state of the printer. When the printer is idle, it is not necessary to read the printer as quickly as when it is busy. When printing, I recommend reading the status with each ticket printed in order to know whether it is wise to send another ticket.
It is important to remember that a status is retrieved by reading from the printer, not writing to the printer using <S1>. If the application performs a read, it will get the status bytes that are currently stored in the printer output buffer explaining why the printer is not ready. Restarting the program should not matter. If the data is read before the restart, then they already know the state of the printer. If the program is restarted without reading the data, then the data will still be in the printer buffer to be read.
If the printer itself is tuned off and then back on, it will normally report two bytes Power-On (0x12) and X-On (0x11) representing Ready. When the printer is in an error state when the printer power is cycled, two bytes Power-On (0x12) and X-Off (0x13) representing Not Ready will be returned.
When sending an <S1> to a printer, a response of X-On (0x11) will only come if the printer is on and ready. That is the only possible response. If the printer is not ready, there will be no response to the <S1>. The data that explains why the printer is not ready has already been written to the output buffer for them to read. It only comes once.
For example, as the printer runs out of stock, it will report 3 bytes of data. The bytes, in order, are Ticket ACK (0x6) for the last ticket correctly printed, Out of Stock (0x10) as the opto realizes no more tickets and then X-Off (0x13) representing Not Ready.
Sample code
We strongly advise the user to look at and exercise the C# sample code. In this code, we use a background read thread to perform all reads and report status to the main application. The C# sample code can be found on this page Sample code
Normal status mode (factory default)
While the printer asynchronously sends status messages whenever a change in status occurs, status commands can only be processed when the printer is ready and fully operational (paper loaded, no faults, etc.). In other words, no status responses will be sent while the printer is busy and/or in an error state. Status requests sent while the printer is in a busy/error state will not receive a response, until the printer returns to its ready state. As the printer can only send status when it is operational, the only status messages received in response to an <S1> status request will be X-ON and low paper. All other status messages will be sent once, and only once, as the change in status occurs.
Typical Lemur-X unsolicited and solicited status messages:
Hex | Dec | Description | Unsolicited | Solicited |
---|---|---|---|---|
06H | 6 | TICKET ACK – Sent after each receipt or ticket is printed | YES | NO |
0FH | 15 | LOW PAPER – used with optional low paper sensor | YES | NO |
10H | 16 | OUT OF PAPER – printer runs out of media | YES | NO |
11H | 17 | X-ON – sent when printer goes ready | YES | YES <S1> |
12H | 18 | POWER ON – sent when printer is powered on | YES | NO |
13H | 19 | X-OFF – sent when printer goes busy | YES | NO |
*16H | *22 | TICKET REMOVED – sent when media is taken | YES | NO |
18H | 24 | PAPER JAM – printer is in a media jam error state | YES | NO |
19H | 25 | ILLEGAL DATA – when printer receives illegal data | YES | NO |
1AH | 26 | POWER UP PROBLEM – printer has power up error | YES | NO |
1CH | 28 | DOWNLOAD ERROR – error downloading font or image | YES | NO |
1DH | 29 | CUTTER JAM – cutter knife has failed to move | YES | NO |
* Is only sent when printer path type is set for path 1 – exit opto, by default the printer is not set for this mode. ONLY FOR LEMUR-X WITH PRESENTER.
Alternative status modes
Alternate protocols, “single ticket status mode” and “solicited status mode”, are available, where the printer will process all status requests received during fault conditions. However, in either of these modes, the printer will not send any unsolicited status messages, except for power on (12H) and ticket printed (ACK = 06H).
Single Ticket Status Mode - <s90>
Supported since FGL#6M194 and newer or FGL#6N156 and newer. This alternative protocol disables unsolicited status messages except for power on (12H), ticket printed (ACK = 06H), low paper, ticket waiting and ticket removed. X-ON and X-OFF will still be sent, but only to indicate buffer full/empty status. The printer will respond to all status requests received during an error state. However, non-status related data should not be sent during an error state, as it may cause errors. This mode should only be used when ticket data is sent one ticket at a time. After sending each ticket, the user should send an <S92> status request and receive either a “good status” (41H) or “low paper” prior to sending additional ticket data. (On printers configured with a presenter; a ticket waiting (17H) will be sent unsolicited when the ticket arrives in the presenter and a "ticket removed status" (16H) will be sent prior to the "good status" (41H) message.)
Typical Lemur-X unsolicited and solicited status messages:
Hex | Dec | Description | Unsolicited | Solicited |
---|---|---|---|---|
06H | 6 | TICKET ACK – Sent after each receipt or ticket is printed | YES | NO |
0FH | 15 | LOW PAPER – used with optional low paper sensor | YES | YES <S92> |
10H | 16 | OUT OF PAPER – printer runs out of media | NO | YES <S92> |
11H | 17 | X-ON – sent when printer goes ready | YES | NO |
12H | 18 | POWER ON – sent when printer is powered on | YES | NO |
13H | 19 | X-OFF – sent when printer goes busy | YES | NO |
*16H | *22 | TICKET REMOVED – sent when media is taken | YES | NO |
*17H | *23 | TICKET WAITING – sent when media is presented | YES | YES <S92> |
18H | 24 | PAPER JAM – printer is in a media jam error state | NO | YES <S92> |
19H | 25 | ILLEGAL DATA – when printer receives illegal data | NO | YES <S92> |
1AH | 26 | POWER UP PROBLEM – printer has power up error | NO | YES <S92> |
1CH | 28 | DOWNLOAD ERROR – error downloading font or image | NO | YES <S92> |
1DH | 29 | CUTTER JAM – cutter knife has failed to move | NO | YES <S92> |
41H | 65 | GOOD STATUS – printer is ready | NO | YES <S92> |
* Is only sent when printer path type is set for path 1 – exit opto, by default the printer is not set for this mode. ONLY FOR LEMUR-X WITH PRESENTER.
Solicited Status Mode - <s91>
This alternative protocol disables all unsolicited status messages, except power on (12H) and ticket printed (ACK = 06H). X-ON and X-OFF will still be sent, but only to indicate buffer full/empty status. NOTE: When the printer is in an error state, it will only respond to <S92> status requests. All other data and status requests will be deleted until the printer returns to an error-free condition.
Typical Lemur-X unsolicited and solicited status messages:
Hex | Dec | Description | Unsolicited | Solicited |
---|---|---|---|---|
06H | 6 | TICKET ACK – Sent after each receipt or ticket is printed | YES | NO |
0FH | 15 | LOW PAPER – used with optional low paper sensor | YES | YES <S92> |
10H | 16 | OUT OF PAPER – printer runs out of media | NO | YES <S92> |
11H | 17 | X-ON – sent when printer goes ready | YES | NO |
12H | 18 | POWER ON – sent when printer is powered on | YES | NO |
13H | 19 | X-OFF – sent when printer goes busy | YES | NO |
*16H | *22 | TICKET REMOVED – sent when media is taken | NO | NO |
*17H | *23 | TICKET WAITING – sent when media is presented | NO | YES <S92> |
18H | 24 | PAPER JAM – printer is in a media jam error state | NO | YES <S92> |
19H | 25 | ILLEGAL DATA – when printer receives illegal data | NO | YES <S92> |
1AH | 26 | POWER UP PROBLEM – printer has power up error | NO | YES <S92> |
1CH | 28 | DOWNLOAD ERROR – error downloading font or image | NO | YES <S92> |
1DH | 29 | CUTTER JAM – cutter knife has failed to move | NO | YES <S92> |
41H | 65 | GOOD STATUS – printer is ready | NO | YES <S92> |
* Is only sent when printer path type is set for path 1 – exit opto, by default the printer is not set for this mode. ONLY FOR LEMUR-X WITH PRESENTER.
Disable alternative protocols
To set the printer back to "normal status mode" send the FGL command <cs> once to the printer.
STATUS REQUESTS
Normal mode Status Request - <S1>
As the printer can only send status when it is operational, the only status messages received in response to an <S1> status request will be X-ON and low paper.
Solicited Status Request - <S92>
When operating in either of the alternative status modes, the printer will send status in response to an <S92> command. A 41H is sent to indicate good status. The only time the printer is unable to send a response is when the printer is busy, indicated by sending an X-OFF. Like all status requests, there is a potential response delay of up to a few seconds if the status request is received in the middle of printing a ticket.
Status request frequency
Do not perform excessive status request. Each status query causes an interrupt to the printer and adds to unnecessary overhead. We would normally recommend an interval of 1 sec (or longer if possible).
Path 1 to exit opto configuration - <p16>
The software command <p16> may be sent to the printer to configure path 1 to exit opto configuration. This command only needs to be sent once to make the necessary setting changes, and the printer will reset of receipt of said command. This setting change will still stay in effect even when the power has been cycled to the printer.
STATUS COMMANDS
The status enabled function must be set to activate these commands.
NOTE: All FGL commands are case-sensitive.
NOTE: Because of the new command buffering structure, the printer will no longer respond to status commands immediately. The printer must first process all of the data received prior to the status command. In other words, there is a potential response delay of a few seconds if the status request is received in the middle of printing a ticket. If the status request is sent by itself, the response will still be immediate.
STATUS REQUEST - <S1>
The printer will respond with a one byte status message following the receipt of this command.
PROM TYPE AND TICKET COUNT STATUS REQUEST - <S2>
The printer will respond with a seven digit ticket count followed by the software level of the printer. A typical response will be as indicated below:
0004616 PROM = FGL46G42
DELAYED STATUS REQUEST (end of ticket run status) - <S3> or <s3>
Normally, the printer sends an ack (6) status byte after successfully printing a ticket. Some customers may prefer to receive this ack only after the last ticket in a run is printed. This command will perform that function. It can be sent on the first ticket or every ticket of a run. When the printer is finished with the last ticket, it will issue the acknowledgment. Note: This command remains in effect only for a run of tickets. It must be re-sent with the start of a new run if you desire this status.
NO STATUS - <S5> or <s5>
This feature disables the transmission of all status information, except for x-on/off information. This command remains in effect until power off.
ASCII STATUS - <S6> or <s6>
This feature is for customers whose systems can't handle non-ASCII characters or do not pass on the xon/xoff values. All status information, including the xon/xoff, will have 30h added to them to convert them to an ASCII value. (Values over 20H are unaffected by this command.) This command remains in effect until power off.
DOWNLOAD SPACE AVAILABLE STATUS - <S7>
This feature enables the user to find out how many free bytes are left in the download memory area of the printer. Usually, there are 128k bytes of space available. After downloading some data to the printer, you can use this command to determine how much space is left. This status is sent as an 8 digit hexadecimal count. For example, if 100k bytes are available the count will be 00019000. On the fgl44 printer, the <S7> command can now be used to keep track of both the RAM and flash download space. If you are in temporary mode, the <S7> command will return the amount of RAM space available. If you are in permanent mode, it will display the amount of flash space available. Note: deleting a file from flash does not free up the memory for later use unless the flash is empty. The deleted file space is marked as ‘dirty’. See <S9> command below.
PARTIAL ASCII STATUS - <S8> or <s8>
This feature is for customers whose systems can't handle non-ASCII characters but need valid xon/xoff values. All status information, except for a valid xon/xoff, will have 30h added to them to convert them to an ASCII value. This command remains in effect until power off. Note: xon/xoff status sent in response to an <S1> command will have the 30H added but xon/xoff sent for handshaking will not. (Values over 20H are unaffected by this command.)
DIRTY BYTE TOTAL STATUS - <S9>
This feature enables the user to find out how many dirty bytes there are in the download space of the flash. This status is sent as an 8 digit hexadecimal count. When a file is marked as deleted, its flash space cannot be reused until a reclaim occurs. This space is considered ‘dirty’ space. You can use the <DF9> command to reclaim this space (see the downloading file supplement for more details).
LOW PAPER/JAM STATUS - <s93> and <s94>
This feature is only for Boca Systems printers equipped with a low paper sensor. This feature enables a customer using Boca Systems BiDi printer drivers to read Low Paper status through the operating systems variables know as PRINTER_INFO_2 and PRINTER_INFO_6. The “low-jam” option can be turned on/off. With this option turned on the printer firmware will report low paper as a jam. The current Boca Systems Bi-Di drivers will set the JAM operating systems variable in PRINTER_INFO_2 & PRINTER_INFO_6 indicating the low paper indicator has been triggered. You can read that and know when the printer is running low of paper.
Make sure plenty of stock is loaded, power up the printer, and then send the new FGL text command <s93> to the printer to turn this option on.
<s93> – Turn on ticket low-jam mode. Low paper is reported as jam.
<s94> – Turn off ticket low-jam mode. Return to standard mode.
CLEAR PERMANENT STATUS COMMANDS - <cs>
This command clears all permanent status commands from the Flash memory.
BI-DIRECTIONAL STATUS (for Serial, Ethernet, USB and Bluetooth)
The printer will transmit status information back to the host via the interface (for Serial and USB, make sure the status enabled is set up correctly). The available status codes for all different printer models are as follows:
CODE | DESCRIPTION | |
(HEX) | (DEC) |
|
01H | 01 | REJECT BIN WARNING (3) |
02H | 02 | REJECT BIN ERROR (3) / STX (start of text) |
03H | 03 | PAPER JAM PATH 1 (1) / ETX (end of text) |
04H | 04 | PAPER JAM PATH 2 (1) |
05H | 05 | TEST BUTTON TICKET ACK |
06H | 06 | TICKET ACK |
07H | 07 | WRONG FILE IDENTIFIER DURING UPDATE |
08H | 08 | INVALID CHECKSUM |
09H | 09 | VALID CHECKSUM |
0AH | 10 | OUT OF PAPER PATH 1 (1) / LF (line feed) |
0BH | 11 | OUT OF PAPER PATH 2 (1) |
0CH | 12 | PAPER LOADED PATH 1 (1) |
0DH | 13 | PAPER LOADED PATH 2 (1) / CR (carriage return) |
0EH | 14 | ESCROW JAM (3) |
0FH | 15 | LOW PAPER |
10H | 16 | OUT OF PAPER |
11H | 17 | X-ON |
12H | 18 | POWER ON |
13H | 19 | X-OFF |
14H | 20 | BAD FLASH MEMORY |
15H | 21 | NAK (illegal print command) |
16H | 22 | RIBBON LOW / TICKET TAKEN (4) |
17H | 23 | RIBBON OUT / TICKET WAITING IN PRESENTER |
18H | 24 | PAPER JAM |
19H | 25 | ILLEGAL DATA |
1AH | 26 | POWER UP PROBLEM |
1CH | 28 | DOWNLOADING ERROR |
1DH | 29 | CUTTER JAM |
1EH | 30 | STUCK TICKET (3) or CUT JAM PATH1 (2) |
1FH | 31 | CUT JAM PATH2 (2) |
41H | 65 | PRINTER GOOD (5) |
The above status information can be requested from the printer by sending <S1> (or <S92>) as described previous section.
Note 1: This status information is available only in Ventek Dual Supply Mode.
Note 2: Special firmware releases only.
Note 3: Status messages for printers with magnetic encoding.
Note 4: This status information is available only if set to "Path1 Exit Opto" and ticket taken sensor is installed.
Note 5: This status information is available only if set to "Single Ticket Status Mode" or "Solicited Status Mode".
For more information, please see the programming guide