The text of a manual · part 12 of 14
A795 Two-Color Thermal Receipt Printer User Guide: Programming Supplement, pages 111 to 120
Pages 111 to 120 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 111
Revision E May 2005
A795 User Guide: Programming Supplement
111
Chapter 4: Programming commands
Erase user flash sector ASCII GS @ n Hexadecimal 1D 40 n Decimal 29 64 n Value of n:
49 – 50 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. In both cases, all logos and character set definitions are erased and must be redefined. n = 50 (ASCII n = 2) HEX 32
This command erases all sectors available for user data storage. Erases a page of flash memory and sends a carriage return when the operation is complete.
Related information
See command “Flash memory user sectors allocation” (1D 22 55 n1 n2). Important: While erasing flash memory, the printer disables all interrupts, including communications. To provide feedback to the application, the printer responds 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 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 ten seconds after sending the erase user flash sector (1D 40 n) command before sending data.
Page 112
112
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
User storage status (ColorPOS®) ASCII GS 0x97 m n Hexadecimal 1D 97 m n Decimal 29 151 m n Value of m:
m specifies the type of stored object to be reported:
m=0 return the kilobytes (1024) of free user RAM, n = 0 gets largest free block size n = 1 gets the total size free m=1 return the kilobytes of free character & logo flash memory, n = 0 m=3 return the CRC of a logo indexed by n m=5 return the CRC of a macro that has been stored, n = 0
For m = 0 the value of n selects a return of either the largest free block or total free size, since contiguous allocation cannot be assumed as this area is completely under user control through address parameters. n=0 if only one instance of an object type is allowed (macro, user data, user defined characters). n of is the item index when more than one object type m is possible n <= FE, see the comments about logo and character set indexes n = FF : return a list describing all the existing items of type m
Note: When a specific item request is made, a returned CRC value of 0 0 indicates that no item is stored at that index. There is a practically negligible possibility that a valid object will have a 0 0 CRC; if this is of concern, applications should check the object downloaded byte sequence to verify that this is not the case (as well as store the CRC as an “ID” for the object if needed later for return value comparisons).
Downloaded character sets are identified by integer extending the existing code page selection as enumerated in the select international character set (= select character code table) command. The firmware standard list is incrementally extended each time a new single or double byte set is downloaded. Single byte downloaded fonts are selected by m = 3 and 0x40 <= n < 0x80. Since there are only three double-byte character sets supported, the value 0x80 / 0xA0 / 0xC0 selects the first, second, third downloaded double byte font respectively. In return, each downloaded double byte character band is reported individually as 0xC0, 0xC1, 0xC2 … for as many bands as have been defined. This command returns the state of occupancy of available flash storage and user RAM. The printer response for each item is a 4 byte header, 0x1D 0x97 nL nH (number of bytes that follow in the response) and for each item a 4 byte structure: 1st m (type) byte, 2nd n index byte followed by a 2 byte CRC in Lo Hi order of the data string in that storage space. The return for m = 0–2 is the header and one 4-byte item giving remaining storage space in the CRC position in Lo Hi order: 1D 97 4 0 m 0 fL fH, where f is the kBytes of storage remaining. Note that RAM storage space is not content typed, while available flash is statically divided into logo, character set, and user data types. Change of the divisions is possible via flash erasure and flash allocation commands. If the communication protocol is RS-232C – Xon/Xoff, then “X symbol substitution response” should be configured with the setting communications parameters command (US STX , 1F 02)
Page 113
Revision E May 2005
A795 User Guide: Programming Supplement
113
Chapter 4: Programming commands
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. While the printer is running normally, send the command, “Switch to flash download mode” (1B 5B 7D) to leave normal operation and enter the download mode. 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. DIP switch 1 must in UP position during reboot to return to normal printer operation.
When each flash download command is received, the printer returns either ACK or NAK to the host computer when each command is received: • ACK (hexadecimal 06) Sent when the printer has received a host transmission and has completed the request successfully. • NAK (hexadecimal 15) Sent when a request is unsuccessful. Communicates to the printer information downloaded from applications. Data is downloaded to flash memory to query the state of the firmware, calculate the firmware CRC and other functions.
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.
Related information
See entering flash download mode elsewhere in this book to put the printer in flash download mode using the configuration menu.
Page 114
114
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
Return boot sector firmware part number ASCII GS NULL Hexadecimal 1D 00 Decimal 29 0
Returns ACK (Hex 06) + 12 bytes ASCII string describing the flash memory boot sector firmware part number. Ex : 189-1234567A
Exceptions
Available only in download mode.
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 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.
Select flash memory sector to download ASCII GS STX nn Hexadecimal 1D 02 nn Decimal 29 2 nn Value of n:
The flash sector to which the next download operation applies
Range of n:
0
Exceptions
Available only in download mode.
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.
Get firmware CRC ASCII
GS ACK
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.
Page 115
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
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>
Erase all flash contents except boot sector ASCII GS SO Hexadecimal 1D 0E Decimal 29 14
Causes the entire flash memory to be erased.
Exceptions
The printer returns ACK if the command is successful; NAK if it is unsuccessful.
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.
115
Page 116
116
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
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:
low byte of the address
Value of aH:
high byte of the address
Value of cL:
low byte of the count
Value of cH:
high byte of the count
Value of d:
data bytes, 0–255
Value of n (for number of data bytes)
Range of address (aL aH)
Range of count (cL cH)
((cH * 256) + cL)
0000–FFFF (hexadecimal)
0001–FFFF (hexadecimal)
Range:
Addresses run from 0 to 64K.
Contains a start address (aH x 256 + aL) and count (cH x 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 count must always be 256.
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. Related information
Available only in download mode.
Download paper type description (ColorPOS®) ASCII GS Ox8E nL nH d1 … dn Hexadecimal 1D 8E m nL nH d1… dn Decimal 29 142 nL nH d1 … dn
This command will store in flash memory a paper type description identified by the structure in d1..dn, adding the uniquely (by type category and version) identified structure for subsequent use by the set paper type command. nL+ nH *256 define the number of bytes x that follow. These bytes contain the proprietary structure and CRC to operate the thermal print head. This structure contains the hardware parameter values needed to print on formulations of monochrome and two-color thermal papers. New paper definitions should be obtained from trusted sources such as the TPG, Inc. Web site in order to optimize print quality while preventing premature head burnout or other damaging effects. New definitions do not change any which had already been set. If an immediate effect is desired, follow up this command with a set paper type m n (where m n are bytes 0 and 1 of the description). Once stored in flash memory, this paper type, selectable by ID m n, remains a valid choice by the set paper type command until firmware flash memory is erased.
Restrictions: If the value of m n = 0 0, then the command will be ignored. It is thus impossible to overwrite the default monochrome paper setting. This command will be ignored if the head type – carried in the description (d1…dx) – is incompatible with the head type in the printer itself or if a description with ID m n already exists. There is room in firmware flash memory for a maximum of 16 paper type descriptions; of these one is reserved for monochrome descriptions, with m n = 0 0 description that is always populated, and factory preload of two color descriptions. Thus 13 remaining spaces are free for dynamic use; once these are used up further download paper type descriptions will be ignored, and a firmware reload will be necessary to again free up (except for m n = 0 0) the paper type description space.
Page 117
A795 User Guide: Programming Supplement
Revision E May 2005
Chapter 4: Programming commands
Return paper type description (ColorPOS®) ASCII GS Ox8F m Hexadecimal 1D 8F m Decimal 29 143 m Value and range of m:
m is the paper type index, (0< = m< = 15)
This command will return from flash memory a paper type description indexed by m, (0<=m<=15) sending back the data sequence used in the download paper type description command, i.e. the return is 1D 8F m nL nH (d1…dn) which was stored in slot m; or a value of n = 0 if slot m does not have a description stored. m = 0 x ff asks for a return of the current paper type. For all valid descriptions, the last two bytes will be a CRC value and the first 24 bytes will be as shown:
# Bytes Offset
Definition
1
0
Manufacturer paper type category
1
1
Version in type category
1
2
Printhead type
1
3
Structure format type
20
4
Descriptive name as a null terminated ASCII string
Reset firmware 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 re-enter download state unless the external switches are changed.
117
Page 118
118
A795 User Guide: Programming Supplement Chapter 4: Programming commands
This page intentionally left blank.
Revision E May 2005
Page 119
A795 User Guide: Programming Supplement
Revision E May 2005
119
Appendix A: Commands by hexadecimal code
Appendix A: Commands listed by hexadecimal code By command code Note: Bold commands are new two-color, (ColorPOS®) commands. Code (hexadecimal)
Command
Page
09
Horizontal tab
48
0A
Print and feed paper one line
45
0C
Print and return to standard mode
103
0D
Print and carriage return
45
10
Clear printer
38
10 04 n
Real time status transmission (DLE sequence)
92
10 05 n
Real time request to printer (DLE sequence)
93
12
Select double-wide characters
54
13
Select single-wide characters
54
14 n
Feed n print lines
45
15 n
Feed n dot rows
45
16 n
Add n extra dot rows
46
17
46
18
Cancel print data in page mode
103
19
Perform full knife cut (or code 1B 69)
38
1A
Perform partial knife cut (or code 1B 6D)
39
1B (+*.BMP)
Download BMP logo (where +*.BMP is the data from the file, not the filename.)
65
1B 07
Generate tone
39
1B 0C
Print data in page mode
103
1B 12
Select 90 degree counter-clockwise rotated print
54
1B 14 n
Set column
48
1B 16 n
Select pitch (column width)
55
Page 120
120
A795 User Guide: Programming Supplement
Revision E May 2005
Appendix A: Commands by hexadecimal code
Code (hexadecimal)
Command
Page
1B 20 n
Set right-side character spacing
55
1B 21 n
Select print mode
56
1B 24 nL nH
Set absolute starting position
49
1B 25 n
Select or cancel user-defined character set
56
1B 26 s c1 c2 n1 d1...nn dn
Define user-defined character set
57
1B 27 m a0 a1 a2 d1 … dm
Write to user data storage
109
1B 2A m n1 n2 d1...dn
Select bit image mode
66
1B 2D n
Select or cancel underline mode
57
1B 2E m n rL rH d1 … dn
Print advanced raster graphics
67
1B 32
Set vertical line spacing to 1/6 inch
49
1B 33 n
Set vertical line spacing
50
1B 34 m a0 a1 a2
Read from user data storage
109
1B 3A 30 30 30
Copy character set from ROM to RAM
58
1B 3D n
Select peripheral device (for multi-drop)
39
1B 3F n
Cancel user-defined character
58
1B 40
Initialize printer
39
1B 44 [n] k 00
Set horizontal tab positions
50
1B 45 n
Select or cancel emphasized mode
58
1B 47 n
Select or cancel double-strike
59
1B 49 n
Select or cancel italic print
59
1B 4A n
Print and feed paper
47
1B 4B n1 n2 d1...dn
Select single-density graphics
67
1B 4C
Select page mode
104
1B 52 n
Select international character code
60
1B 53
Select standard mode
104