A798 Thermal Receipt Printer Programming Guide Made under one or more of the following U.S. patents: 4886381, 5579043, 5613787, 5651624, 5713678, 5752779, 5789916, 5800080, 5879090, 5887999, 5975776, 6027266, 6085973, 6089450, 6129465, 6155483, 6404452, 6486902, 6504331, 5749277, 6722754, 6739773, 6784909.
Federal Communications Commission (FCC) Radio Frequency Interference Statement Warning Changes or modifications to this unit not expressly approved by the party responsible for compliance could void the user’s authority to operate the equipment. Note This equipment has been tested and found to comply with the limits for a Class A digital device, pursuant to Part 15 of the FCC Rules.
A798 Programming Guide Revision C 12/09 Contents Contents Chapter 1: About this Guide..................................................................9 How to use this guide..........................................................................9 Where to find the basics......................................................................9 Where to find advanced technical information.................................9 Support.............................................................................
A798 Programming Guide Revision C 12/09 Contents Chapter 4: Programming Commands.................................................29 Commands listed by function...........................................................29 Printer actions....................................................................................29 Print and paper feed .........................................................................29 Vertical and horizontal positioning .................................................
A798 Programming Guide Revision C 12/09 Contents Set relative print position................................................................................ 45 Select justification.............................................................................................. 46 Set left margin..................................................................................................... 46 Set printing area width.....................................................................................
A798 Programming Guide Revision C 12/09 Contents Transmit status.................................................................................................... 71 Send printer software version....................................................................... 72 Real time commands..........................................................................73 Preferred implementation............................................................................... 73 Alternate implementation........
A798 Programming Guide Revision C 12/09 Contents Expanded flash memory allocation............................................................. 98 Select flash area for storing logos and fonts............................................ 98 Erase user flash sector....................................................................................... 99 Flash download................................................................................100 Switch to flash download mode.............................
A798 Programming Guide Revision C 12/09 Contents A798-PG00001C
Chapter 1: About this Guide Revision C 12/09 9 Chapter 1: About this Guide How to use this guide This is a supplemental guide providing programming information on CognitiveTPG’s A798 printer. It is written for techsavvy users who are interested in customizing or adjusting printer functionality and is meant to be used in conjunction with the A798 Thermal Receipt Printer: User Guide.
Revision C 12/09 A798 Programming Guide Chapter 1: About this Guide A798-PG00001C
Revision C 12/09 Chapter 2: Diagnostics and Configuration 11 Chapter 2: Diagnostics and Configuration The A798 printer performs a number of diagnostics that provide useful information about the operating status of the printer. The following diagnostic tests are available. • Start-up diagnostics Performed during the printer’s start-up cycle. • Runtime diagnostics Performed during normal printer operation. • Remote diagnostics Maintained during normal operation and reported in the print test.
Revision C 12/09 Chapter 2: Diagnostics and Configuration Runtime diagnostics Runtime diagnostics (sometimes called level 2 diagnostics) run during normal printer operation.
Revision C 12/09 Chapter 2: Diagnostics and Configuration *** A798 – Diagnostics Form *** Model number Serial number Boot Firmware Revision CRC P/N Flash Firmware Revision CRC P/N H/W parameters Flash Memoriy Size Flash Logos/Fonts Flash User Storage Flash Journal Size SRAM Size CPU Clock Freq. Head setting Pre-Heating Print Density Max Speed Paper Width Max Power Knife Partial Cut Paper Low Sensor : : A798-720D-TD00 C073400014 : : : V1.00 08D3 189-7940154A : : : V1.
Revision C 12/09 Chapter 2: Diagnostics and Configuration Indicators The printer communicates various conditions both visually, with the green LED or audibly, with a series of tones or beeps. The following table lists these indicators.
Revision C 12/09 Chapter 2: Diagnostics and Configuration 15 Printer configuration Printers are shipped with all the functions and parameters preset at the factory. Settings for various printer parameters can be changed. This menu is printed on the receipt and scrolls through instructions for selecting and changing any of the functions or parameters.
Revision C 12/09 Chapter 2: Diagnostics and Configuration Configuring the printer The configuration menu allows you to select functions or change various settings for the printer. Instructions printed on the receipt guide you through the processes. Caution: Be extremely careful changing any of the printer settings to avoid changing other settings that might affect the performance of the printer.
Revision C 12/09 Chapter 2: Diagnostics and Configuration 17 Communication interface To change the communication interface settings, enter the configuration menu, select “Set Communication Interface” from the main menu and answer “Yes” to “SET INTERFACE TYPE?” printed on the receipt. Caution: Be extremely careful changing any of the printer settings to avoid inadvertently changing other settings that might affect the performance of the printer.
Revision C 12/09 Chapter 2: Diagnostics and Configuration Diagnostic modes To change the diagnostic modes enter the configuration menu, select “Set Diagnostic Modes” from the main menu and select one of the following modes: • Normal: normal operating mode of the printer. • Datascope: the receipt printer prints incoming commands and data in hexadecimal format to help troubleshoot communication problems. • Receipt test: the receipt printer prints two code pages to verify proper printing of the receipt.
Revision C 12/09 Chapter 2: Diagnostics and Configuration 19 Enable or disable receipt test mode The receipt test mode verifies proper receipt printing. Receipt test is enabled and disabled by selecting the “Diagnostic Modes” sub-menu of the configuration menu. See “Configuring the printer” for instructions on how to enter the configuration menu. To run the receipt test mode: 1 Enable the receipt test mode in the configuration menu. 2 Exit the configuration menu. 3 Push the paper feed button.
Revision C 12/09 Chapter 2: Diagnostics and Configuration Printer settings and functions To change the printer settings and functions, enter the configuration menu, select the sub-menu from the main menu and answer the questions printed on the receipt until you come to the instructions for selecting the printer settings. Caution: Be extremely careful changing any of the printer settings to avoid inadvertently changing other settings that might affect the performance of the printer.
Revision C 12/09 Chapter 2: Diagnostics and Configuration 21 Select the hardware options sub-menu to set: • Printhead setting This setting is the printhead energy rating and must match the rating marked on the front right of the thermal mechanism in the printer. Whenever a new thermal mechanism is installed, this setting must match the indicated energy rating on the mechanism. (See A798 Service manual for replacing the thermal mechanism.
Revision C 12/09 Chapter 2: Diagnostics and Configuration A798-PG00001C
Revision C 12/09 Chapter 3: Programming the Printer 23 Chapter 3: Programming the Printer Overview of commands Commands control all operations and functions of the printer. This includes selecting the size and placement of characters and graphics on the receipt to feeding and cutting the paper. The programming commands have been organized, in order of hexadecimal code within functional groups. For this reason, “related” commands may not be listed adjacent to one another.
Chapter 3: Programming the Printer Revision C 12/09 Command Description Difference between previous product and new product emulation mode. 1B 4A n Print and feed paper This command uses n in terms of n/360 inches. Since the A793 had a fundamental step of 1/152 inch and the A798 has a fundamental step of 1/203 inch, the actual line spacing will not exactly match the requested spacing. 1B 59 n1 n2 d1...
Revision C 12/09 Chapter 3: Programming the Printer Character appearance The appearance of text can be changed using the following print modes: • Standard • Double-wide • Underlined • Italic • Compressed • Upside-down • Bold • Scaled • Double-high • Rotated • Reverse Width specifications Standard Compressed • Characters per inch: 15.6 • Characters per inch: 20.
Chapter 3: Programming the Printer Revision C 12/09 Print zones for 82.5mm paper Specifications of print zone for 82.5 mm paper: • 640 dots (addressable) @ 8 dots/mm, centered on 82.5mm • Top margin to manual tear-off: 17.8mm (0.70 inches) • Top margin to knife cut: 19.0mm (0.75 inches) • Standard mode: minimum margins: 1.0mm (0.040 inches) Rotated printing commands Three commands control the rotation of printing.
Revision C 12/09 Chapter 3: Programming the Printer 27 Emulation modes The CognitiveTPG A798 printer may be operated in a number of different emulation modes. However, printing characteristics and defaults may differ, depending on the desired mode. Print setup in emulation modes Refer to the chart below for defaults and allowed printing options in each emulation mode. Emulation mode LPI options Font(s) options Native 6.00, 6.77, 7.52, 8.
Chapter 3: Programming the Printer Revision C 12/09 A798-PG00001C
Revision C 12/09 Chapter 4: Programming Commands 29 Chapter 4: Programming Commands Commands listed by function Printer actions Code (hexadecimal) Command Page 10 Clear printer 34 19 Perform full knife cut (or code 1B 69) 34 1A Perform partial knife cut (or code 1B 6D) 34 1B 07 Generate tone 35 1B 3D n Select peripheral device (for multi-drop) 35 1B 40 Initialize printer 35 1B 63 33 n Select paper sensors to output paper end signals (parallel only) 36 1B 63 34 n Select sensors to
Chapter 4: Programming Commands Revision C 12/09 Vertical and horizontal positioning Code (hexadecimal) Command Page 09 Horizontal tab 42 1B 14 n Set column 42 1B 24 nL nH Set absolute starting position 43 1B 32 Set vertical line spacing to 1/6 inch 43 1B 33 n Set vertical line spacing 44 1B 44 [n] k 00 Set horizontal tab positions 44 1B 5C n1 n2 Set relative print position 45 1B 61 n Select justification 46 1D 4C nL nH Set left margin 46 1D 50 x y Set horizontal and ver
Revision C 12/09 Chapter 4: Programming Commands 31 Graphics Code (hexadecimal) Command Page 11 n1 . . . n72 Print raster graphics 65 1B (+*.
Chapter 4: Programming Commands Revision C 12/09 Bar codes Code (hexadecimal) Command Page 1D 48 n Select printing position for HRI characters 83 1D 66 n Select pitch for HRI characters 83 1D 68 n Select bar code height 83 1D 6B m d1…dk 00 or 1D 6B m n d1…dn Print bar code 84 1D 6B FF n Print Multiple Barcodes 85 1D 6B n d1... 00 Print GS1 Databar (formerly RSS), null terminated 87 1D 6B m n L n H d1...
Revision C 12/09 Chapter 4: Programming Commands 33 Flash download Code (hexadecimal) Command Page 1B 5B 7D Switch to flash download mode 100 1D 00 Return boot sector firmware part number 100 1D 01 Return segment number status of flash memory 101 1D 02 nn Select flash memory sector to download 101 1D 06 Get firmware CRC 101 1D 07 Return microprocessor CRC 101 1D 0E Erase all flash contents except boot sector 101 1D 0F Return main program flash CRC 102 1D 10 n Erase selected fl
Chapter 4: Programming Commands Revision C 12/09 Command descriptions Printer actions The printer function commands control the following basic printer functions and are described in order of their hexadecimal codes: • Resetting the printer • Cutting the paper • Opening the cash drawers Clear printer ASCII Hexadecimal Decimal DLE 10 16 Clears the print line buffer without printing and sets the printer to the following condition: • Double-wide command (0x12) is canceled • Line spacing, pitch, and us
Revision C 12/09 Chapter 4: Programming Commands 35 Generate tone ASCII Hexadecimal Decimal ESC BEL 1B 07 27 7 Generates an audible tone. Performed by the printer to signal certain conditions. Related information This command is ignored in LEGACY emulation.
Chapter 4: Programming Commands Revision C 12/09 Select paper sensors to output paper-end signals ASCII Hexadecimal Decimal ESC c 3 n 1B 63 33 n 27 99 51 n Value of n: If either bit 0 or bit 1 is on, the paper roll near-end sensor is selected as the paper sensor outputting paper-end signals. If either bit 2 or bit 3 is on, the paper roll-end sensor is selected as the paper sensor outputting paper-end signals.
Revision C 12/09 Chapter 4: Programming Commands 37 Enable or disable panel button ASCII Hexadecimal Decimal ESC c 5 n 1B 63 35 n 27 99 53 n Value of n: 0 = Enable 1 = Disable Default: 0 (Enable) Enables or disables the paper feed button. If the last bit is 0, the paper feed button is enabled. If the last bit is 1, the paper feed button is disabled.
Chapter 4: Programming Commands Revision C 12/09 Select cut mode and cut paper ASCII Hexadecimal Decimal GS V m 1D 56 m 29 86 m Value of m: Selects the mode as shown in the table. Value of n: Determines cutting position only if m is 65 or 66.
Revision C 12/09 Chapter 4: Programming Commands 39 Print and paper feed The print and feed commands control printing on the receipt and paper feed by the printer. Print and feed paper one line ASCII Hexadecimal Decimal LF 0A 10 Prints one line from the buffer and feeds paper one line. Carriage return/line feed pair prints and feeds only one line. Print and carriage return ASCII Hexadecimal Decimal CR 0D 13 Prints one line from the buffer and feeds paper one line.
Chapter 4: Programming Commands Revision C 12/09 Add n extra dot rows ASCII Hexadecimal Decimal SYN n 16 n 22 n Value of n: Number of extra dot rows Range of n: 0–16 Default: 3 extra dot rows Adds n extra dot rows (n/8 mm, n/203 inch) to the character height to increase space between print lines or decrease the number of lines per inch.
Revision C 12/09 Chapter 4: Programming Commands 41 Print and feed paper ASCII Hexadecimal Decimal ESC J n 1B 4A n 27 74 n Value of n: n/203 inch in A798 native mode, A794 emulation and Application Compatible Escape Commands emulation mode; n/360 inch in A793 emulation mode Range of n: 0–255 Prints one line from the buffer and feeds the paper n/8 mm (n/203 inch). The line height equals the character height when n is too small.
Chapter 4: Programming Commands Revision C 12/09 Vertical and horizontal positioning The horizontal positioning commands control the horizontal print positions of characters on the receipt. The 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 576 printable dots on the 80mm paper.
Revision C 12/09 Chapter 4: Programming Commands 43 Set absolute starting position ASCII Hexadecimal Decimal ESC $ nL nH 1B 24 nL nH 27 36 nL nH Value of n: n = Number of dots to be moved from the beginning of the line. nL = Remainder after dividing n by 256. nH = Integer after dividing n by 256. The values for nL and nH are two bytes in low byte, high byte word orientation. Sets the print starting position to the specified number of dots (up to the right margin) from the beginning of the line.
Chapter 4: Programming Commands Revision C 12/09 Set vertical line spacing ASCII Hexadecimal Decimal ESC 3 n 1B 33 n 27 51 n Value of n: n/406 inch in A798 native mode, A794 emulation n/360 inch in A793 emulation mode n/203 inch in Application Compatible Escape Commands emulation mode Range of n: 0-255 Default: 3.37 mm (0.13 inch) Sets the line spacing to n/16 mm (n/406 inch). The minimum line spacing is 8.5 lines per inch. The line spacing equals the character height when n is too small.
Revision C 12/09 Chapter 4: Programming Commands 45 Set relative print position ASCII Hexadecimal Decimal ESC \ n1 n2 1B 5C n1 n2 27 92 n1 n2 Value of n: To move the relative starting position right of the current position: n = Number of dots to be moved right of the current position n1 = Remainder after dividing n by 256 n2 = Integer after dividing n by 256 The values for n1 and n2 are two bytes in low byte, high byte word orientation.
Chapter 4: Programming Commands Revision C 12/09 In order to improve the speed of printing, the A798 moves the data into a buffer for the printhead when it receives it. When the “Set relative print position” command contains a move to the left, this causes the new data to overstrike the previous data. This behavior can be used to an application’s advantage to provide the ability to create compound characters on the receipt station.
Revision C 12/09 Chapter 4: Programming Commands 47 Exceptions: The command is effective only at the beginning of a line. This command is ignored if the line buffer is not empty. Set printing area width ASCII Hexadecimal Decimal GS W nL nH 1D 57 nL nH 29 87 nL nH Range of nL: 0–255 Range of nH: 0–255 Default: 576 dots (the maximum printable area) ����������������������� ���� ������ ������������� ����� Sets the width of the printing area.
Chapter 4: Programming Commands Revision C 12/09 Text characteristics commands These commands control what the printed information looks like, selection of character sets, definition of custom-defined characters, and setting of margins. The commands are described in order of their hexadecimal codes. The 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 576 printable dots on 80mm paper.
Revision C 12/09 Chapter 4: Programming Commands 49 Select pitch (column width) ASCII Hexadecimal Decimal ESC SYN n 1B 16 n 27 22 n Value of n: 0 = Standard pitch 1 = Compressed pitch Default: 0 (Standard pitch) Selects the character pitch for a print line. Formulas The following table provides the print characteristics for both pitches on the receipt station. Pitch Columns, 80mm Paper Columns, 82.5mm Paper CPI Standard 44 49 15.6 Compressed 56 64 20.
Chapter 4: Programming Commands Revision C 12/09 Select print mode ASCII Hexadecimal Decimal ESC ! n 1B 21 n 27 33 n Value of n: Pitch selection (standard, compressed, double high, or double wide.) Value of n Bit1 Function 0 1 Bit 0 Pitch (See chart below) Standard pitch Compressed pitch Bit 3 Emphasized mode Canceled Set Bit 4 Double-high Canceled Set Bit 5 Double-wide Canceled Set Bit 7 Underlined mode Canceled Set 2 Bits 1, 2 and 6 are not used.
Revision C 12/09 Chapter 4: Programming Commands Select or cancel user-defined character set ASCII Hexadecimal Decimal ESC % n 1B 25 n 27 37 n Value of n: 0 = Code Page 437 1 = User Defined (RAM) 2 = Code Page 850 Range of n: 0–2 Default: 0 (Code Page 437) Selects the character set. When an undefined RAM character is selected, the current active ROM code page character is used. Look in Chapter 3: Programming the Printer, “Character appearance” for the character sets.
Chapter 4: Programming Commands Revision C 12/09 Define extended user-defined character set ASCII Hexadecimal Decimal US & s c1 c2 [character 1 data] ... [character k data] 1F 26 s c1 c2 [character 1 data] ... [character k data] 31 38 s c1 c2 [character 1 data] ...
Revision C 12/09 Chapter 4: Programming Commands 53 Copy character set from ROM to RAM ASCII Hexadecimal Decimal ESC : 0 0 0 1B 3A 30 30 30 27 58 0 0 0 Default: Current active ROM code page Copies characters in the active ROM set to RAM. Use this command to re-initialize the user-defined character set. Code page 437 is copied by default at initialization. This command is ignored if current font is the user font.
Chapter 4: Programming Commands Revision C 12/09 Select or cancel double-strike ASCII Hexadecimal Decimal ESC G n 1B 47 n 27 71 n Value of n: 0 = Off 1 = On (When 0 and 1 are the least significant bit, LSB) Default: 0 (Off ) Turns double-strike mode on or off. Identical to emphasized mode. The printer is reset to the standard print mode after a clear printer (0x10) command is received. Exceptions Only the lowest bit of n is effective. The settings do not apply in page mode.
Revision C 12/09 Chapter 4: Programming Commands Select international character code ASCII Hexadecimal Decimal ESC R n 1B 52 n 27 82 n Value of n: A798 native mode A793 emulation Application Compatible Escape Command emulation (1B 52 n only) 0 = Code Page 437 0 = Code Page 437 0 = U.S.A. 1 = Code Page 850 Not 0 = Code Page 850 1 = France 2 = Code Page 852 2 = Germany 3 = Code Page 860 3 =-U.K.
Chapter 4: Programming Commands Revision C 12/09 Select international character set ASCII: ESC t n Hexadecimal: 1B 74 n Decimal: 27 116 n Value of n: A798 native mode A793 emulation emulation Application Compatible Escape Command (1B 52 n only) 0 = Code Page 437 0 = Code Page 437 0 = U.S.A. 1 = Code Page 850 Not 0 = Code Page 850 1 = France 2 = Code Page 852 2 = Germany 3 = Code Page 860 3 =-U.K.
Revision C 12/09 Chapter 4: Programming Commands 57 Select character size ASCII Hexadecimal Decimal GS ! n 1D 21 n 29 33 n Value of n: 1–8 = vertical number of times active font 1–8 = horizontal number of times active font Range of n: 00–07, 10–17, ...70–77 Default of n: 11 hexadecimal Selects the character height using bits 0 to 2 and selects the character width using bits 4 to 6, as follows: With smoothing enabled, maximum value of 0 + n is 66.
Chapter 4: Programming Commands Revision C 12/09 Select or cancel white/black reverse print mode ASCII Hexadecimal Decimal GS B n 1D 42 n 29 66 n Value of n: 0 = Off 1 = On (When 0 and 1 are the least significant bit, LSB) Range of n: 0–255 Default: 0 (Off ) Turns on white/black reverse print mode. In white/black reverse print mode, print dots and non-print dots are reversed, which means that white characters are printed on a black background.
Revision C 12/09 Chapter 4: Programming Commands 59 Select active user-defined character set Selects user-defined character set number for download or printing. The default at power on is 0. ASCII Hexadecimal Decimal US i n 1F 69 n 31 105 n n = 0 - 127 Set high order bit of n to configure user-defined character set number as the default. To configure the printer to print from the user-defined character set at power, send 1F 03 0F 01 and reset the printer.
Chapter 4: Programming Commands Revision C 12/09 Select bit image mode ASCII Hexadecimal Decimal ESC * m n1 n2 d1 ... dn 1B 2A m n1 n2 d1 ... dn 27 42 m n1 n2 d1 ... dn Value of m: Value of m Mode No. of dots (vertical) No. of dots (horizontal) No.
Revision C 12/09 Chapter 4: Programming Commands 61 Print advanced raster graphics ASCII Hexadecimal Decimal ESC .
Chapter 4: Programming Commands Revision C 12/09 Print Flash Logo ASCII Hexadecimal Decimal FS p n m 1C 70 n m 28 112 n m Print flash logo ID n using mode m. See command 1D 2F m for description of mode m. See command 1C 71 for description of n. Define Flash Logos ASCII Hexadecimal Decimal FS q n [xL xH yL yH d1 …dk]1…[xL xH yL yH d1 …dk]n 1C 71 n [xL xH yL yH d1 …dk]1…[xL xH yL yH d1 …dk]n 28 113 n [xL xH yL yH d1 …dk]1…[xL xH yL yH d1 …dk]n Define n flash logos specified by IDs 1 through n.
Revision C 12/09 Chapter 4: Programming Commands 63 Define downloaded bit image ASCII Hexadecimal Decimal GS * n1 n2 d1 ... dn] 1D 2A n1 n2 d1 ... dn] 29 42 n1 n2 d1 ... dn] Value of n: Value of n1 Value of n2 Value of d 1–72 (8 x n1 = number of horizontal dot columns) 1–64 (number of vertical bytes) Bytes of data (printed down, then across) The number of bytes sent is represented by the following formula: n = 8 x n1 x n2 (n1 x n2 must be less than or equal to 4608).
Chapter 4: Programming Commands Revision C 12/09 Print downloaded bit image ASCII Hexadecimal Decimal GS / m 1D 2F m 29 47 m Value and range of m: This command is used to print a previously stored monochrome or color logo from printer memory on the receipt station. The logo is identified as the one indicated by the most recent select current logo command or 0 if a select current logo command has not yet been given.
Revision C 12/09 Chapter 4: Programming Commands 65 Print raster graphics ASCII Hexadecimal Decimal DC1 n1…..nl (576 dots) for 80 mm paper, or n80 (640 dots) for 82.5 mm paper 11 n1…..n72 (576 dots) for 80 mm paper, or n80 (640 dots) for 82.5 mm paper 17 n1…..nl (576 dots) for 80 mm paper, or n80 (640 dots) for 82.5 mm paper Value and range of n: n1 to n72/n80 corresponds to one dot row data for a thermal receipt printer. Each bit defines whether or not a dot will be printed.
Chapter 4: Programming Commands Revision C 12/09 Transmit peripheral device status (RS-232C printers only) ASCII Hexadecimal Decimal ESC u 0 1B 75 0 27 117 0 Value of returned byte: Bit 0 Bit 1 1 = Drawer 1 Closed 1 = Drawer 2 Closed 0 = Drawer 1 Open 0 = Drawer 2 Open Bits 2–7 are not used. Transmits current status of the cash drawers. One byte is sent to the host computer. In DTR/DSR protocol, the printer waits for DSR = SPACE.
Revision C 12/09 Chapter 4: Programming Commands Transmit paper sensor status ASCII Hexadecimal Decimal ESC v 1B 76 27 118 Values: Status Byte (RS-232C) Bit Function 0 Signifies 1 Signifies 0 Receipt paper Present low sensor is enabled) Low (only if paper 1 Receipt cover Closed Open 2 Receipt paper Present Out 3 Knife position Home position Not home position 4 Not used Fixed to zero Fixed to zero 5 Temperature In valid range Too hot or too cold 6 Voltage In valid range Too hi
Chapter 4: Programming Commands Revision C 12/09 Transmit printer ID ASCII Hexadecimal Decimal GS I n 1D 49 n 29 73 n Value of n: 1, 49 = Printer model ID 2, 50 = Type ID 3, 51 = ROM version ID 4, 52 = Logo Definition Transmits the printer ID specified by n as follows: n Printer ID Specification ID (Hexadecimal) 1, 49 Printer model ID A798 0x24 2, 50 Type ID Installed options Refer to below 3, 51 ROM version ID ROM version 0x00 4, 52 Logo definition Logo definition Refer to next
Revision C 12/09 Chapter 4: Programming Commands 69 Transmit printer ID, remote diagnostics extension ASCII Hexadecimal Decimal GS I @ n 1D 49 40 n 29 73 64 n Values of n: Refer to table Range of n: 32–255 (not all defined, but reserved) Eighteen remote diagnostic items are defined in the following table: eight printer ID items and ten printer tally items. A group of four remote diagnostic functions is assigned to each diagnostic item.
Revision C 12/09 Chapter 4: Programming Commands Value of n (continued) ASCII Hex Dec Remote diagnostic item Function å 86 134 Knife cut tally Clear knife cut tally to 0 ç 87 135 Knife cut tally Return knife cut tally, returns 10 bytes É 90 144 Hours on tally, 8 digit ASCII numeric, Write to NVRAM max 99,999,999 æ 91 145 Hours on tally Write to NVRAM, and print on receipt to verify Æ 92 146 Hours on tally Clear Hours on tally to 0 ô 93 147 Hours on tally Return hou
Revision C 12/09 Chapter 4: Programming Commands 71 Transmit status ASCII Hexadecimal Decimal GS r n 1D 72 n 29 114 n Value of n: 1, 49 = printer status 2, 50 = cash drawer status 4, 52 = Flash memory user sector status Transmits the status specified by n. This is a batch mode command which transmits the response after all prior data in the receive buffer has been processed.
Chapter 4: Programming Commands Revision C 12/09 Flash memory user sector status (n = 4 or n = 52) Bit Off/On Hex Decimal Status for transmit status 0 – – – Undefined. Fixed to off. 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. Off 00 0 Flash logo area adequate, definition stored On 08 8 Flash logo area not adequate Off 00 0 Not used. Fixed to off.
Revision C 12/09 Chapter 4: Programming Commands 73 Real time commands The real time 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 (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 buf
Chapter 4: Programming Commands Revision C 12/09 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.
Revision C 12/09 Chapter 4: Programming Commands 75 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.
Chapter 4: Programming Commands Revision C 12/09 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 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 On 00 40 0 64 Thermal printhead temp. and power supply voltage are in range. Thermal print head temp.
Revision C 12/09 Chapter 4: Programming Commands 77 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.
Chapter 4: Programming Commands Revision C 12/09 Real time printer status transmission ASCII Hexadecimal Decimal GS ENQ 1D 05 29 5 Transmits one byte status of the printer in real time. Value of byte: 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 On 00 08 0 8 Not busy at the RS-232C interface.
Revision C 12/09 Chapter 4: Programming Commands 79 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.
Chapter 4: Programming Commands Revision C 12/09 First Byte (Printer Information) Bit Off/On Hex Decimal Status for USM 0 Off 00 0 Not used. Fixed to off. 1 Off 00 0 Not used. Fixed to off. 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 RS232C interface. Printer is busy at the RS232C interface. 4 On 10 16 Not used. Fixed to on. 5 Off On 00 20 0 32 Receipt cover closed. Receipt cover open.
Revision C 12/09 Chapter 4: Programming Commands Third byte (paper sensor information) Bit Off/On Hex Decimal Status for USM 0 Off On 00 01 0 1 Receipt paper adequate Receipt paper low (if paper low sensor enabled) 1 Off On 00 02 0 2 Receipt paper present 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.
Chapter 4: Programming Commands Revision C 12/09 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.
Revision C 12/09 Chapter 4: Programming Commands 83 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.
Chapter 4: Programming Commands Revision C 12/09 Print bar code First Variation ASCII Hexadecimal Decimal Second Variation GS k m d1…dk NUL GS k m n d1…dn 1D 6B m d1…dk 00 1D 6B m n d1…dn 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.
Revision C 12/09 Chapter 4: Programming Commands 85 Second variation: length n specified at beginning of string. Except as noted, 0 < n < 256. m Bar code d1...
Chapter 4: Programming Commands Revision C 12/09 · Parameters for alignment, height, width, and HRI can be set before or after 1D 6B FF 01 command · No height restriction change from single line barcodes · Quiet zone between barcodes = 10 * module width · No text in between barcodes (results undefined) · Upright, picket fence barcodes only, no upside down or ladder. Extended barcode printing for upside down and ladder barcodes can be done in page mode if required.
Revision C 12/09 Chapter 4: Programming Commands Print GS1 DataBar (formerly RSS), null terminated ASCII Hexadecimal Decimal GS k n d1... 00 1D 6B n d1... 00 29 107 n d1...
Chapter 4: Programming Commands Revision C 12/09 Select PDF 417 parameters ASCII Hexadecimal Decimal GS p a b c d e f 1D 70 a b c d e f 29 112 a b c d e f Value and Ranges: Value: Ranges: a, b = Description: The ratio of bar height to symbol length. a = height limit 1 to 10 b = width limit 1 to 100 c= rows limit 3 to 90 Number of rows in the matrix of code words. d= columns limit 7 to 30 Number of columns in the matrix of code words.
Revision C 12/09 Chapter 4: Programming Commands 89 Sample symbol description: Each PDF 417 symbol consists of 3 to 90 stacked rows surrounded on all four sides by a quiet zone.
Chapter 4: Programming Commands Revision C 12/09 Page mode Page mode is one of two modes that the A798 printer uses to operate. Standard mode is typical of how most printers operate by printing data as it is received and feeding paper as the various paper feed commands are received. Page mode is different in that it processes or prepares the data as a “page” in memory before it prints it. Think of this as a virtual page. The page can be any area within certain parameters that you define.
Revision C 12/09 Chapter 4: Programming Commands 91 Select page mode ASCII Hexadecimal Decimal ESC L 1B 4C 27 76 Switches from standard mode to page mode. After printing has been completed either by the print and return to standard mode (FF) command or select standard mode (1B 53) the printer returns to standard mode. The developed data is deleted after being printed. For more information see page mode in this document.
Chapter 4: Programming Commands Revision C 12/09 Select standard mode ASCII Hexadecimal Decimal ESC S 1B 53 27 83 Switches from page mode to standard mode. In switching from page mode to standard mode, data buffered in page mode are cleared, the printing area set by set print area in page mode (1B 57) is initialized and the print position is set to the beginning of the line.
Revision C 12/09 Chapter 4: Programming Commands 93 Set print area in page mode ASCII Hexadecimal Decimal ESC W n1, n2 ...n8 1B 57 n1, n2 ...n8 27 87 n1, n2 ...n8 Range of n: 0-255 Default: n1-4 = n5 = n6 = n7 = n8 = �� �������� �� 0 64 2 64 2 ���������� ������������������ Sets the position and size of the printing area in page mode.
Chapter 4: Programming Commands Revision C 12/09 Set absolute vertical print position in page mode ASCII Hexadecimal Decimal GS $ nL nH 1D 24 nL nH 29 36 nL nH Sets the absolute vertical print starting position for buffer character data in page mode. The absolute print position is set to [(nL + nH X 256) x (vertical or horizontal motion unit)] inches. The vertical or horizontal motion unit for the paper roll is used and the horizontal starting buffer position does not move.
Revision C 12/09 Chapter 4: Programming Commands 95 Macros These commands are used to select and perform a user-defined sequence of printer operations. Select or cancel macro definition ASCII Hexadecimal Decimal GS : 1D 3A 29 58 Starts or ends macro definition. Macro definition begins when this command is received during normal operation and ends when this command is received during macro definition.
Chapter 4: Programming Commands Revision C 12/09 User data storage Write to user data storage ASCII Hexadecimal Decimal ESC ‘ m a0 a1 a2 d1 ... dm 1B 27 m a0 a1 a2 d1 ... dm 27 39 m a0 a1 a2 d1 ... dm Value of m: 0 – 255 Writes m bytes of data to the user data storage flash page at the address specified. The printer waits for m bytes of data following the 3-byte address, addr. If any of the memory locations addressed by this command are not currently erased, the command is not executed.
Revision C 12/09 Chapter 4: Programming Commands 97 Select memory type (SRAM/flash) where to save logos or user-defined fonts ASCII Hexadecimal Decimal GS “ n 1D 22 n 29 34 n Value of n: 48 – 53 n = 48 (ASCII n = 0) HEX 30 Loads active logo to RAM only. This is used to print a special logo but not have it take up flash memory. A logo defined following this command is not preserved over a power cycle. The printer disables interrupts while writing to flash.
Chapter 4: Programming Commands Revision C 12/09 Expanded flash memory allocation ASCII Hexadecimal Decimal GS “ 0x80 1D 22 80 29 34 128 This sequence of commands is used to specify the number of flash sectors to be used for different applications. The begin and end sequence commands must be sent. All areas do not need to have flash sectors specified. The command to request the number of user sectors is optional.
Revision C 12/09 Chapter 4: Programming Commands 99 Erase user flash sector ASCII Hexadecimal Decimal GS @ n 1D 40 n 29 64 n Value of n: 49 – 51 n = 49 (ASCII n = 1) HEX 31 This command erases all 64K flash memory sectors allocated to user-defined character and logos storage. Those sectors should be erased in two situations: when the logo definition area is full and an application is attempting to define new logos, and when an application wants to replace one user-defined character set with another.
Chapter 4: Programming Commands Revision C 12/09 Flash download These commands are used to load firmware into the printer. The commands are listed in numerical order according to their hexadecimal codes. Each command is described and the hexadecimal, decimal, and ASCII codes are listed. There are three ways to enter the download mode. 1. Powering the printer up with DIP Switch 1 down. 2.
Revision C 12/09 Chapter 4: Programming Commands 101 Return segment number status of flash memory ASCII Hexadecimal Decimal GS SOH 1D 01 29 1 Returns the size of the flash used. There may be 16 (1 Meg) or 32 (2 Meg) sectors in flash memory. This command assures that the firmware to be downloaded is the appropriate size for flash memory. The value returned is the maximum sector number that can be accepted by the select sector to download (1D 02 nn) command. Exceptions Available only in download mode.
Chapter 4: Programming Commands Revision C 12/09 Return main program flash CRC ASCII Hexadecimal Decimal GS SI 1D 0F 29 15 Returns the CRC calculated over the flash firmware code space. The format of the response is ACK . Erase selected flash sector ASCII Hexadecimal Decimal GS DLE n 1D 10 n 29 16 n Value and range of n: 0–7 = 512k bytes flash 0–15 = 1M bytes flash 0–31 = 2M bytes flash Erases the previously selected sector.
Revision C 12/09 Chapter 4: Programming Commands A798-PG00001C 103
Revision C 12/09 Appendix A: Commands by Hexadecimal Code Appendix A: Commands listed by hexadecimal code By command code Code (hexadecimal) Command Page 09 Horizontal tab 42 0A Print and feed paper one line 39 0C Print and return to standard mode 90 0D Print and carriage return 39 10 Clear printer 34 10 04 n Real time status transmission (DLE sequence) 74 10 05 n Real time request to printer (DLE sequence) 77 11 n1 . ..
Appendix A: Commands by Hexadecimal Code Revision C 12/09 105 Code (hexadecimal) Command Page 1B 33 n Set vertical line spacing 44 1B 34 m a0 a1 a2 Read from user data storage 96 1B 3A 30 30 30 Copy character set from ROM to RAM 53 1B 3D n Select peripheral device (for multi-drop) 35 1B 3F n Cancel user-defined character 53 1B 40 Initialize printer 35 1B 44 [n] k 00 Set horizontal tab positions 44 1B 45 n Select or cancel emphasized mode 53 1B 47 n Select or cancel double-stri
Revision C 12/09 Appendix A: Commands by Hexadecimal Code Code (hexadecimal) Command Page 1D 00 Return boot sector firmware part number 100 1D 01 Return segment number status of flash memory 101 1D 02 nn Select flash memory sector to download 101 1D 03 n Real time request to printer (GS sequence) 77 1D 04 n Real time status transmission (GS sequence) 74 1D 05 Real time printer status transmission 78 1D 06 Get firmware CRC 101 1D 07 Return microprocessor CRC 101 1D 0E Erase
Appendix A: Commands by Hexadecimal Code Revision C 12/09 107 Code (hexadecimal) Command Page 1D 6B m d1...dk 00 or 1D 6B m n d1...dn Print bar code 84 Print bar code 84 1D 6B FF n Print Multiple Barcodes 85 1D 6B n d1... 00 Print GS1 Databar (formerly RSS), null terminated 87 1D 6B m n L n H d1...
Appendix B: Resident Character Sets Revision C 12/09 Appendix B: Resident Character Sets Character sets Code page 437 (US) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 737 (Greek) A798-PG00001C 109
Appendix B: Resident Character Sets Revision C 12/09 Code page 850 (Multilingual) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 852 (Slavic) A798-PG00001C 111
Appendix B: Resident Character Sets Revision C 12/09 Code page 857 (Turkish) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 858 (with Eurosymbol) A798-PG00001C 113
Appendix B: Resident Character Sets Revision C 12/09 Code page 860 (Portuguese) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 862 (Hebrew) A798-PG00001C 115
Appendix B: Resident Character Sets Revision C 12/09 Code page 863 (French Canadian) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 865 (Nordic) A798-PG00001C 117
Appendix B: Resident Character Sets Revision C 12/09 Code page 866 (Cyrillic) A798-PG00001C
Revision C 12/09 Appendix B: Resident Character Sets Code page 1252 (Windows Latin 1) A798-PG00001C 119
A798 Thermal Receipt Printer: Programmer Guide A798-PG00001 Rev.