Shandong New Beiyang Information Technology Co. BTP-M280 Programming Manual

CONFIDENTIAL
PROGRAMMING MANUAL
Receipt Printer
BTP-M280
Shandong New Beiyang Information Technology Co., Ltd.
- 2 -
REVISION HISTORY
Date Version Description Drafted by
August 27, 2007 1.00
Primary version Mr. Zhuan Long Yu
November 11,2007 1.01
Add the options of 857/125 and 1257 (code page)
Mr. Zhuan Long Yu
January 16,2008 1.03 Adjust the format of Appendix A Mr. Zhuan Long Yu
Confidential BTP-M280 Programming Manual
Declaration
If you need this manual, please comply with the Clause as below.
If you disagree with it, please return this manual immediately.
This manual contains the private confidential information belonging to Shandong New Beiyang
Info-Tech Co., Ltd. (hereinafter referred to as SNBC) or its distributors. You must keep its relative
content as the confidential information. If the users are commercial customers or entities, you should
be aware to disclose it to those people with the confidential responsibility including your employees,
agencies and partners. When you terminate the cooperation with SNBC or bring about your request,
you have to stop using this manual and return it to SNBC or its distributor, or destroy the confidential
information.
If any relative organ such as court, arbitrator or government authority requests you to disclose any
confidential information of this manual, you must inform SNBC quickly and also agree that you shall
cooperate or assist with SNBC reasonably during the negotiation.
SNBC has the right to disclose its confidential information and does not be responsible for the loss or
damages caused from the wrong usage or reference of this manual by users.
Information in this document is subject to change without notice, which is only used for product
maintenance or service relative to this manual. SNBC reserves the right to improve products as new
technology, components, software, and firmware become available. If users need further data about
the products, please feel free to contact SNBC or your local distributor.
No part of this document may be reproduced or transmitted in any form or by any means, electronic or
mechanical, for any purpose without the express written permission of SNBC.
Copyright
Copyright© 2007 by SNBC
Printed in China
Version 1.03
Trademarks
- 3 -
Our registered trademarks are
Contact us
Address: No.169 Huoju Rd, Hi-Tech Zone, Weihai, Shandong, China.
Postcode: 264209
Hot line: +86-631-5673777
Fax: +86-631-5673778
E-mail:
sales@newbeiyang.com
Confidential BTP-M280 Programming Manual
- 4 -
Contents
1 Overview ..............................................................................................................................................7
1.1 COMMANDS CLASSIFICATION..............................................................................................................7
1.2 KEY TERMS.......................................................................................................................................7
1.3 COMMAND FORMAT ...........................................................................................................................7
2 Command Description........................................................................................................................9
2.1 PRINT COMMAND...............................................................................................................................9
LF......................................................................................................................................................9
CR.....................................................................................................................................................9
ESC J n.............................................................................................................................................9
ESC K n ..........................................................................................................................................10
ESC d n...........................................................................................................................................10
ESC e n...........................................................................................................................................10
2.2 LOCATION COMMAND....................................................................................................................... 11
HT ...................................................................................................................................................11
ESC D n1...nk NUL .........................................................................................................................12
ESC a n...........................................................................................................................................12
GS ( F PL PH a m nL nH.................................................................................................................13
GS FF..............................................................................................................................................14
2.3 CHARACTER COMMANDS .................................................................................................................14
ESC SP n........................................................................................................................................14
ESC ! n............................................................................................................................................14
ESC % n..........................................................................................................................................16
ESC & y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]......................................................................16
ESC – n...........................................................................................................................................18
ESC ? n...........................................................................................................................................18
ESC E n ..........................................................................................................................................19
ESC G n..........................................................................................................................................19
ESC M n ..........................................................................................................................................20
ESC R n..........................................................................................................................................20
Confidential BTP-M280 Programming Manual
- 5 -
ESC t n............................................................................................................................................21
ESC { n............................................................................................................................................21
FS ! n...............................................................................................................................................22
FS &................................................................................................................................................23
FS – n..............................................................................................................................................23
FS ...................................................................................................................................................23
FS 2 c1 c2 d1...dk...........................................................................................................................23
FS ? c1 c2.......................................................................................................................................24
FS C n.............................................................................................................................................25
FS S n1 n2......................................................................................................................................25
FS W n............................................................................................................................................25
2.4 BITMAP COMMAND...........................................................................................................................26
ESC * m nL nH d1... dk...................................................................................................................26
FS p n m..........................................................................................................................................27
FS q n [xL xH yL yH d1...dk]1...[xL xH yL yH d1...dk]n.................................................................... 27
2.5 REAL-TIME COMMAND......................................................................................................................29
DLE EOT n......................................................................................................................................29
ESC u n...........................................................................................................................................31
ESC v..............................................................................................................................................31
GS a n.............................................................................................................................................32
GS r n..............................................................................................................................................33
2.6 OTHER COMMANDS .........................................................................................................................34
DLE ENQ n .....................................................................................................................................34
DLE DC4 fn m t...............................................................................................................................35
XON ................................................................................................................................................35
XOFF...............................................................................................................................................35
ESC 2..............................................................................................................................................36
ESC 3 n...........................................................................................................................................36
ESC <..............................................................................................................................................36
ESC = n...........................................................................................................................................36
ESC @............................................................................................................................................36
Confidential BTP-M280 Programming Manual
- 6 -
ESC U n..........................................................................................................................................37
ESC c 3 n........................................................................................................................................37
ESC c 4 n........................................................................................................................................38
ESC c 5 n........................................................................................................................................38
ESC I...............................................................................................................................................38
ESC m .............................................................................................................................................39
ESC p m t1 t2..................................................................................................................................39
ESC r n............................................................................................................................................39
GS ( A pL pH n m............................................................................................................................39
GS ( C pL pH m fn b [c1 c2] [d1...dk]...............................................................................................40
(Function 0)GS ( C pL pH m fn b c1 c2 (fn = 0, 48).........................................................................41
(Function 1)GS ( C pL pH m fn b c1 c2 d1...dk (fn = 1, 49).............................................................41
(Function 2)GS ( C pL pH m fn b c1 c2 (fn = 2, 50).........................................................................41
(Function 3)GS ( C pL pH m fn b (fn = 3, 51) ..................................................................................42
(Function 4)GS ( C pL pH m fn b (fn = 4, 52) ..................................................................................42
(Function 5)GS ( C pL pH m fn b (fn = 5, 53) ..................................................................................42
(Function 6)GS ( C pL pH m fn b d1 d2 d3 (fn = 6, 54) ...................................................................42
GS ( D pL pH m [a1 b1]...[ak bk].....................................................................................................43
GS ( E pL pH fn [parameters]..........................................................................................................43
(Function 1)GS ( E pL pH fn d1 d2 (fn = 1) .....................................................................................44
(Function 3)GS ( E pL pH fn [a1 b18...b11]...[ak bk8...bk1] (fn = 3)................................................44
(Function 4)GS ( E pL pH fn a (fn = 4) ............................................................................................ 45
(Function 5)GS ( E pL pH fn [a1 n1L n1H ]...[ak nkL nkH] (fn = 5)..................................................45
(Function 6)GS ( E pL pH fn a (fn = 6) ............................................................................................ 46
(Function 11)GS ( E pL pH fn a d1 … dk (fn = 11)..........................................................................46
(Function 12)GS ( E pL pH fn a (fn = 12) ........................................................................................47
GS V m ②GS V m n.................................................................................................................... 47
3 Programming Process Guide...........................................................................................................49
Appendix...............................................................................................................................................50
APPENDIX AControl Sequences .......................................................................................................50
- 7 -
1 Overview
This manual classifies the printer commands into several kinds based on its functions, and also
describes the applications of relative commands in detail depending on its sorts. We hope that it is
helpful for programmers to get known of those commands.
1.1 Commands classification
This receipt printer commands are classified as below:
Print commands: used for printing and feeding paper;
Position commands: to control the print position;
Character commands: to set characters property;
Bitmap commands: to download bitmap and print, including NV bitmap;
Status commands: used for printer status query;
Other commands: used for periphery control, Micro-definition and initialization;
Command instruction refers to the detailed function of relative commands.
1.2 Key terms
Real-time commands – These commands are acted on immediately upon being received by the
printer.
Print buffers – used to store figure data to be printed; Marked paper mode – Printer woks in the mode with marked paper; Line beginning – The status after executing the commands like LF, CR, ESC J, ESC K, ESC d, ESC e; namely the position for starting the print is at the beginning of print buffers. Kanji character – Multi-byte code character is the character as simplified Chinese, traditional Chinese,
Japanese and Korean.
NV – Non-volatile memory in which data stored does not loss when power off. ASB – Auto status back. Font A – 9 x 9 dot matrix ASCII character. Font B – 7 x 9 dot matrix ASCII character.
1.3 Command format
[Function] The name and function summary of commands; [Format] The command expressed in ASCII, Hex and Decimal separately. If not specified, the
value in “range” part is decimal. For instance, in range” 1 ≤ n≤ 4”, ‘1’ is not an ASCII
code but a decimal number;
[Range] The value range of parameter in the command; [Note] Explain the main features and application notices of commands; [Default] The initial value used after the printer initialized; [Relative] Other commands related to current commend; [Demo] Example used for current or relative commands.
Confidential BTP-M280 Programming Manual
- 8 -
All command data in programming Demo use HEX. All normal font/characters are data.
There is no explanation for the data of command such as 42 43 which is data. The
font/character underlined and emphasized is a command such as
1B 40. All the data
inside parentheses after all commands in Demo is used to explain the meanings of this
command. The parentheses and data inside it is not the command to be transmitted to
the printer.
Confidential BTP-M280 Programming Manual
2 Command Description
2.1 Print command
LF
[Function] Print and line feed [Format] ASCII LF
Hex 0A
Decimal 10
[Note] This command sets the print position to the beginning of the line. [Reference] ESC 2, ESC 3
CR
[Function] When the command is enabled, it equals to LF; it is used to print the data in the print
buffers when disabled
[Format] ASCII CR
Hex 0D
Decimal 13
[Notes] · This command is set according to the printer configuration. [Relative] LF
ESC J n
[Function] Print the data in print buffers and feed paper n dots (one dot equals to 0.176mm) [Format] ASCII ESC J n
Hex 1B 4A n
Decimal 27 74 n
[Range] 0 ≤n ≤ 255 [Notes] · The paper feed amount set by this command does not affect the values set by ESC 2 or
ESC 3.
[Example] 1B 40 (initialize printer)
41 41 41 41 41 41 41( datas waiting for printing)
1B 4A 32 (print and feed paper 80 mm = 50*0.176)
42 42 42 42 42 42 42
0A ( datas waiting for printing)
execute real results.
- 9 -
Confidential BTP-M280 Programming Manual
ESC K n
[Function] Print and retract paper [Format] ASCII ESC K n
Hex 1B 4B n
Decimal 27 75 n
[Range] 0 n 48 [Notes] Print the data in buffers and retract paper n dots [n x 0.176mm].
If n exceed the paper retraction range, the data in the buffers shall be printed but not
retract paper.
Paper retraction may cause the issues as below:
• The paper feed amount is not correct.
• Retraction noise is bigger than paper feed.
• In paper retraction, the paper may be colored due to ribbon.
ESC d n
[Function] Print and feed n lines [Format] ASCII ESC d n
Hex 1B 64 n
Decimal 27 100 n
[Range] 0 n 255 [Notes] Print the data in the print buffer and feed paper [n x current line spacing].
• The current line spacing is set by ESC 2 or ESC 3.
• The maximum feed amount is 1016 mm (40 inches). If the paper feed amount ( n x line
spacing) of more than 1016 mm (40 inches) is specified, the printer feeds the paper only
1016 mm (40 inches).
[Relative] ESC 2, ESC 3 [Demo]
1B 40Initialize the printer
41 41 41 41 41 41 41Data waiting for printing
1B 64 02(Print and feed paper two lines = 2/6 inch
42 42 42 42 42 42 42
0AData waiting for printing
Execute real results:
ESC e n
[Name] Print and retract paper n lines (n x current line spacing) [Format] ASCII ESC e n
Hex 1B 65 n
Decimal 27 101 n
[Range] 0 ≤ n 2
- 10 -
Confidential BTP-M280 Programming Manual [Note] • If paper retraction spacing is more than 8.46mmthe printer prints the data and does not
retract paper.
• If n exceed the value range, the printer prints the data and does not retract paper.
The paper retraction may cause the issues as below:
• The paper feed distance is not correct.
• Retraction noise is bigger than paper feed.
• In paper retraction, the paper may be colored due to ribbon.
[Relative] ESC 2, ESC 3
2.2 Location command
HT
[Function] Moves the print position to the next horizontal tab position. [Format] ASCII HT
Hex 09
Decimal 9
[Notes] • The default setting of the horizontal tab position for the paper roll is font B (7×9) every 8th
character.
• This command is ignored unless the next horizontal tab position has been set.
• When current buffer is full or current print position is at Max. printable width, the printer
shall execute the printing in the current buffers by sending this command;
• Horizontal tab positions are set with ESC D.
[Relative]
ESC D
[Demo] 0A (set the print start position to the beginning of the line)
1B 40 (initialize printer)
33 33 33 33 33 33
1B 44 08 10 20 00(set the horizontal tab position) 09(move the print position to the next tab)
33 33 33 33
09(the same as above
33 33 33 33
09(the same as above
33 33 33 33
0A(print
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
0A(print
execute real results:
- 11 -
Confidential BTP-M280 Programming Manual
- 12 -
ESC D n1...nk NUL
[Function] Set horizontal tab positions [Format] ASCII ESC D n1... nk NUL
Hex 1B 44 n1...nk 00
Decimal 27 68 n1...nk 0
[Range] 1 ≤ n1 n2 …nk 255
0 k 32
[Notes] Set horizontal tab positions.
• n specifies the column number for setting a horizontal tab position from the beginning of
a line.
• k indicates the total number of horizontal tab positions to be set.
ESC D NUL cancels all horizontal tab positions.
• The horizontal tab position is stored as a value of [character width × n] measured from
the beginning of a line. The character width includes the right-side character spacing,
and double-width characters are set with twice the width of normal characters.
• This command cancels the previous horizontal tab settings.
• Up to 32 tab positions (k = 32) can be set. Data exceeding 32 tab positions is processed
as normal data.
• When [n] k is less than or equal to the preceding value [n] k-1, tab setting is finished and
the following data is processed as normal data.
• The previously specified horizontal tab positions do not change, even if the character
width changes.
[Default] The default tab positions are at intervals of 8 characters for Font B. [Relative] HT
ESC a n
[Function] Select justification [Format] ASCII ESC a n
Hex 1B 61 n
Decimal 27 97 n
[Range] 0 n 2, 48 n 50 [Notes] Align all the data in one line to the specified position,
n selects the justification as follows:
n Justification
0,48 Left justification 1, 49 Centering 2, 50 Right justification
[Default] n = 0 [Demo]
0ASet the print position at the beginning of a line
1B 40(Initialize the printer) 1B 61 00(Set the left alignment of characters)
Confidential BTP-M280 Programming Manual
41 42 43 0A 41 42 43 44 0A 41 42 43 44 45 0A 1B 61 01Set the middle alignment of characters
41 42 43
0A
41 42 43 44 0A 41 42 43 44 45 0A 1B 61 02Set the right alignment of characters
41 42 43
0A
41 42 43 44 0A 41 42 43 44 45 0A
Execute real results:
GS ( F PL PH a m nL nH
[Function] Set orientation excursion of black mark [Format] ASCII GS ( F pL pH a m nL nH
Hex 1D 28 46 pL pH a m nL nH
Decimal 29 40 70 pL pH a m nL nH
[Range] ( pL + ( pH × 256) ) = 4 ( pL = 4 , pH = 0)
1 a 2
m=0, 1, 48, 49
1 (nL + nH × 256) < 3000
[Default] nL= nH = 0,namely when mark sensor detects black mark, the position on current ticket
corresponding to the print head is the start of print which is set. The position on current
ticket corresponding tear position is the one presetted.
[Notes] • a is used to set the excursion of the start print position or tear position.
a Function
1 Set the excursion of the start print position relative to black mark detection position
2 Set the excursion of tear-off position relative to black mark detection position
• m is used to select the excursion as paper feed direction or retraction direction.
m Function
048
The selected excursion is calculated according to paper feed direction
149
The selected excursion is calculated according to retraction direction
The excursion set by nL, nH is corresponding to the actual distance of
(nL+nH×256)×0.176mm.
• In executing GS FF, the excursion settings of the start print position (a=1) is enabled.
• In executing GS V m, the excursion settings of the start print position (a=2) is enabled.
- 13 -
Confidential BTP-M280 Programming Manual
- 14 -
• If you save the settings of this command into the printer, it shall not be lost after printer
turned off or initialization.
• After this command sets the excursion, the settings is effective when printer powered
on again.
[Relative] GS FF, GS V
GS FF
[Name] Feed label to print position [Format] ASCII GS FF
Hex 1D 0C
Decimal 29 12
[Notes] Feed label to print position.
• This Command is valid only when the paper type is set to marked paper.
• Detect black mark and feed paper to the start position of print set by GS F (.
• When black mark is already at the start position of print, the printer shall not feed paper
at the moment it receives this command.
• Never use continuous paper when paper type is set to marked paper, otherwise GS FF
command will cause the printer feeding too long.
[Relative] GS F (
2.3 Character commands
ESC SP n
[Function] Set right-side character spacing( n x 0.158mm) [Format] ASCII ESC SP n
Hex 1B 20 n
Hecimal 27 32 n
[Range] 0 n255 [Default] n = 0 [Demo]
1B 40
1B 20 00(Set right-side character spacing as 0)
41 41 41 41 41
0A
1B 20 06(Set character spacing as 6 * 0.158 = 0.9mm )
42 42 42 42 42
0A
1B 20 0C(Set character spacing as 12 * 0.158 = 1.9mm )
43 43 43 43 43
0A
ESC ! n
[Function] Select print mode(s) [Format] ASCII ESC ! n
Hex 1B 21 n
Hecimal 27 33 n
[Range] 0 ≤ n 255
Confidential BTP-M280 Programming Manual [Notes] • Selects print mode(s) usiing n as follows
Bit 1/0 HEX Decimal Function
0 00 0 Select Font A (9 × 9)
0
1 01 1 Select Font B (7 × 9)
1,2 Undefined
0 00 0 Emphasized mode not selected
3
1 08 8 Emphasized mode selected
0 00 0 Double-height mode not selected
4
1 10 16 Double-height mode selected
0 00 0 Double-width mode not selected
5
1 20 32 Double-width mode selected
6 Undefined
0 00 0 Underline mode not selected
7
1 80 128 Underline mode selected
• Double-height,double-width and underline modes set by this command are effective only
for ASCII characters;
•The printer can underline ASCII characters, but can not underline the space set by HT.
[Default] n = 1 [Relative] ESC -, ESC E [Demo]
1B 40(Initialization) 1B 21 00(Select normal print mode)
48
1B 21 01(Select FONT B)
48
1B 21 08(Select emphasized mode)
48
1B 21 10(Select double-height mode)
48
1B 21 20(Select double-width mode)
48
1B 21 80(Select underline mode)
48
1B 21 B9(Select compress, emphasized,double-width,double-height and underline mode)
48
0A
Results:
- 15 -
Confidential BTP-M280 Programming Manual
- 16 -
ESC % n
[Function] Select/cancel user-defined character set [Format] ASCII ESC % n
Hex 1B 25 n
Hecimal 27 37 n
[Range] 0 n 255 [Notes] Select or cancel the user-defined character set:
• When the LSB of n is 0, the user-defined character set is canceled.
• When the LSB of n is 1, the user-defined character set is selected.
[Default] n = 0 [Relative] ESC &, ESC ?
ESC & y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]
[Function] Define user-defined characters [Format] ASCII ESC & y c1 c2 [x1 d1...d(y
× x1)]...[xk d1...d(y × xk)]
Hex 1B 26 y c1 c2 [x1 d1...d(y
× x1)]...[xk d1...d(y × xk)]
Hecimal 27 38 y c1 c2 [x1 d1...d(y
× x1)]...[xk d1...d(y × xk)]
[Range] y = 2
32 c1 c2 126
When Font A is selected: 0 x 12
When Font A is selected: 0 x 10
0 d1 ... d(y
× xk) ≤ 255
K = C2 – C1 + 1
[Notes] Define the user-defined ASCII character via this command:
• y specifies the number of bytes in the vertical direction.
• c1 specifies the beginning character code for the definition, and c2 specifies the final
code.
• x specifies the number of dots in the horizontal direction.
• d is the data of the downloaded characters.
• The allowable character code range is from ASCII code <20>H to <7F>H (95 characters).
• Max. number of Font A and Font B which could be defined is 20 for each.
• It is possible to define multiple characters for consecutive character codes. If only one
character is desired, use c1 = c2.
• The data to define a user-defined character is (y × x) bytes.
• Set a corresponding bit to 1 to print a dot or 0 to not print a dot.
• The user-defined character definition is cleared when:
ESC ? or ESC @ is executed.
The power is turned off.
[Default] The internal character set [Relative] ESC &, ESC ?,ESC @
Loading...
+ 35 hidden pages