The text of a manual · part 12 of 16
A760 Two-Color Thermal/Impact Hybrid Printer User Guide: Programming Supplement, pages 109 to 118
Pages 109 to 118 of 154
The original document is the PDF (2.3 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 A760
Page 109
Revision F January 2010
A760 User Guide: Programming Supplement
109
Chapter 4: Programming commands
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. The command can be sent multiple times so that several different print areas, aligned in different print directions, can be developed in the printer’s page buffer before being printed using the print page mode commands (0C or 1B 0C). Formulas
)
��������
��
• x0 = [(n1 + n2 × 256) × (horizontal direction of the fundamental calculation pitch)] • y0 = [(n3 + n4 × 256) × (vertical direction of the fundamental calculation pitch)] • dx = [(n5 + n6 × 256) × (horizontal direction of the fundamental calculation pitch)] • dy = [(n7 + n8 × 256) × (vertical direction of the fundamental calculation pitch)] Keep the following notes in mind for this command. • The fundamental calculation pitch depends on the vertical or horizontal direction. • The maximum printable area in the x direction is 576/203 inches. • The maximum printable area in the y direction is 576/203 inches.
��
See the illustration for a graphic representation of the printing area. For more information about the fundamental calculation pitch, see the set horizontal and vertical motion units command (1D 50).
����������
Maximum area specification in page mode ������������������
The starting position of the print area is the upper left of the area to be printed (x0, y0). The length of the area to be printed in the y direction is set to dy inches. The length of the area to be printed in the x direction is set to dx inches. Use the equations to determine the Value of x0, y0, dx, and dy.
Maximizing the possible area in page mode consumes almost all of free RAM. Without any free RAM, bitmap rotations and enlargements cannot be performed. Use the user storage status command (1D 97 m n) to determine the amount of free memory. Exceptions
The command is effective only in page mode.
Page 110
110
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Commands listed by hexadecimal code
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 × 256) × (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. The reference starting position is set by select print direction in page mode (1B 54). This sets the absolute position in the vertical direction when the starting position is set to the upper left or lower right; and sets the absolute position in the horizontal when the starting position is set to the upper right or lower left. The horizontal and vertical motion unit are specified by the set horizontal and vertical minimum motion units (1D 50) command.
The set horizontal and vertical minimum motion units (1D 50) command can be used to change the horizontal and vertical motion unit. However, the value cannot be less than the minimum horizontal movement amount, and it must be in even units of the minimum horizontal movement amount. Formulas
[(nL + nH × 256) × (vertical or horizontal motion unit)] inches. Exceptions
This command is effective only in page mode. If the [(nL + nH × 256) × (vertical or horizontal motion unit)] exceeds the specified printing area, this command is ignored.
Set relative vertical print position in page mode ASCII Hexadecimal Decimal Value:
GS \ nL nH 1D 5C nL nH 29 92 nL nH Formulas
The value for the horizontal and vertical movement cannot be less than the minimum horizontal movement amount, and must be in even units of the minimum horizontal movement amount.
The distance from the current position is set to [(nL + nH × 256) × vertical or horizontal motion unit] inches. The amount of movement is calculated only for the paper roll.
Sets the relative vertical print starting position from the current position. This command can also change the horizontal and vertical motion unit. The unit of horizontal and vertical motion is specified by this command.
When pitch n is specified to the movement downward: nL + nH × 256 = n
1. This command functions as follows, depending on the print starting position set by select print direction in page mode (1B 54):
When pitch n is specified to the movement upward (the negative direction), use the complement of 65536. When pitch n is specified to the movement upward: nL + nH × 256 – 65536 – N
2. When the starting position is set to the upper right or lower left of the printing area, the vertical motion unit (y) is used.
Exceptions
3. When the starting position is set to the upper left or lower right of the printing area, the horizontal motion unit (x) is used.
Any setting that exceeds the specified printing area is ignored.
This command is used only in page mode, otherwise it is ignored.
Page 111
Revision F January 2010
A760 User Guide: Programming Supplement
111
Chapter 4: Programming commands
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. The macro definition is cleared, during definition of the macro when the execute macro (1D 5E) command is received. Normal printing occurs while the macro is defined. When the power is turned on the macro is not defined. The defined contents of the macro are not cleared by the initialize printer (1B 40), thus, the initialize printer (1B 40) command may be used as part of the macro definition.
If the printer receives a second select or cancel macro definition (1D 3A) command immediately after previously receiving a select or cancel macro definition (1D 3A) the printer remains in the macro undefined state. Formulas
The contents of the macro can be defined up to 2048 bytes. Exceptions
If the macro definition exceeds 2048 bytes, excess data is not stored. This command is available in A758 emulation and A760 native modes.
Execute macro ASCII Hexadecimal Decimal
GS ^ r t m 1D 5E r t m 29 94 r t m
Value of r:
The number of times to execute the macro.
Formulas
Value of t:
The waiting time for executing the macro.
The waiting time is t × 100 ms for every macro execution.
Executes a macro. After waiting for a specified period the printer waits for the paper feed button to be pressed. After the button is pressed, the printer executes the macro once. The printer repeats this operation the number of specified times. When the macro is executed by pressing the paper feed button (m = 1), paper cannot be fed by using the paper feed button.
m specifies macro executing mode when the LSB (least significant bit) m = 0 The macro executes r times continuously at the interval specified by t when the LSB (least significant bit) of m = 1. Exceptions
If this command is received while a macro is being defined, the macro definition is aborted and the definition is cleared. If the macro is not defined or if r is 0, nothing is executed. This command is available in A758 emulation and A760 native modes.
Page 112
112
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
MICR commands MICR reading These commands control the Magnetic Ink Character Recognition (MICR) check reader, including how it parses the character strings on checks. The section, MICR parsing, describes how to create a parsing format and how to create and maintain an exceptions table.
Read MICR data and transmit ASCII Hexadecimal Decimal
ESC w 1 1B 77 01 27 119 1
Default:
All data returned
Reads and transmits the MICR data and adds a carriage return (0x0D). If no parsing format is selected with either of the define parsing format commands (see below), all data will be returned, which is the default.
Transmit last MICR read ASCII: Hexadecimal: Decimal:
ESC w R 1B 77 52 27 119 82
Resends the previously decoded MICR data (as if the parsing has not been defined) to the host. The return data is defined in the “Read MICR data and transmit” command (1B 77 01) without parsing and presents the data from the last MICR read since power-up or reset or indicates in the status that no read has yet occurred.
MICR parsing This section describes MICR parsing in detail and includes several examples of useful parsing variations. It also describes how to create a parsing format and how to create and maintain an exception table.
Define parsing format, save in NVRAM ASCII: Hexadecimal: Decimal:
ESC w P d1 d2 … dn 0D 1B 77 50 d1 d2 … dn 0D 27 119 80 d1 d2 … dn 0D
Defines and saves parsing format. See parsing parameter string options in this document. Send with this command the parse data that is to be the default parse string at printer power-up. If no parameters are selected, parsing is not performed.
d1 through dn are the parse string. The string must be CR terminated. If the string has invalid characters in it or is too long, the printer will store a null string, and raw MICR data will be returned.
Define parsing format, do not save permanently ASCII Hexadecimal Decimal
ESC w p 1B 77 70 27 119 112
Defines, but does not save parsing format. See parsing parameter string options in this document. Send this command as often as desired to change the previous parse format string. The data sent with 1B 77 50 will be restored at power-up.
Exception
If no parameters are selected, parsing is not performed.
Page 113
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Parsing parameter string options Variable length fields Variable length field name
Selector
Comments
Transit number
T
Full 9-digit routing/transit number
Bank number
B
Digits 4–8 of transit number
Check digit
D
Digit 9 of transit number
Account number
A
Check serial number
C
Separate from account number
Amount
$
This field may not be present or readable
Variable length field optional modifiers
Selector
Comments
Zero fill to length
0
ASCII zero preceding maximum length
Maximum length nn
1- or 2-digit ASCII number
Remove space/dash
X
Replace space/dash with 0 x
Examples of variable length field format specifications Account #, all characters in the field, keep spaces and dashes A Account #, all characters in the field, replace spaces and dashes xA Account #, maximum 12 characters, keep spaces and dashes 12A Account #, always 12 characters zero filled, remove spaces and dashes 012XA
113
Page 114
114
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Other parameters Error number
E
One digit returned
0
Read OK
1
Read error: bad character, empty field invalid length, check digit invalid
Status
Two digits returned
S
01
No MICR data
09
Mexican check
08
Canadian check
05
Error in transit number
07
Error in account number
04
Error in check serial number
10
Business or commercial check
11
Amount field present
00
No error
Field separator
‘x
Field separator preceded by a single quote, so a field separator of the letter A would be sent as ‘A (0x27 0x41).
If a carriage return is specified as a separator (0x27 0x0D), a final carriage return must still terminate the parsing parameter string.
Continued...
Page 115
Revision F January 2010
A760 User Guide: Programming Supplement
115
Chapter 4: Programming commands Country code
Un
One digit returned n
Returned if US check nothing
Returned if not US check
Country code
One digit returned
Km m
Returned if Canadian check nothing
Returned if not Canadian check
Check type
One digit returned
L
1
Personal check
2
Business or commercial check
Ten parameters are more than enough to specify all variable length fields with a field separator each and other status information that may be helpful to an application. More than 10 parameters are not recommended because they use up space in non-volatile memory (NVRAM) available for the exception table. The parsing parameter string is stored packed in NVRAM starting at word 10, with the total byte length stored in the high order byte of word 10. While most parameters take two bytes of NVRAM, the following parameters take only one byte: B, D, E, S, L. None of the parsing examples in the following section take more than 14 bytes (seven words) of NVRAM. The exception table starts at word 20. If the parsing parameter string extends into word 20, then the first exception table entry is unavailable.
Page 116
116
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Sample parsing formats The following strings show various sample formats that you can use assuming they meet your parsing format needs. Included with the sample format is a description of the data that is returned to the application. ESC w p 18 A <CR>
ESC w p K9 X T 18 X A 04C <CR>
• Maximum 18 characters in the account number
• U.S. check: all nine characters in the transit number (because there are no dashes)
• Final carriage return ESC w p 18 X A <CR>
• Maximum 18 characters in the account number with spaces and dashes removed • Final Carriage Return ESC w p 18 x A <CR>
• Maximum 18 characters in the account number with spaces and dashes replaced with 0
• Canadian check: dash in transit number removed; “9” inserted at beginning, resulting in a fully numeric nine character transit number • All characters in the account number (up to 18) with spaces and dashes removed • Always four characters in the check number (zero-filled if check number is only three characters long) • Final carriage return
• Final carriage return
ESC w p T ‘/ A ‘/ C ‘/ S <CR>
ESC w p 018 A <CR>
• All characters in the transit number
• Always 18 characters in the account number (high order zero-filled if necessary)
• Field separator: /
• Final carriage return ESC w p 018 X A <CR>
• Always 18 characters in the account number with spaces and dashes removed • Final carriage return ESC w p 018 x A <CR>
• Always 18 characters in the account number with spaces and dashes replaced with 0 • Final Carriage Return ESC w p T 18 X A 04C <CR>
• All characters in the transit number • All characters in the account number (up to 18) with spaces and dashes removed • Always four characters in the check number (zero-filled if check number is only three characters long) • Final carriage return
• All characters in the account number • Field separator: / • All characters in the check number • Field separator: / • Two-digit status • Final carriage return
Notes: All parameters are ASCII characters, i.e. greater than or equal to 0x20, with the exception of a non-ASCII character enclosed in single quotes as a field separator. This applies both to parameter specifications sent from application to printer, and to MICR data returned from printer to application. Parameters are positional; their order in the parameter string is the order in which the parsed MICR data will be returned. Unrecognized parameters will be ignored, and processing of the parsing parameters will stop. Any data remaining after the unrecognized parameter will be treated as normal input data. If parameters are not defined (for example, 1B 77 50 <CR> or 1B 77 70 <CR>) parsing is not selected. One status byte followed by all decoded MICR characters will be returned. The chart on the next page is the default parsing format if no other is selected:
Page 117
Revision F January 2010
A760 User Guide: Programming Supplement
117
Chapter 4: Programming commands Status
Status byte value
Good read, data follows
0x00
Bad read, data follows
0x01
No check present, no data
0x02
Paper jam, no data
0x03
No MICR characters, no data
0x04
Once a parsing format is specified, the following values are returned: MICR characters
ASCII
Hexadecimal
Numerics
0 ... 9
0x30 ... 0x30
Space
0x20
Dash
0x2D
-
Field separator* MICR characters
ASCII
Hexadecimal
Numerics
0 ... 9
0x30 ... 0x39
Unrecognized character
?
0x3F
Space
0x20
Amount symbol
&
0x26
Dash symbol
‘
0x27
“on us” symbol
(
0x28
Transit symbol
)
0x29
Country code* *As specified in the parsing parameter string
Page 118
118
Revision F January 2010
A760 User Guide: Programming Supplement Chapter 4: Programming commands
Check serial number Parsing the check serial number Most banks print the check serial number in three easily recognizable spots. The printer firmware will look for the number in these spots, using the following ordered algorithm. The examples use letters to represent symbols on the check: t o $ c x
Transit symbol “on us” symbol Amount symbol Dash Check serial number Any other number
A number bracketed by “on us” symbols in the auxiliary “on us” field is the check serial number. occcccco txxxxxxxxxt xxxxxxxxo
Otherwise, a three or more digit number to the right of the rightmost “on us” symbol, and to the left of the leftmost amount symbol if an amount field is present, is the check serial number. txxxxxxxxxt xxxxxxxxo cccc txxxxxxxxxt xxxxxxxxo cccc $xxxxxx$
If both of these searches fail to produce the check serial number, extract the whole account number field from between the rightmost transit symbol and the rightmost “on us” symbol. A three, four, or five-digit number to the right of the rightmost transit symbol, separated by a space or a dash from the rest of the account number is the check serial number. txxxxxxxxxt cccc xxxxxxxxo txxxxxxxxxt cccc-xxxxxxxxo txxxxxxxxxt cccc xxxxxxxxo xx
If all of these searches fail to produce the distinct check serial number, and the check serial number field has been specified in the parsing parameter string options, no check serial number will be returned. If it is imbedded within the account number field, it will be returned as part of that variable length field.
Exceptions
Some banks print the check serial number in a location that cannot be electronically distinguished without specific exception information, although it can be visually distinguished because it is repeated in the upper right corner of the check. For these cases, the printer can hold up to nine exceptions for specific banks in its non-volatile memory (NVRAM), which is accessed by the read and write NVRAM commands. The specific bank is picked out by its transit number, and the firmware will look in the exception table for a transit number match before looking in the normal check serial number locations. In this example, without an exception table entry, the firmware would always pick the rightmost four-digit number as the check serial number following rule two above. The bank with the three digit check serial number and the four digit extension after the “on us” symbol would need to be exceptionally recognized: txxxxxxxxxt ccc-xxxxxxxxxxoxxxx txxxxxxxxxt xxx-xxxxxxxxxxocccc
In this example, without an exception table entry, the firmware would not be able to pick out the check serial number because it is not separated from the rest of the account number: txxxxxxxxxt ccccxxxxxxxxxxo
In this example, without an exception table entry, the firmware would not be able to pick out the check serial number correctly, because it is imbedded within the rest of the account number: txxxxxxxxxt xxx-ccc-xxxxxxxxxxo