The text of a manual · part 23 of 24
A758 USB Thermal Receipt and Impact Slip Printer Owner's Guide, pages 221 to 230
Pages 221 to 230 of 235
The original document is the PDF (3.8 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 A758
Page 221
Chapter 7: Programming Guide 213
Read from User Data Storage ASCII: ESC 4 m a0 a1 a2 Hexadecimal: 1B 34 m a0 a1 a2 Decimal: 27 52 m a0 a1 a2 Value of m:
0 – 255
Reads m bytes of data from the User Data Storage Flash Page at the address specified. Returns m bytes to the application, followed by a carriage return (0Dh). The high order byte of the address (a0) ranges from 0 to n2-1, with n2 specified in the Flash Allocation command. If the Flash Allocation command has been used, the a0 = 0 always.
Read from Non-Volatile Memory ASCII: ESC j k Hexadecimal: 1B 6A k Decimal: 27 106 k Range of k:
20 – 63 (decimal)
Reads a two-byte word from location k in the history EEROM. The printer returns the word at the next available opportunity.
Write to Non-Volatile Memory (NVRAM) ASCII: ESC s n1 n2 k Hexadecimal: 1B 73 n1 n2 k Decimal: 27 115 n1 n2 k Value of n1 :
1st Byte
Value of n2 :
2nd Byte
Range of k :
20 - 63 (decimal locations)
Writes the two-byte word, n1 n2, to location k in history EEROM.
Select Memory Type (SRAM/Flash) Where to Save Logos or User-Defined Fonts ASCII: GS " n Hexadecimal: 1D 22 n Decimal: 29 34 n Value of n:
48 - 51
Specifies whether to load the logos or user-defined characters to Flash Memory or to RAM (volatile memory). The selection remains in effect until it is changed via this command or until the power cycles. Decimal n = 48 (ASCII n = 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. Decimal n = 49 (ASCII n = 31) A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 222
214 Chapter 7: Programming Guide Loads active logo to Flash Memory. This is the default condition for logo Flash storage. A logo defined following this command is stored in Flash Memory. Decimal n = 50 (ASCII n = 32) Loads user-defined characters to RAM only. This is the default condition for user-defined character storage. Any user-defined characters defined following this command are not preserved over a power cycle. Decimal n = 51 (ASCII n = 33) Loads user-defined characters to Flash Memory. An application must use this command to store user-defined characters in Flash Memory. Any user-defined characters defined following this command are stored in Flash Memory. A userdefined character cannot be redefined in Flash Memory. The Flash Memory page must be erased by an application before redefining user-defined characters. For more information, see the Erase User Flash Sector (1D 40 n) command.
Flash Allocation ASCII: GS " U n1 n Hexadecimal: 1D 22 55 n1 n2 Decimal: 29 34 85 n1 n2 Default Value of n1: Default Value of n2:
1 1
(see below) (see below)
n1 is the number of 64k sectors used for logos and user-defined characters. n2 is the number of 64k sectors used for user data storage. This command sets the allocation of Flash sectors between user data storage and logos/user-defined characters. This allocation is saved in the EEPROM of the printer and is therefore saved across power cycles. The printer will respond to the Flash Allocation command being sent with ACK (06H). A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 223
Chapter 7: Programming Guide 215 n1 + n2 <= 2 (512K) n1 + n2 <= 10 (1M) n1 + n2 <= 26 (2M) The A758 has been configured at the factory with 512K, 1M or 2M of Flash memory. Note: Flash memory is made up of user and program code. Therefore, the available 512K Flash memory space will vary with the amount of program code utilized. If n1 + n2 is greater than the maximum number of sectors available, the command is ignored. Reissuing this command with different parameters will erase all sectors. Exception: This is command is available only in A758 Native Mode
Erase User Flash Sector ASCII: GS @ n Hexadecimal: 1D 40 n Decimal: 29 64 n Value of n:
49 - 50
Erases a page of Flash Memory and sends a carriage return when the operation is complete. n = 49 (ASCII n = 1) This command erases all sectors available for user-defined characters and multiple logos. The page 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
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 224
216 Chapter 7: Programming Guide another. In both cases, all logos and character set definitions are erased and must be redefined. n = 50 (ASCII n = 2) This command erases all sectors available for user data storage. Important: While erasing Flash Memory, the printer disables all interrupts, including communications. To provide feedback to the application, the printer responds (with 0Dh) to the application when the erase is complete. After sending the Erase User Flash Sector (1D 40 n) command, an application should wait for the response (0Dh) from the printer before sending data. Otherwise, data will be lost. If an application is unable to receive data, it should wait a minimum of five seconds after sending the Erase User Flash Sector (1D 40 n) command before sending data.
Flash Download Commands 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.
A758-D100 12/04
1.
Powering the printer up with DIP Switch 1 up.
2.
While the printer is running normally, use the command Switch to Flash Download Mode, to leave normal operation and enter the Download Mode.
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 225
Chapter 7: Programming Guide 217 3.
If the Flash if found corrupted during Level 0 diagnostics the Download Mode is automatically entered after the printer has reset.
The printer never goes directly from the Download Mode to normal printer operation. To return to normal printer operation either the operator must turn the power off and then on to reboot or the application must send a command to cancel Download Mode and reboot.
Switch to Flash Download Mode ASCII: ESC [ } Hexadecimal: 1B 5B 7D Decimal: 27 91 125 Puts the printer in Flash Download Mode in preparation to receive commands controlling the downloading of objects into Flash Memory. When this command is received, the printer leaves normal operation and can no longer print transactions until the Reboot the Printer command (1D FF) is received or the printer is rebooted. This command does not affect the current communication parameters. Once the printer is in Flash Download Mode, this command is no longer available.
Request Printer ID ASCII: GS NUL Hexadecimal: 1D 00 Decimal: 29 0 Returns ACK (06 hex) + 12 bytes ASCII string describing the Flash Memory Boot Sector Firmware part number. Ex : 189-1234567A
Return Segment Number Status of Flash Memory ASCII: GS SOH Hexadecimal: 1D 01 Decimal: 29 1 Returns the size of the Flash used. There may be 8, 16, or 32 sectors (64K each) 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 n) command. Exceptions: Available only in Download Mode. A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 226
218 Chapter 7: Programming Guide
Select Flash Memory Sector to Download ASCII: GS STX n Hexadecimal: 1D 02 n Decimal: 29 2 n Value of n:
the Flash sector to which the next download operation applies
Range of n:
0 – 7 (512K) 0 – 15 (1 mB) 0 – 31 (2 mB)
Selects the Flash sector (nn) for which the next download operation applies. The values of the possible sector are restricted, depending upon the Flash part type. The printer transmits an ACK if the sector number is acceptable or an NAK if the sector number is not acceptable. Sector numbers start at 0. Exceptions: Available only in Download Mode.
Get Firmware CRC ASCII: GS ACK Hexadecimal: 1D 06 Decimal: 29 6 Causes the printer to calculate the CRC for the currently selected sector and transmits the result. This is performed normally after downloading a sector to verify that the downloaded firmware is correct. The printer also calculates the CRC for each sector during power up and halts the program if any sector is erroneous. The printer transmits ACK if the calculated CRC is correct for the selected sector; NAK if the CRC is incorrect or if no sector is selected.
Return Microprocessor CRC ASCII: GS BEL Hexadecimal: 1D 07 Decimal: 29 7 Returns the CRC calculated over the boot sector code space. Formulas: ACK <low byte> <high byte>
A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 227
Chapter 7: Programming Guide 219
Erase the Flash Memory ASCII: GS SO Hexadecimal: 1D 0E Decimal: 29 14 Causes the entire Flash Memory (except the boot) to be erased. The printer returns ACK if the command is successful; NAK if it is unsuccessful. Exceptions: Available only in Download Mode.
Return Main Program Flash CRC ASCII: GS SI Hexadecimal: 1D 0F Decimal: 29 15 Returns the CRC calculated over the Flash firmware code space. The format of the response is ACK <low byte> <high byte>.
Erase Selected Flash Sector ASCII: GS DLE n Hexadecimal: 1D 10 n Decimal: 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. The printer transmits ACK when the sector has been erased. If the previous sector is not successfully erased, or if no sector was selected, the printer transmits NAK. Exceptions: Available only in Download Mode.
Download to Active Flash Sector ASCII: GS DC1 al ah cl ch d1…dn Hexadecimal: 1D 11 al ah cl ch d1…dn Decimal: 29 17 al ah cl ch d1…dn Value of al Value of ah Value of cl Value of ch Value of d
= low byte of the address = high byte of the address = low byte of the count = high byte of the count = data bytes, from 1 to n
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
189-9200399 Rev.A
A758-D100 12/04
Page 228
220 Chapter 7: Programming Guide Contains a start address (ah * 256 + al) and count (ch * 256 + cl) of binary bytes to load into the selected sector, followed by that many bytes. The start address is relative to the start of the sector. Addresses run from 0 to 64K. The printer may return one of several responses. ACK means that the data was written correctly and the host should transmit the next block. NAK means that, for some reason, the data was not written correctly. This could mean that communications failed or that the write to Flash failed. The alternatives seem to be to retry the block or halt loading and assume a hardware failure. Value of n (for number of data bytes)
Range of Address (al ah)
Range of Count (cl ch)
((ch * 256) + cl)
2000-FFFF (hexadecimal)
0001-0400 (hexadecimal)
Range: Addresses run from 0 to 64K. Related Information: Available only in Download Mode.
Reboot the Printer ASCII: GS (SPACE) Hexadecimal: 1D FF Decimal: 29 255 Ends the load process and reboots the printer. Before executing this command, the printer should have firmware loaded and external switches set to the runtime settings. Application software for downloading should prompt the user to set the external switches and confirm before sending this command. If the downloading was started from a diagnostic, the reboot will cause the printer to reenter download state unless the external switches are changed.
A758-D100 12/04
189-9200399 Rev.A
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide
Page 229
Chapter 7: Programming Guide 221
Index, A - A758 printer advanced interface design, 4 configuration, 33 connectivity features, 4
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide description, 60 dimensions, 89 documentation, 57 electronics and software, 4 introducing, 2 migration, 67 optional features, 65
189-9200399 Rev.A
A758-D100 12/04
Page 230
Index ordering supplies, 54 receipt features, 63 reliability, 65 sending in for repair, 25, 51 slip features, 60 slip table, ordering, 57 standard features, 4 test the printer, 32 Accessories. See Supplies Adapters ordering, 55 TPG, Inc. address, 52, 57, B - Bar code commands, 182 Bar codes commands, 182 BASIC sending commands, 92 Beeping sound what to do, 43, C - Cables cash drawer, 16 communication, 14 connecting, 14 power supply, 16 Carriage return usage, 40 Cash drawer connector and pin assignments, 99 Cash drawer cables connecting, 16 Cash drawers ordering, 55 Character pattern standard 15.6 CPI pitch, 73 standard 20.3 CPI pitch, 73 Character set code page 1252, 88 code page 437, 79 code page 850, 80 code page 852, 81 code page 858, 82 code page 860, 83 code page 862, 84 code page 863, 85 code page 865, 86 code page 866, 87 Character sets, 78 Check flip clearing jams, 30 commands, 206 Check flip commands, 206 Check flip test, 39 Checks
A758-D100 12/04
189-9200399 Rev.A printing, 26 validating, 28 verifying, 28 Code Page 437, 79 Code Page 850, 80 Code Page 852, 81 Code Page 858, 82 Code Page 860, 83 Code Page 862, 84 Code Page 863, 85 Code Page 865, 86 Code Page 866, 87 Code Page1252, 88 Code pages, 78 Commands bar code, 182 check flip, 206 descriptions, 117 flash download, 212 graphics, 152 horizontal positioning, 132 listing, 103 macro, 195 MICR, 197 page mode, 188 print, 126 print characteristics, 139 printer function, 117 printer status, 160 real time, 171 real time,rules for using, 171 realtime, moving data through the buffer, 172 user data storage, 208 vertical positioning, 126 Commands, printer function set horizontal and vertical minimum motion units, 131 Commands, real time alternate implementation, 171 first implementation, 171 real time request to printer, GS sequence, 177 recognizing data from the printer, 170 Commands, sending using BASIC, 92 using DOS, 92 Communication overview, 92 Communication cable connecting, 14 ordering, 56 Communication interface. See RS-232C interface or Parallel interface Communication settings, 36 Communications RS-232, 94 Compressed print characters, 70 Configuration menu getting to, 34 sample printout, 35
A758 USB Thermal Receipt and Impact Slip Printer: Owner’s Guide