background image

 

BTP-M300 Programming Manual

 

- 30 - 

 

Function 

1,3 Printer 

on-line 

2 Printer 

off-line 

[Notes] 

 

• When the printer is disabled, it ignores all other commands except for this command 

and real-time commands 

(DLE EOT, DLE ENQ, DLE DC4

). 

[Relative]

 

 

DLE EOT, DLE ENQ, DLE DC4 

ESC @ 

[Function] 

 Initialize 

the 

printer 

[Format] 

   ASCII   

ESC   @ 

Hex 

 

 1B 

 

 40 

Decimal   27   

64 

[Notes]

 

Clear the data in the print buffer and set the work mode of printer to the work mode when 

the power was turned on. 

• The NV bitmap data is not cleared. 

• The self-defined characters already defined are cleared. 

• The memory switch settings are not checked. 

• The DIP switch settings are not checked. 

ESC U n 

[Function]

    Select /cancel unidirectional print mode 

[Format]

    ASCII   

ESC   U   n 

Hex 

 

 1B 

 

 55 

 

Decimal   27   

85  n 

[Range] 

  

 n 

 255 

[Notes] 

Select / cancel unidirectional print mode 

• When the LSB of n is 0, unidirectional print mode is turned off. 

• When the LSB of n is 1, unidirectional print mode is turned on. 

• Only the lowest bit of n is enabled. 

• In bi-directional print mode, the print speed is twice the print speed of unidirectional 

printing. But upside may not be aligned with downside due to the printer structure design, 

which is normal. 

[Default] 

 

  n = 0   

ESC c 3 n 

[Function] 

  Select paper sensor to output paper end signal 

[Format] 

   ASCII   

ESC   c   3   n 

Hex 

 

 1B 

 

 63 

33 

Decimal   27   

99  51  n 

[Range] 

  

 n 

 255 

[Notes] 

Select the paper sensor to output paper end signal. Each bit of n is defined as follows: 

Summary of Contents for BTP-M300

Page 1: ...Programming Manual Receipt Printer BTP M300 Shandong New Beiyang Information Technology Co Ltd ...

Page 2: ......

Page 3: ...BTP M300 Programming Manual 1 Revision history Date Version Description Drafted by 2013 3 5 V1 0 Primary version Mr Mu Jianping ...

Page 4: ...on 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 is not 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...

Page 5: ...nd Description 3 2 1 Print command 3 LF 3 CR 3 ESC J n 3 ESC K n 3 ESC d n 4 ESC e n 4 2 2 Location command 5 HT 5 ESC D n1 nk NUL 5 ESC a n 6 GS F PL PH a m nL nH 7 GS FF 7 2 3 Character commands 8 ESC SP n 8 ESC n 8 ESC n 9 ESC y c1 c2 x1 d1 d y x1 xk d1 d y xk 10 ESC n 11 ESC n 12 ESC E n 12 ESC G n 13 ESC M n 13 ESC R n 14 ...

Page 6: ...FS S n1 n2 19 FS W n 19 2 4 Bitmap command 19 ESC m nL nH d1 dk 19 FS p n m 20 FS q n xL xH yL yH d1 dk 1 xL xH yL yH d1 dk n 20 2 5 Status command 22 DLE EOT n 22 ESC u n 24 ESC v 24 GS a n 25 GS r n 26 2 6 Other commands 27 DLE ENQ n 27 DLE DC4 fn m t 28 DLE BS SOH 28 XON 28 XOFF 29 ESC 2 29 ESC 3 n 29 ESC 29 ESC n 29 ...

Page 7: ... n 31 ESC I 32 ESC m 32 ESC p m t1 t2 32 ESC r n 32 GS A pL pH n m 33 GS C pL pH m fn b c1 c2 d1 dk 33 GS D pL pH m a1 b1 ak bk 36 GS E pL pH fn parameters 37 GS H ACK NUL RS RS kc1 kc2 kc3 kc4 41 GS V m GS V m n 41 3 Programming Process Guide 43 Appendix A character index table 44 ...

Page 8: ......

Page 9: ...tus 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 buffer Asian characters Multi byte code character represented by simplified Chinese traditional Chinese Japanese and Korean characters of Asia Some manufacturers call it Asian characters NV memory Non volatile memory in which data stored are not cleared after ...

Page 10: ...M300 Programming Manual 2 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 ...

Page 11: ...mat ASCII CR Hex 0D Decimal 13 Notes Whether the command is enabled or not depends on the printer configuration Relative LF ESC J n Function Print the data in buffer and feed paper n dots 1 dot 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 is not affected by the values set by ESC 2 or ESC 3 Demo 1B 40 initialize printer 41 41...

Page 12: ...nt line spacing is set by ESC 2 or ESC 3 The maximum paper feed amount is 1016 mm If the paper feed amount of more than 1016 mm is specified the printer feeds paper only 1016 mm Relative ESC 2 ESC 3 Demo 1B 40 Initialize the printer 41 41 41 41 41 41 41 Data to be printed 1B 64 02 Print and feed two character lines 2 6 inch 42 42 42 42 42 42 42 0A Data to be printed Result ESC e n Function Print t...

Page 13: ...r will execute the printing in the current buffer by sending this command Horizontal tab positions are set by ESC D Relative ESC D Demo 0A set the print position to the beginning of the line 1B 40 initialize printer 33 33 33 33 33 33 1B 44 08 10 1C 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 3...

Page 14: ... the preceding value n k 1 tab setting is finished and the following data is processed as normal data ESC D NUL cancels all tap position settings 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 character justification mode Format ASCI...

Page 15: ...fset is calculated according to paper feed direction 1 49 The selected offset is calculated according to retraction direction The offset set by nL nH is corresponding to the actual distance of nL nH 256 0 176mm In executing GS FF the offset settings of the start print position a 1 is enabled In executing GS V m the offset settings of the start print position a 2 is enabled If you save the settings...

Page 16: ...ive GS F 2 3 Character commands ESC SP n Function Set right side spacing of ASCII characters to n x 0 158mm Format ASCII ESC SP n Hex 1B 20 n Decimal 27 32 n Range 0 n 255 Default n 0 Demo 1B 40 1B 20 00 Set right side character spacing to 0 41 41 41 41 41 0A 1B 20 06 Set character spacing to 6 0 158 0 9mm 42 42 42 42 42 0A 1B 20 0C Set character spacing to 12 0 158 1 9mm 43 43 43 43 43 0A Result ...

Page 17: ...e the space set by HT Double height double width and underline modes set by this command are effective only for ASCII characters 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 B...

Page 18: ...via this command y specifies the number of bytes in the vertical direction which is fixed to 2 c1 specifies the ASCII beginning character code and c2 specifies the ASCII final character 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 F...

Page 19: ...d ESC n Function Turn underline mode on off Format ASCII ESC n Hex 1B 2D n Decimal 27 45 n Range 0 n 2 48 n 50 Notes Turns underline mode on or off based on the following values of n n Function 0 48 Turn off underline mode 1 49 2 50 Turn on underline mode ...

Page 20: ...orresponding pattern for the internal character is printed If a user defined character has not been defined for the specified character code the printer ignores this command Relative ESC ESC ESC E n Function Turn emphasized mode on off Format ASCII ESC E n Hex 1B 45 n Decimal 27 69 n Range 0 n 255 Notes When the LSB of n is 0 emphasized mode is turned off When the LSB of n is 1 emphasized mode is ...

Page 21: ...le strike is slower than normal print Double strike and emphases mode can not be canceled by each other Printer output is the same in double strike mode and in emphasized mode Default n 0 Relative ESC G Demo See ESC E ESC M n Function Select character font Format ASCII ESC M n Hex 1B 4D n Decimal 27 77 n Range n 0 1 2 48 49 50 Notes Select font according to the value of n n Function 0 48 Select Fo...

Page 22: ...rica 13 Korea Default n 0 Western words n 15 Simplified Chinese ESC t n Function Select code page Format ASCII ESC t n Hex 1B 74 n Decimal 27 116 n Range 0 n 5 16 n 19 n 255 0 n 5 16 n 21 26 n 255 Notes Select character code page specified by n n Character code page 0 Page 0 PC437 USA Standard Europe 1 Page 1 Katakana 2 Page 2 PC850 Multilingual 3 Page 3 PC860 Portuguese 4 Page 4 PC863 Canadian Fr...

Page 23: ...23 n Range 0 n 255 Notes When the LSB of n is 0 upside down print mode is turned off When the LSB of n is 1 upside down print mode is turned on Only the lowest bit of n is valid This command is enabled only when processed at the beginning of a line In upside down print mode the printer rotates the line to be printed by 180 and then prints it Default n 0 Demo 1B 40 1B 7B 00 Turn off upside down pri...

Page 24: ...ters in a line are not of the same height all the characters on the line are aligned at the baseline It is possible to magnify the Asian characters using FS W or FS with the settings of the last received command effective It is possible to turn underline mode on or off using FS or FS with the settings of the last received command effective Default n 0 Relative FS FS W FS Function Select Asian char...

Page 25: ...acters Relative FS FS C FS 2 c1 c2 d1 dk Function Define user defined characters Format ASCII FS 2 c1 c2 d1 dk Hex 1C 32 c1 c2 d1 dk Decimal 28 50 c1 c2 d1 dk Range The value range of c1 c2 is related to different character type Character type c1 c2 Japanese JIS code c1 77H 21H c2 7EH Japanese SHIFT code c1 ECH 40H c2 7EH 80H c2 9EH Simplified Chinese Traditional Chinese Korean c1 FEH A1H c2 FEH 0...

Page 26: ...c2 7EH 80H c2 9EH Simplified Chinese Traditional Chinese Korean c1 FEH A1H c2 FEH Notes Cancel the user defined double byte character specified c1 indicates the first byte of character code and c2 is for the second byte of character code Relative FS 2 FS C FS C n Function Select character code system Format ASCII FS C n Hex 1C 43 n Decimal 28 67 n Range n 0 1 48 49 Notes This command selects Japan...

Page 27: ...e LSB of n is 0 quadruple size mode for Asian characters is turned off When the LSB of n is 1 quadruple size mode for Asian characters is turned on Default n 0 Relative FS 2 4 Bitmap command ESC m nL nH d1 dk Function Select bitmap mode Format ASCII ESC m nL nH d1 dk Hex 1B 2A m nL nH d1 dk Decimal 27 42 m nL nH d1 dk Range m 0 1 2 3 1 nL nH 256 1023 0 nL 255 0 nH 3 0 d 255 K nL nH 256 Notes m spe...

Page 28: ...1 48 49 Notes Print a NV bitmap n using the mode specified by m m Mode Vertical enlargement Horizontal enlargement 0 48 Normal 1 1 1 49 Double width 1 2 n is the number of the NV bitmap defined using the FS q command Note This command is enabled at the beginning of a line NV bitmap is a bitmap which is defined in a non volatile memory by FS q and printed by FS p This command is not effective when ...

Page 29: ...mand is effective only when processed at the beginning of a line This command defines n as the number of NV bitmaps The serial number of every bitmap rises in order from 1 Therefore the first data group xL xH yL yH d1 dk is the data of NV bitmap 1 and the last data group xL xH yL yH d1 dk is the data of NV bitmap n Seven byte data from FS to yH is processed as command data but not as a part of gra...

Page 30: ...rm printing Printing of the NV bitmap is performed by the FS p command Define the relation between bitmap and bitmap data as below Relative FS p 2 5 Status command DLE EOT n Function Real time status transmission Format ASCII DLE EOT n Hex 10 04 n Decimal 16 4 n Range 1 n 4 Notes Transmit the printer status specified by n at real time n Function n 1 Transmit printer status n 2 Transmit off line st...

Page 31: ...rror HP error and input voltage error n 3 Error status Bit 0 1 HEX Decimal Function 0 0 00 0 Fixed to 0 1 1 02 2 Fixed to 1 0 00 0 No carriage error 2 1 04 4 Carriage error 0 00 0 No cutter error 3 1 08 8 Cutter error 4 1 10 16 Fixed to 1 0 00 0 No unrecoverable error 5 1 20 32 Unrecoverable error occurs 0 00 0 No auto recovery error 6 1 40 64 Auto recovery error occurs 7 0 00 0 Fixed to 0 Bit 5 U...

Page 32: ...d can be executed as soon as the printer receives it This command can be forbidden by GS D This command is valid for printers with serial parallel or USB interface Relative DLE ENQ GS a GS r GS D ESC u n Function Peripheral status transmission Format ASCII ESC u n Hex 1B 75 n Decimal 27 117 n Range n 0 48 Notes Transmit peripheral status and the returned status information is defined as below Bit ...

Page 33: ...y of the status items in the table above is enabled the printer returns automatically four byte printer status when the status changes If all status items are disabled the ASB function is also disabled The status bytes are transmitted by the printer without confirming whether the host is ready to receive data Since this command is executed with other commands in sequence there is a time lag from s...

Page 34: ...hat input voltage is abnormal Bit 6 Auto recovery error refers to print head overheating error which can recover automatically after waiting for a while Third byte paper sensor information Bit 0 1 Hex Decimal Printer status 0 00 0 Paper adequate 0 1 1 03 3 Paper near end 0 00 0 Paper adequate 2 3 1 0C 12 Paper end 4 0 00 0 Reserved 5 6 0 00 0 Reserved 7 0 00 0 Reserved Fourth byte paper sensor inf...

Page 35: ...0 Paper end sensor paper adequate 2 3 1 0c 12 Paper end sensor paper end 4 0 00 0 Reserved 5 6 0 00 0 Reserved 7 0 00 0 Reserved Cash drawer status n 2 50 Bit 0 1 Hex Decimal Status 0 00 0 Cash drawer open 0 1 01 1 Cash drawer closed 1 7 0 00 0 Reserved Relative DLE EOT GS a 2 6 Other commands DLE ENQ n Function Real time request to printer Format ASCII DLE ENQ n Hex 10 05 n Decimal 16 5 n Range n...

Page 36: ... this command these data are executed as this command by the printer Users need to consider this This command should not be used within the data sequence of another command Relative ESC p DLE BS SOH Function Real time command used to query buffer remaining space Format ASCII DLE BS SOH Hex 10 08 01 Decimal 16 8 1 Notes This command queries the remaining size of receive buffer at real time and retu...

Page 37: ...ch about 4 23mm as line spacing Format ASCII ESC 2 Hex 1B 32 Decimal 27 50 Relative ESC 3 ESC 3 n Function Set line spacing to n 0 176 mm Format ASCII ESC 3 n Hex 1B 33 n Decimal 27 51 n Range 0 n 255 Default n 24 Relative ESC 2 ESC Function Move the print head to the original position Format ASCII ESC Hex 1B 3C Decimal 27 60 Notes Move the print head to the original position ESC n Function Select...

Page 38: ...itch settings are not checked ESC U n Function Select cancel unidirectional print mode Format ASCII ESC U n Hex 1B 55 n Decimal 27 85 n Range 0 n 255 Notes Select cancel unidirectional print mode When the LSB of n is 0 unidirectional print mode is turned off When the LSB of n is 1 unidirectional print mode is turned on Only the lowest bit of n is enabled In bi directional print mode the print spee...

Page 39: ... detected Each bit of n is defined as follows Bit 0 1 Hex Decimal Function 0 00 0 Paper near end sensor disabled 0 1 01 1 Paper near end sensor enabled 0 00 0 Paper near end sensor disabled 1 1 02 2 Paper near end sensor enabled 2 7 Undefined When bit 0 or bit 1 of n is 1 paper near end sensor is valid When paper near end is detected the printer will stop printing after completing the printing of ...

Page 40: ...te cash drawer control pulse Format ASCII ESC p m t1 t2 Hex 1B 70 m t1 t2 Decimal 27 112 m t1 t2 Range m 0 1 48 49 0 t1 255 0 t2 255 Notes Output the cash drawer opening pulse specified by t1 and t2 to the connector pin specified by m as follows m Connector pin 0 48 Cash drawer kick out connector pin 2 1 49 Cash drawer kick out connector pin 5 The cash drawer opening time is t1 2 ms and the closin...

Page 41: ...mp 2 50 Printer internal configuration information print 3 51 Cyclic character print Note This command is enabled only when processed at the beginning of a line The printer cuts paper when this command is finished After this command is executed the printer is initialized automatically Hexadecimal dump print cannot exit automatically Please operate according to print prompt information GS C pL pH m...

Page 42: ...sy status Because the data now is being inputted into NV memory at that moment the printer stops receiving other commands Hence during this command operation other commands including real time commands are not allowed to be sent to the printer When function 2 3 4 5 is executed data cannot be transmitted until the returned status is received Function 0 GS C pL pH m fn b c1 c2 fn 0 48 Function Delet...

Page 43: ...ange pL pH 256 5 pL 5 pH 0 m 0 fn 2 50 b 0 32 c1 126 32 c2 126 Notes Return data not more than 64 bytes Ethernet interface does not return data Function 3 GS C pL pH m fn b fn 3 51 Function Query the user data space that has been used Format ASCII GS C pL pH m fn b Hex 1D 28 43 pL pH m fn b Decimal 29 40 67 pL pH m fn b Range pL pH 256 3 pL 3 pH 0 m 0 fn 3 51 b 0 Notes This command is valid for se...

Page 44: ...pH m fn b d1 d2 d3 Decimal 29 40 67 pL pH m fn b d1 d2 d3 range pL pH 256 6 pL 6 pH 0 m 0 fn 6 54 b 0 d1 67 d2 76 d3 82 GS D pL pH m a1 b1 ak bk Function Turn on off real time command Format ASCII GS D pL pH m a1 b1 ak bk Hex 1D 28 44 pL pH m a1 b1 ak bk Decimal 29 40 68 pL pH m a1 b1 ak bk Range pL pH 256 3 5 pL 3 5 pH 0 m 20 a 1 3 b 0 1 48 49 Notes Turn on off real time command pL pH is the byte...

Page 45: ...eter 12 GS E pL pH fn a 12 Query serial communication parameter Notes Frequent command execution may cause damage to NV memory Therefore it is recommended to write the NV memory 10 times or less a day During the processing of this command the printer is in busy status Because the data now is being inputted into NV memory at that moment the printer stops receiving other commands Hence during this c...

Page 46: ...h through the value of b b 48 the corresponding bit is off b 49 the corresponding bit is on b 50 the corresponding bit does not change a 2 Memory switch 2 Status byte Function Value 2 1 2 2 Undefined 50 Simplified Chinese character set mode GB18030 48 2 3 Simplified Chinese character set mode GB2312 49 2 4 2 8 Undefined 50 a 8 Memory switch 8 Status byte Function Value 8 1 8 4 Undefined 50 When to...

Page 47: ...Self defined value 3 Paper width Paper width settings nL nH 256 Paper width 2 57 5 mm 2 26 4 69 5 mm 2 74 5 76 mm 2 99 Default nL nH 256 5 nL 5 nH 0 Function 6 GS E pL pH fn a fn 6 Function Query paper width Format ASCII GS E pL pH fn a Hex 1D 28 45 pL pH fn a Decimal 29 40 69 pL pH fn a Range pL pH 256 2 pL 2 pH 0 fn 6 a 3 Notes Query user self defined value a Self defined value 3 Paper width Dat...

Page 48: ...speed bps d1 d2 d3 d4 d5 1200 49 50 48 48 2400 50 52 48 48 4800 52 56 48 48 9600 57 54 48 48 19200 49 57 50 48 48 Parity settings a 2 d1 Parity 48 None 49 Odd 50 Even Flow control settings a 3 d1 Flow control 48 DTR DSR 49 XON XOFF Data bit length settings a 4 d1 Data bit length 55 7 bits 56 8 bits The communication parameters set by this function can be enabled via executing Function 2 or powerin...

Page 49: ...ameters Format ASCII GS H ACK NUL RS RS kc1 kc2 kc3 kc4 Hex 1D 28 48 06 00 30 30 kc1 kc2 kc3 kc4 Decimal 29 40 72 6 0 48 48 kc1 kc2 kc3 kc4 Range 32 kc1 kc2 kc3 kc4 126 Notes This command is used to determine whether the current print task is completed or not The returned data format 37 22 kc1 kc2 kc3 kc4 00 If sending this command after print command the command will wait for the carriage task an...

Page 50: ...ter n 0 176 mm Note This command is effective at the beginning of a line Under marked paper mode the cutting distance set by n is ineffective The printer locates the mark first and then cuts paper Note Printer cuts paper directly when m 0 48 1 49 Printer cuts paper after feeding the distance from print position to cutter n 0 176mm when m 65 or 66 ...

Page 51: ...sure that the printer status is normal before sending data to print 2 Intitialize the printer Make sure that the previous setting does not affect the current printing 3 Set the print content Set character property bitmap property barcode property etc of the print content so as to get the desired print effect 4 Send the data to be printed including the setting command before printing If the data to...

Page 52: ...K n Print and retract paper 3 ESC M n Select character font 13 ESC m Partial cut 32 ESC p m t1 t2 Generate cash drawer control pulse 32 ESC R n Select an international character set 14 ESC r n Choose print color 32 ESC SP n Set right side spacing 8 ESC t n Select code page 14 ESC u n Peripheral status transmission 24 ESC U n Select cancel unidirectional print mode 30 ESC v Paper status transmissio...

Reviews: