112

POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

  • Upload
    buihanh

  • View
    260

  • Download
    4

Embed Size (px)

Citation preview

Page 1: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed
Page 2: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

i

POS Printer MP-4200 TH Programmer’s ManualP/N: 501.4421.00 - Revision 1.0

April 2010(First Edition: April 2010)

Copyright© by Bematech S.A. Curitiba-PR, Brazil. All rights reserved.

No part of this publication may be copied, reproduced, adapted or translated without the prior written permission of Bematech S.A., except when allowed by patent rights.

Information in this publication is purely informative, subjected to change without notice and no liability is assumed with respect to its use. However, as product improvements become available, Bematech S.A. will make every effort to provide updated information for the products described in this publication. The latest version of this manual can be obtained through Bematech web site:

www.bematech.com

Not withstanding the other exceptions contained in this Manual, the consequences and responsibility are assumed by the Purchaser of this product or third parties as a result of: (a) intentional use for any improper, unintended or unauthorized applications of this product, including any particular purpose; (b) unauthorized modifications, repairs, or alterations to this product; (c) use of the product without complying with Bematech S.A. Corporation’s operating and maintenance instructions; (d) use of the product as component in systems or other applications in which the failure of this could create a situation where personal injury or material damages may occur. In the events described above, Bematech S.A. and its officers, administrators, employees, subsidiaries, affiliates and dealers shall not be held responsible or respond by any claim, costs, damages, losses, expenses and any other direct or indirect injury, as well as claims which alleges that Bematech S.A. was negligent regarding the design or manufacture of the product.

Bematech S.A. shall not be liable against any damages or problems arising from the use of any options or any consumable products other than those designated as original Bematech products or approved products by Bematech S.A.

Any product names or its logotypes mentioned in this publication may be trademarks of its respective owners and shall be here recognized.

Product warranties are only the ones expressly mentioned in the User’s Manual. Bematech S.A. disclaims any and all implied warranties for the product, including but not limited to implied warranties of merchantability or fitness for a particular purpose. In addition, Bematech S.A. shall not be responsible or liable for any special, incidental or consequential damages or lost profits or savings arising from the use of the product by the Purchaser, the User or third parties.

Page 3: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

ii

Disposal and Recycling Information

General Information This symbol indicates that your product must be disposed of properly according to local laws and regulations. When your product reaches its end of life, contact Bematech or your local authorities to learn about recycling options.

Safety Information

This section presents important information intended to ensure safe and effective use of this product. Please read this section carefully and store it in an accessible location.

Electrical Safety • Topreventelectricalshockhazard,disconnectthepowercablefromtheelectricaloutletbeforerelocatingthe system. • Whenaddingorremovingdevicestoorfromthesystem,ensurethatthepowercablesforthedevicesare unplugged before the signal cables are connected. If possible, disconnect all power cables from the existing system before you add a device. • Before connecting or removing signal cables from the product, ensure that all power cables are unplugged. • Seekprofessionalassistancebeforeusinganadapterorextensioncord.Thesedevicescouldinterruptthe grounding circuit. • Makesurethatyourpowersupplyissettothecorrectvoltageinyourarea.Ifyouarenotesureaboutthe voltage of the electrical outlet you are using, contact your local power company. • Ifthepowersupplyisbroken,donottrytofixitbyyourself.Contactaqualifiedservicetechnicianoryour retailer.

Operation Safety • Before installingtheproductandaddingdeviceson it,carefullyreadall themanuals thatcamewiththe package. • Beforeusingtheproduct,makesureallcablesarecorrectlyconnectedandthepowercablesarenotdamaged. If you detect any damage, contact you retailer immediately. • To avoid short circuits, keep paper clips, screws, and staples away from connectors, slots, sockets and circuitry. • Avoiddust,humidity,andtemperatureextremes.Donotplacetheproductinanyareawhereitmaybecome wet. • Placetheproductonastablesurface. • If you encounter technical problems with the product, contact a qualified service technician or you retailer.

Page 4: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

iii

Summary

List of Tables iv

Acronyms and Abbreviations v

Revision History vi

Chapter 1: Introduction 1

1.1 Objective 11.2 Structure 1

Chapter 2: Quick Reference Guide 2

2.1 ESC/Bema Quick Reference Guide 22.2 ESC/POS® Quick Reference Guide 6

Chapter 3: ESC/Bematech Command Set 9

ESC/Bematech Command Set 9

Chapter 4: ESC/POS® Command Set 39

ESC/POS® Command Set 39

Appendix I – Tables 99

Table 1 - Characters Per Line 99

Appendix II – Character Tables 100

ASCII 100Code Page 437 100Code Page 850 101Code Page 858 101Code Page 860 102Code Page 866 103

Appendix III - Transmission Status Identification 104

Page 5: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

iv

List of Tables

Table 1: Arguments used to describe MP-4200 TH commands. ..................... 8

Table 2: Printer settings commands for ESC/Bema mode ............................ 9

Table 3: Vertical positioning commands for ESC/Bema mode ......................10

Table 4: Horizontal positioning commands for ESC/Bema mode....................10

Table 5: Character formatting commands for ESC/Bema mode.....................11

Table 6: Print width, character width and height commands for ESC/Bema mode ..11

Table 7: Bitmap and graphic commands for ESC/Bema mode ......................11

Table 8: Communication related commands for ESC/Bema mode .................12

Table 9: Data control related commands for ESC/Bema mode......................12

Table 10: Barcode commands for ESB/Bema mode....................................12

Table 11: Standard commands for ESC/POS® mode..................................13

Table 12: Ideograms control commands for ESC/POS® mode......................15

Table 13: Miscellaneous commands for ESC/POS® mode...........................15

Page 6: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

v

Acronyms and Abbreviations

Abreviation Significance

bit Binary digit

dpi Dotsperinch

JIS Japanese Industrial Standards

TCP/IP Suite of protocols used for Internet communication

USB Universal Serial Bus

UTF-8 8-bit Unicode Transformation Format

Page 7: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

MP-4200 TH Programmer’s Manual - Revision 1.0

vi

Revision History

Date Version DescriptionApril 2010 1.0 Initial release.

Page 8: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

1

MP-4200 TH Programmer’s Manual - Revision 1.0

Chapter 1

Introduction MP-4200 TH is a Bematech thermal printer designed to speed up receipt printing operations with high performance in both text and graphic modes. Its main features include:

•Printingspeedsofupto250mm/sinbothtextandgraphicmodes.•Fourpaperwidths:58mm,76mm,80mmor82.5mm.•Twocommandssets:ESC/BematechorESC/POS®.•OneUSBdeviceinterfacealwaysavailabletoconnectwithhostcomputers.•TwodifferentmodelsofoptionalserialRS-232interfacescards,oneusingaDB-9connectorandanotherusingDB-25connector,toallowserialcommunicationwithlegacyandembeddedhosts.•Oneoptional10/100MbitEthernetinterfacecardwithintegratedTCP/IPstackforwiredremoteprintingthrough local area networks.• One optional IEEE 802.11b/gWi-Fi interface card with integrated TCP/IP stack for wireless remoteprinting through local area networks.•Sevencodepagesavailable:437 (USAandStandardEurope),850 (Multilingual“Latin-1”–WesternEuropeanLanguages),858(MultilingualwithEurosymbol),860(Portuguese),862(Hebrew),864(Arabic)and866(Cyrillic).•SupportsTraditionalChinese(Big5E)andSimplifiedChinese(GB2312orEUC-CN).•SupportsJapanese(JISandShiftJIS).•SupportsUTF-8characters.•Cangeneratefourteendifferenttypesofunidimensionalbarcodes(EAN-8,EAN-13,Code39,Code93,Code128(A,BandC),ITF,Codabar,UPC-A,UPC-E,ISBN,MSIorPlessey).•CangeneratePDF-417bidimensionalbarcode.•Maybeusedtocontroluptotwoexternalcashdrawers.•Dotdensityof203x203dpi.

1.1 Objective The purpose of this manual is to provide to developers and programmers detailed information about MP-4200 TH operation. All available commands are described to allow the use of MP-4200 TH to print receipts for any kind of application.

1.2 Structure This manual is organized in four chapters. This first chapter provides some highlights about MP-4200 TH thermal printer and also some information on how to use this manual. The second chapter presents a summary of all the commands supported by the MP-4200 TH in a form of a quick reference guide. The third chapter providesindepthinformationabouteverycommandavailableintheESC/Bematechmodeofoperation.ThefourthchapterprovidesindepthinformationabouteveryESC/POS®commandsupportedbyMP-4200THprinterwhenoperatingintheESC/POSmodeofoperation. Chapters three and four describe commands using up to nine arguments, as described in Table 1.

Arguments used to describe MP-4200 TH commands. Table 1

Argument Significance

[Function] Short description of the command functionality.

[Format] Command code sequence.

[Range] Shows command arguments ranges, if applicable.

[Default] Givesdefaultvaluesforparameters,ifapplicable.

[Description] Describeswhatthecommanddoes.

[Details] Describestheusageofthecommandindetailandalsoitslimitations.

[Notes] Provides important information on setting and using the printer command, if necessary.

[References] Listsrelatedcommands,ifapplicable.

[Example] Provides a short example on how to use the command.

Page 9: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

2

MP-4200 TH Programmer’s Manual - Revision 1.0

Chapter 2

Quick Reference Guide MP-4200 TH is a dual command set printer. A command set describes the behavior of the printer when sequences of bytes are received through the communication interface. The two command sets available at the MP-4200THareESC/Bematech(orESC/Bemaforshort)andESC/POS®,butonlyoneofthemisactiveata given time. There are commands specifically designed to switch from current command set to the other.

2.1 ESC/Bema Quick Reference Guide ESC/BemaisastandarddevelopedbyBematech,itspartnersandcustomersduringseveral years of operation in the South America retail and bank automation markets.ThesyntaxusedtosummarizeESC/Bemacommandsinthetablesthroughout this section is described in the bullets below:

•ESCPmeansacommandwithnoparameters.•ESCQnmeansacommandwithoneparameter.•ESCKn1n2meansacommandwithtwoparameters.•ESCDn1...nkmeansacommandwithvariablenumberofparameters.

InthebulletsabovetheESCsymbolrepresentsthehexadecimalnumber1B,accordingtoASCIItable.Thecharacter P represents the hexadecimal number 50, as defined in the ASCII table too. In some circumstances hexadecimalnumbersbetween7FandFFcanalsobeusedasapartofacommand.Asthesevaluescannotbe represented using ASCII table, they will be represented with the value followed by the ‘h’ character. InthenexttablesESC/Bemacommandsaresummarized.

Printer settings commands for ESC/Bema mode Table 2

Command Description Hexadecimal Format

GSF9h5n Select printer operating mode and save selected option to configuration memory.

1DF935n

GSF9h7n Set and save printer default code page for ESC/Bemacommandset.

1DF937n

GSF9h8n SetandsaveESC/POSideogrammode. 1DF938n

GSF9hC00h Getprintercurrentcommandset. 1DF94300

GSF9hSPn Select printer operating mode without saving selected option to printer configuration memory.

1DF920n

GSF9h1Fh1 Return tomode in use prior to sending GSF9hSPncommand.

1DF91F31

ESC@ Initialize printer to its default settings. 1B 40

ESCbn Select paper sensor to output paper-end signal.

1b62n

ESCvn Activate drawer #1 for n milliseconds 1B76n

ESC80hn Activate drawer #2 for n milliseconds 1B 80 n

ESCi Perform full paper cut 1B69

ESCw Perform full paper cut 1B77

ESCm Perform partial paper cut 1B6D

ESCyn Enable/disablepanelkeys 1B79n

ESCx Enabledumpmode 1B78

ESCzn Enable/disableautomaticlinefeed 1B7An

Page 10: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

3

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC(ApL pH fn n1 n2 vol Activate/deactivate buzzer 1B 28 41 pL pH fn n1 n2 vol

GSF9h–n Set and save printer mode 1DF92Dn

GSF9h!n Set and save paper width 1DF921n

GSF9h,n Enable/disablepapernear-endsensor 1DF92Cn

GSF9h+n Set and save printing intensity 1DF92Bn

GSFAhn Set and save printer language 1DFAn

GSF9h‘n Getprinterinformation 1DF927n

GSF9h(0 Loaddefaultuserconfiguration 1DF92830

GSF9h)0 Print user configuration 1DF92930

GSF8hF Printer reset 1DF846

GSF7hBSNUL“i1…i4 s1…s4 Set IP address and subnet mask 1DF7080022i1…i4 s1…s4

GSF7hEOTNUL‘g1…g4 Set default gateway IP address 1DF7040027g1…g4

GSF9hDmn Activate buzzer on cut 1DF944mn

GSF9hEn SetDHCPusage 1DF945n

GSF9hSmip1..ip4 n c1..cn Set SNMP settings 1DF953mip1..ip4 n c1..cn

GSF9hWascmne1..em p1..pn Set Wi-Fi settings 1DF957ascmne1..em p1..pn

Vertical positioning commands Table 3

Command Description Hexadecimal Format

ESCCn Set page size in lines 1B43n

ESCcn1n2 Set page size in millimeters 1B63n1n2

ESCJn Performs a fine line feed 1B 4A n

FF Feed one page 0C

LF Feed one line 0A

ESC2 Settextlineheightto1/6inches 1B32

ESC3n Set line feed to n/144 inches 1B33n

ESCf1n Vertical skipping 1B6631n

ESCAn Feedpaperby[nx0,375]mm 1B 41 n

Horizontal positioning commands Table 4

Command Description Hexadecimal Format

ESCf0n Horizontal skipping 1B6630n

HT Horizontal tab 09

ESCDn1…nkNUL Set horizontal tab marks 1B 44 n1…nk 00

ESCQn Set right margin 1B 51 n

ESCln Set left margin 1B6Cn

ESCan Character alignment 1B61n

Page 11: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

4

MP-4200 TH Programmer’s Manual - Revision 1.0

Character formatting commands Table 5

Command Description Hexadecimal Format

ESC–n Enable/disableunderlineprintmode 1B2Dn

ESC4 Enableitalicprintmode 1B34

ESC5 Disableitalicprintmode 1B35

ESCE Enableemphasizedprintmode 1B 45

ESCF Disableemphasizedprintmode 1B46

ESCtn Codepage selection 1B74n

ESCRn Select an international character set 1B 52 n

ESCSn Enable superscript and/or subscript printmodes

1B53n

ESCT Disablesuperscriptandsubscriptprintmodes 1B 54

ESCNn Select printing intensity 1B4En

ESC!n Select print mode 1B 21 n

ESC}n Turn upside-down printing mode on/off 1B7Dn

ESCZ Print supported Unicode sets 1B 5A

ESC[n Print a specific Unicode set 1B 5B n

Print width, character width and height commands Table 6

Command Description Hexadecimal Format

DC2 Disablecondensedmode 12

DC4 Disableon-lineexpandedprint 14

ESCdn Enable/disabledoubleheightprintmode 1B64n

ESCH Disablecondensedmode 1B 48

ESCP Disablecondensedmode 1B 50

ESCSI Enablecondensedmode 1B 0F

ESCSO Enableon-lineexpandedmode 1B0E

ESCV Enableon-linedoubleheightmode 1B56

ESCWn Enable/disableexpandedmode 1B57n

SI Enablecondensedmode 0F

SO Enableon-lineexpandedmode 0E

Bitmap and graphic Table 7

Command Description Hexadecimal Format

ESC$n1n2 Fill in blank bit columns 1B 24 n1 n2

ESC*!n1n2b1...bn 24-bit graphics 1B 2A 21 n1 n2 b1 ... bn

ESCKn1n2b1...bn 8-bit graphics 1B 4B n1 n2 b1 ... bn

FS p n m Print NV bit image 1C70nm

FS q n [xL xH yL yH d1...dk]1...[xL xH yL yH d1...dk]n

DefineNVbitimage 1C71 n [xL xH yL yH d1...dk]1...[xL xH yL yH d1...dk]n

GS/m Print downloaded bit image 1D2Fm

GS*xyd1...d(x × y × 8) Definedownloadedbitimage 1D2Axyd1...d(x × y × 8)

GSv0mxL xH yL yH d1...dk Print raster bitmap 1D7630mxL xH yL yH d1...dk

Page 12: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

5

MP-4200 TH Programmer’s Manual - Revision 1.0

Communication related Table 8

Command Description Hexadecimal Format

ENQ Printer status enquiry 05

GSF8h1 Printer extended status enquiry 1DF831

ETX Endbuffer 03

STX Clear buffer 02

Data control related Table 9

Command Description Hexadecimal Format

CAN Cancel last line 18

DEL Cancel last character 7F

Barcode commands Table 10

Command Description Hexadecimal Format

GShn Set barcode height 1D68n

GSwn Set barcode width 1D77n

GSHn Choose the position of human readable information (HRI) in the barcode

1D48n

GSfn Set the font to be used for human readable information (HRI)

1D66n

GSkNULd1…d11NUL Print an UPC-A barcode 1D6B00d1…d11 00

GSkAVTd1...d11 Print an UPC-A barcode 1D6B410Bd1…d11

GSkSOHd1…d6NUL PrintanUPC-Ebarcode 1D6B01d1…d6 00

GSkBACKd1…d6 PrintanUPC-Ebarcode 1D6B4206d1…d6

GSkSTXd1…d12NUL PrintanEAN-13barcode 1D6B02d1…d12 00

GSkCFFd1…d12 PrintanEAN-13barcode 1D6B430Cd1…d12

GSkETXd1…d7NUL PrintanEAN-8barcode 1D6B03d1…d7 00

GSkDBELd1…d7 PrintanEAN-8barcode 1D6B4407d1…d7

GSkEOTd1…dnNUL PrintaCODE39barcode 1D6B04d1…dn 00

GSkEnd1…dn PrintaCODE39barcode 1D6B45nd1…dn

GSkENQd1…dnNUL Print an ITF barcode 1D6B05d1…dn 00

GSkFnd1...dn Print an ITF barcode 1D6B46nd1…dn

GSkACKd1…dnNUL PrintaCODABARbarcode 1D6B06d1…dn 00

GSkGnd1…dn PrintaCODABARbarcode 1D6B47nd1…dn

GSkHnd1…dn PrintaCODE93barcode 1D6B48nd1…dn

GSkInd1…dn PrintaCODE128barcode 1D6B49nd1…dn

GSk80hn1 n2 n3 n4 n5 n6 d1…dn PrintaPDF-417barcode 1D6B80n1 n2 n3 n4 n5 n6 d1…dn

GSkNAKd1…d9NUL Print an ISBN barcode 1D6B15d1…d9 00

GSkSYNd1…dnNUL Print a MSI barcode 1D6B16d1…dn 00

GSk82hnd1…dn Print a MSI barcode 1D6B82nd1…dn

GSkETBd1…dnNUL PrintaPLESSEYbarcode 1D6B17d1…dn 00

GSk83hnd1…dn PrintaPLESSEYbarcode 1D6B83nd1…dn

GSk84hn1 n2 Program barcode left margin 1D6B84n1 n2

Page 13: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

6

MP-4200 TH Programmer’s Manual - Revision 1.0

2.2 ESC/POS® Quick Reference Guide

ESC/POS®isastandarddefinedbySeikoEpsonCorporation.ESC/POS®commandscanbeclassifiedasexecuting or setting. An executing command makes the printer to execute something and does not affect further incoming data. On the other hand, a setting command makes the printer to change its internal flags that may affect incoming data. ESC/POS®commandssupportedbyMP-4200THaresummarizedinTable11,Table12andTable13.

Standard commands for ESC/POS® mode Table 11

Command NameCommand Classification GS P

functionExecuting Setting

HT Horizontal tab x

LF Print and line feed x

CR Print and carriage return x

DLEEOT Real-time status transmission x

DLEENQ Real-time request to printer x

DLEDC4

Generatepulseatreal-time x

Executepower-offsequence x

Clear buffer x

ESCSP Set right-side character spacing x x

ESC! Select print mode(s) x

ESC$ Set absolute print position x x

ESC(A Control beeper tones x x

ESC* Select bit-image mode x

ESC- Turn underline mode on/off x

ESC2 Select default line spacing x

ESC= Select peripheral device x

ESC@ Initialize printer x x

ESCD Set horizontal tab marks x

ESCE Turn emphasized mode on/off x

ESCG Turn double-strike mode on/off x

ESCJ Print and paper feed x x

ESCM Select character font

ESCR Select an international character set x

ESCV Turn90ºclockwiserotationmodeon/off x

ESC\ Set relative print position x x

ESCa Select justification x

ESCc3 Select paper sensor(s) to output paper-end signals x

ESCc4 Select paper sensor(s) to stop printing x

ESCc5 Enable/disablepanelbuttons x

ESCd Print and feed n lines x

ESCi Perform a partial cut x

Page 14: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

7

MP-4200 TH Programmer’s Manual - Revision 1.0

ESCm Partial paper cut x

ESCp Generatepulse x

ESCt Select character code table x

ESCun Transmit peripheral device status x

ESCv Transmit paper sensor status x

ESC{ Turn upside-down printing mode on/off x

FS p Print NV bit image x

FS q DefineNVbitimage x

GS! Select character size x

GS* Definedownloadedbitimage x

GS/ Print downloaded bit image x

GS(A Executetestprint x

GS(D Enable/disablereal-timecommand x

GS8LGS(L

Process graphics datax

GS(N Select character effects x

GS(k Specify and print symbol x x

GS: Start/end macro definition x x

GSB Turn white/black reverse printing mode on/off x

GSH Select printing position of HRI characters x

GSI TransmitprinterID x

GSL Set left margin x x

GSP Set horizontal and vertical motion units x

GSV Select cut mode and cut paper x x

GSW Set printing area width x x

GS^ Executemacro x

GSa Enable/disableAutomaticStatusBack(ASB) x x

GSf Select font for HRI characters x

GSh Set bar code height x

GSk Print bar code x

GSr Transmit status x

GSv0 Print raster bit image x

GSw Set bar code width x

Notes:- x means command enabled.

Page 15: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

8

MP-4200 TH Programmer’s Manual - Revision 1.0

MP-4200THalsosupportsideogramsforTraditionalChinese(Big-5E),SimplifiedChinese(EUC-CN)andJapanese(JISorShiftJIS).Table12showsMP-4200THESC/POScommandsdedicatedtoideogramscontrol.

Ideograms control Table 12

Command NameCommand Classification GS P

functionExecuting Setting

FS! Set print mode(s) for ideograms x

FS & Select ideogram mode x

FS - Turn underline mode on/off for ideograms x

FS . Cancel ideogram mode x

FS C Select ideogram code system x

FS S Set ideogram spacing x x

FS W Turn quadruple-size mode on/off for ideograms x

BeyondESC/POS®standard,MP-4200THalsosupportssomemiscellaneouscommandsinESC/POS®modetoallowprintertobeconfiguredindependentofcurrentcommandset(ESC/BemaorESC/POS®).ThemiscellaneouscommandssupportedbyMP-4200THinESC/POS®modearelistedinTable13.

Special miscellaneous Table 13

Command Description Hexadecimal Format

GSF9h5n Select printer operating mode and save selected option to configuration memory.

1DF935n

GSF9h7n SetandsaveprinterdefaultcodepageforESC/Bemacommandset. 1DF937n

GSF9h8n SetandsaveESC/POSideogrammode. 1DF938n

GSF9hC00h Getprintercurrentcommandset. 1DF94300

GSF9hSPn Select printer operating mode without saving selected option to printer configuration memory.

1DF920n

GSF9h1Fh1 ReturntomodeinusepriortosendingGSF9hSPncommand. 1DF91F31

GSF9h–n Set and save printer mode 1DF92Dn

GSF9h!n Set and save paper width 1DF921n

GSF9h,n Enable/disablepapernear-endsensor 1DF92Cn

GSF9h+n Set and save printing intensity 1DF92Bn

GSFAhn Set and save printer language 1DFAn

GSF9h‘n Getprinterinformation 1DF927n

GSF9h(0 Loaddefaultuserconfiguration 1DF92830

GSF9h)0 Print user configuration 1DF92930

GSF8h1 Printer extended status enquiry 1DF831

GSF8hF Printer reset 1DF846

GSF7hBSNUL“i1…i4 s1…s4 Set IP address and subnet mask 1DF7080022i1…i4 s1…s4

GSF7hEOTNUL‘g1…g4 Set default gateway IP address 1DF7040027g1…g4

GSF9hDmn Activate buzzer on cut 1DF944mn

GSF9hEn SetDHCPusage 1DF945n

GSF9hSmip1..ip4 n c1..cn Set SNMP settings 1DF953mip1..ip4 n c1..cn

GS F9h W a s c m n e1..em p1..pn

Set Wi-Fi settings 1DF957ascmne1..em p1..pn

Page 16: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

9

MP-4200 TH Programmer’s Manual - Revision 1.0

Chapter 3

ESC/Bematech Command Set This chapter presents detailed information about each ESB/Bematech command implemented by the

MP-4200 TH printer.

GS F9h 5 n

[Function] Select printer operating mode.[Format] ASCII GSF9h5n Hexadecimal 1DF935n Decimal 2924953n[Range] n=0;n=1;n=48;n=49;[Description] Ifnis0(00hor30h),ESC/Bemaisselected. Ifnis1(01hor31h),ESC/POSisselected.[Notes] This command modifies printer flags and save the new values to printer configuration memory.

GS F9h 7 n

[Function] SetandsaveprinterdefaultcodepageforESC/Bematechcommandset.[Format] ASCII GSF9h7n Hexadecimal 1DF937n Decimal 2924955n[Range] 2≤n≤12;n=14;n=21[Default] n=2[Description] Thiscommandselectsthecodepagetobeused,accordingtothefollowingoptions.

Ifnis2(02hor32h),CODEPAGE850isselected. Ifnis3(03hor33h),CODEPAGE437isselected. Ifnis4(04hor34h),CODEPAGE860isselected. Ifnis5(05hor35h),CODEPAGE858isselected. Ifnis6(06hor36h),CODEPAGE866isselected. Ifnis7(07hor37h),CODEPAGE864isselected. Ifnis8(08hor38h),UTF8(Unicode)isselected. Ifnis9(09hor39h),Big-5Eisselected. Ifnis10(0Ahor3Ah),JISisselected. Ifnis11(0Bhor3Bh),SHIFTJISisselected. Ifnis12(0Chor3Ch),GB2312isselected. Ifnis14(0Ehor3Eh),EUC-CNisselected. Ifnis21(15hor45h),CODEPAGE862isselected.

GS F9h 8 n

[Function] SetandsaveESC/POSideogrammode.[Format] ASCII GSF9h8n Hexadecimal 1DF938n Decimal 2924956n[Range] 0≤n≤3[Default] n=0[Description] Ifnis0(00hor30h),UTF8(Unicode)ideogrammodeisselected. Ifnis1(01hor31h),ESC/POSJapaneseideogrammodeisselected. Ifnis2(02hor32h),ESC/POSSimplifiedChineseideogrammodeisselected. Ifnis3(03hor33h),ESC/POSTraditionalChineseideogrammodeisselected.

Page 17: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

10

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h C 00h

[Function] Getprintercurrentcommandset.[Format] ASCII GSF9hC00h Hexadecimal 1DF94300 Decimal 29249670[Description] Returnonebytewithcurrentcommandset.Ifreturnedbyteis0(00h),printerisoperatingin ESC/Bemamode.Ifreturnedbyteis1(01h),printerisoperatinginESC/POSmode.

GS F9h SP n

[Function] Select printer operating mode of operation temporarily.[Format] ASCII GSF9hSPn Hexadecimal 1DF920n Decimal 2924932n[Range] n=0;n=1;n=48;n=49;[Description] Ifnis0(00hor30h),ESC/Bemaisselected. Ifnis1(01hor31h),ESC/POSisselected.[Notes] This command modifies printer flags but does not save the new values to the printer configuration memory. The new mode starts as the printer has been just initialized (ESC @ has beenexecuted).

GS F9h 1Fh 1

[Function] Return to previously set mode of operation.[Format] ASCII GSF9h1Fh1 Hexadecimal 1DF91F31 Decimal 292493149[Description] ConfigurationcommandusedtoputprintermodebacktothatusedbeforeissuingGSF9hSPn command.Thepreviousmodere-startsastheprinterhasbeenjustinitialized(ESC@hasbeen executed).

ESC @

[Function] Initialize printer to its default settings.[Format] ASCII ESC@ Hexadecimal 1B 40 Decimal 2764[Description] Allprintersettings,includingcharacterfont,linespacing,leftmargin,rightmarginandinvertedmode are canceled and the printer returns to its initial state.

ESC b n

[Function] Select paper sensor to output paper-end signal.[Format] ASCII ESCbn Hexadecimal 1B62n Decimal 2798n[Range] n=0,1,48,49[Default] n=0[Description] Ifnis0(00hor30h),paper-endsignal(PE)reflectspapersensoronparallelprinters. Ifnis1(01hor31h),paper-endsignal(PE)reflectsdrawersensoronparallelprinters.[Notes] ThiscommandalsoaffectsthebehaviorofENQonallprintermodels.

Page 18: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

11

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC v n

[Function] Activate drawer #1 for n milliseconds.[Format] ASCII ESCvn Hexadecimal 1B76n Decimal 27118n[Range] 50≤n≤250[Description] Activatedrawer#1pinfornmilliseconds(50ms≤n≤200ms).

ESC 80h n

[Function] Activate drawer #2 for n milliseconds.[Format] ASCII ESC80hn Hexadecimal 1B 80 n Decimal 27128n[Range] 50≤n≤250[Description] Activatedrawer#2pinfornmilliseconds(50ms≤n≤200ms).

ESC i

[Function] Perform full paper cut.[Format] ASCII ESCi Hexadecimal 1B69 Decimal 27105[Description] Thiscommandoperatestheauto-cutter,performingafullcutinthepaper.

ESC w

[Function] Perform full paper cut.[Format] ASCII ESCw Hexadecimal 1B77 Decimal 27119[Description] Thiscommandoperatestheauto-cutter,performingafullcutinthepaper.

ESC y n

[Function] Enable/disablepanelkeys.[Format] ASCII ESCyn Hexadecimal 1B79n Decimal 27121n[Range] n=0,1[Default] n=1[Description] Enableordisablepanelkeys. Ifnis0(00hor30h),panelkeysaredisabled. Ifnis1(01hor31h),panelkeysareenabled.

ESC x

[Function] Enabledumpmode.[Format] ASCII ESCx Hexadecimal 1B78 Decimal 27120[Description] Dumpmodeisafunctionusedtoprintdatatransmittedfromhostcomputerinhexadecimal numbers. This function is to be used by advanced users and programmers in checking commands

Page 19: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

12

MP-4200 TH Programmer’s Manual - Revision 1.0

sent to the printer.[Note] The only way to exit the dump mode is turning off the printer"

ESC z n

[Function] Enable/disableautomaticlinefeed.[Format] ASCII ESCzn Hexadecimal 1B7An Decimal 27122n[Range] n=0,1[Default] n=0[Description] Enableordisablelinefeeding. Ifnis0(00hor30h),automaticlinefeedisdisabled. Ifnis1(01hor31h),automaticlinefeedisenabled.[Notes] Whenautomaticlinefeedisenabled,theprinterwillperformaLFifaCRisreceived.

ESC ( A pL pH fn n1 n2 vol

[Function] Activate/deactivate buzzer.[Format] ASCII ESC(ApL pH fn n1 n2 vol Hexadecimal 1B 28 41 pL pH fn n1 n2 vol Decimal 274065pL pH fn n1 n2 vol[Description] Activateordeactivateprinterbuzzer. (pL+pH×256)=4,i.e.,pL must be 4 and pH must be 0. ƒn=1or31h–activatebuzzer. ƒn=0or30h–deactivatebuzzer(deprecated). n=(n1+n2×256)–timeinmilliseconds. vol=0,1,48or49–volume(unused).

GS F9h - n

[Function] Set and save printer mode.[Format] ASCII GSF9h–n Hexadecimal 1DF92Dn Decimal 2924945n[Default] n=0[Description] Setprinterprioritytohighqualityofhighspeed. n=0or30h–normal. n=1or31h–highquality. n=2or32h–highspeed.

GS F9h ! n

[Function] Set and save paper width.[Format] ASCII GSF9h!n Hexadecimal 1DF921n Decimal 2924933n[Description] Setpaperwidthasdescribedinthetablebelow:

Page 20: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

13

MP-4200 TH Programmer’s Manual - Revision 1.0

n Paper width (mm) Printing width (mm)

00h 58 48

01h 76 72

02h 80 72

03h 80 76

04h 82.5 72

05h 82.5 76

06h 82.5 80

[Notes] This command has effect only when printer is in ESC/Bema operating mode. For ESC/POSmodepaperwidthisalwayssetto80mm/73.5mm.

GS F9h , n

[Function] Enable/disablepapernear-endsensor.[Format] ASCII GSF9h,n Hexadecimal 1DF92Cn

Decimal 2924944n[Default] n=1[Description] Enableordisablepapernear-endsensor(PNES).Thissettingissavedto configuration (non-volatile) memory. n=1or31h–enablePNES. n=0or30h–disablePNES.

GS F9h + n

[Function] Set and save printing intensity.[Format] ASCII GSF9h+n Hexadecimal 1DF92Bn Decimal 2924943n

[Description] Obsoleteandignored.KeptheretomaintaincompatibilitywithearlierBematechproducts.

GS FAh n

[Function] Set and save printer language.[Format] ASCII GSFAhn Hexadecimal 1DFAn Decimal 29250n[Description] Setprinterlanguage. n=0or30h–English n=1or31h–Portuguese n=2or32h–Spanish n=3or33h–German

Page 21: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

14

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h ‘ n

[Function] Getprinterinformation.[Format] ASCII GSF9h‘n Hexadecimal 1DF927n Decimal 2924939n[Description]Retrieveprinterinformationaccordingtovaluesdescribedinthefollowingtable:

n Information Data type Return size

0,30h Productcode(“MP-4200TH”) ASCII string 10 bytes

1,31h Serial number ASCII string 20 bytes

2,32h Manufacturing date ASCII string 4 bytes

3,33h Firmware version ASCII string 3bytes

4,34h Reserved

5,35h Manufacturing timestamp (“dd/mm/yyhh:mm:ss”format)

ASCII string 17bytes

6,36h Reserved

7,37h Reserved

8,38h Interface type (0 = None; 1 = SerialDB-9;2=SerialDB-25;3=Ethernet,-1=Unknown)

Integer 1 byte

GS F9h ( 0

[Function] Loaddefaultuserconfiguration.[Format] ASCII GSF9h(0 Hexadecimal 1DF92830 Decimal 292494048[Description] Reloadallconfigurationsfromnon-volatilememoryanddipswitches.

GS F9h ) 0

[Function] Print user configuration.[Format] ASCII GSF9h)0 Hexadecimal 1DF92930 Decimal 292494148[Description] Printonpaperthecurrentuserconfiguration.

GS F8h F

[Function] Printer reset.[Format] ASCII GSF8hF Hexadecimal 1DF846 Decimal 2924870[Description] Forceahardwareresetontheprinter.

Page 22: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

15

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F7h BS NUL “ i1...i4 s1...s4

[Function] Set IP address and subnet mask.[Format] ASCII GSF7hBSNUL“i1...i4 s1...s4

Hexadecimal 1DF7080022i1...i4 s4...s4

Decimal 292478034i1...i4 s4...s4

[Description] ProgramafixedIPaddressandsubnetmasktotheprinter.[Example] TodefineanIPaddressof10.10.1.2andasubnetmaskof255.255.0.0,thefollowingcommand should be sent: 1DF70800220A0A0102FFFF0000[Notes] Valid only when ethernet or wi-fi interface is being used.

GS F7h EOT NUL ‘ g1…g4

[Function] Set default gateway IP address[Format] ASCII GSF7hEOTNUL‘g1…g4 Hexadecimal 1DF7040027g1…g4 Decimal 292474039g1…g4[Default] 0.0.0.0[Description] ThiscommandsetsthedefaultgatewayIPaddress,whereg1..g4aretheIPaddressoctets.[Notes] Valid only when ethernet or wi-fi interface is being used.[Example] Ifyouwanttosetthegatewayaddressto192.168.1.2thecommandmustbesentas1DF704 0027C0A80102

GS F9h D m n

[Function] Activate buzzer on cut[Format] ASCII GSF9hDmn Hexadecimal 1DF944mn Decimal 2924968mn[Range] 0≤m≤2 0≤n≤255[Default] m=0 n=200[Description] •Thiscommandtellstheprintertoactivethebuzzeratthesametimeofacutisbeing performed. •Thebuzzertobeactivatedisdefinedbymasfollow:

m buzzer

0 none (deactivate previous settings)

1 internal

2 external

•(n×100ms)definestheactivationtime

Page 23: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

16

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h E n

[Function] SetDHCPusage[Format] ASCII GSF9hEn Hexadecimal 1DF945n Decimal 2924969n[Range] 0≤n≤255[Default] n=0[Description] ThiscommandenablesordisablestheDHCPclientoftheprinter. •WhentheLSBofnis0,theDHCPclientisdisabled. •WhentheLSBofnis1,theDHCPclientisenabled.

[Notes] Valid only when ethernet or wi-fi interface is being used.

GS F9h S m ip1..ip4 n c1..cn

[Function] Set SNMP settings[Format] ASCII GSF9hSmip1..ip4nc1..cn Hexadecimal 1DF953mip1..ip4nc1..cn Decimal 2924983mip1..ip4nc1..cn[Range] 0≤n≤64[Default] m=0 n=0[Description] ThiscommandsetsSNMPtrapparameters. •Whenm=0,SNMPtrapsaredisabled. •Whenm≠0,SNMPtrapsareenabled. •ndefinestheSNMPcommunityandislimitedto64bytes. •c1..cndefinethecommunityname.[Notes] Valid only when ethernet or wi-fi interface is being used.

GS F9h W a s c m n e1..em p1..pn

[Function] Set Wi-Fi settings[Format] ASCII GSF9hWascmne1..emp1..pn Hexadecimal 1DF957ascmne1..emp1..pn Decimal 2924987ascmne1..emp1..pn[Range] a=0,1

s=0,1,2,3,40≤c≤130≤m≤320≤n≤63[Default] a=0s=0c=0m=0n=0

[Description] ThiscommandsetsWi-Ficommunicationsettings.•adefinestheaccessmodeasfollow:

a Access mode

0 Access Point

1 Ad-hoc

Page 24: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

17

MP-4200 TH Programmer’s Manual - Revision 1.0

•sdefinesthesecuritymodeasfollow:

s Security mode

0 No security

1 WEP64-bit

2 WEP128-bit

3 WPA-TKIPpersonal

4 WPA2-AESpersonal

•cdefinesthechanneltouse.Usec=0whena=0.•mdefinesthesizeoftheESSID.•ndefinesthesizeofthepassphrase.•e1..emdefinetheESSID.•p1..pndefinethepassphrase.

[Notes] Valid only when wi-fi interface is being used.

ESC C n

[Function] Set page size in lines.[Format] ASCII ESCCn Hexadecimal 1B43n Decimal 2767n[Range] 0<n<256[Default] n=12

[Description] Setpagesize,wherenrepresentsthenumberofsingleheightlines.

ESC c n1 n2

[Function] Set page size in millimeters.[Format] ASCII ESCcn1 n2

Hexadecimal 1B63n1 n2

Decimal 2799n1 n2

[Range] 0≤n1≤255 0≤n2≤255[Description] Setpagesizeinmillimeters.Thepagesizeiscalculatedbytheformula:0.125mmx[n1+(256xn2)].

ESC J n

[Function] Perform fine line feed.[Format] ASCII ESCJn Hexadecimal 1B 4A n Decimal 2774n[Range] 48≤n≤255[Description] Performpaperfeedingof[(n–48)x0,125]mm.[Notes] This command is widely used when printing graphics.

Page 25: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

18

MP-4200 TH Programmer’s Manual - Revision 1.0

FF

[Function] Feed one page.[Format] ASCII FF Hexadecimal 0C Decimal 12[Description] Performsaformfeed,movingfromcurrentpositiontothetopofnextpage.[Notes] This command can be disabled by setting page size to zero.

LF

[Function] Feed one line.[Format] ASCII LF Hexadecimal 0A Decimal 10[Description] Printbuffercontents,ifany,andperformthefeedingofonelineaccordingtodefaultline spacing.[Notes] After sending this command, the next character will be printed on the left margin of the next line.

ESC 2

[Function] Settextlineheightto1/6inches.[Format] ASCII ESC2 Hexadecimal 1B32 Decimal 2750[Description] Settextlineheighttoitsdefaultvalue,whichis1/6inches.[Notes] 1/6inchesbecomesthedefaultlineheightwhenprinteristurnedonorwhentheESC@ command is issued.

ESC 3 n

[Function] Set line feed to n/144 inches.[Format] ASCII ESC3n Hexadecimal 1B33n Decimal 2751n[Range] 18≤n≤255[Description] Thelinefeedrateperlineisspecifiedbyn/144inches.[Notes] This command takes effect immediately.

ESC f 1 n

[Function] Vertical skipping.[Format] ASCII ESCf1n Hexadecimal 1B6631n Decimal 2710249n[Range] 0≤n≤255[Description] Performverticalskippingofncharacters.[Notes] Command1B6601nhasthesameeffect.

Page 26: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

19

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC A n

[Function] Feedpaperby[nx0,375]mm.[Format] ASCII ESCAn Hexadecimal 1B 41 n Decimal 2765n[Range] 0≤n≤255[Description] Performpaperfeedofnx0,375mm.[Notes] Ifn<17,thelinefeedwillbeequaltozero.Forn>85,thelinefeedwillbeequalto32mm.For othervalues,thelinefeedisequaltonx0,375mm.

ESC f 0 n

[Function] Horizontal skipping.[Format] ASCII ESCf0n Hexadecimal 1B6630n Decimal 2710248n[Range] 0≤n≤255[Description] Performshorizontalskippingofncharacters.[Notes] Hexcommand1B6600ntakesthesameeffect.

HT

[Function] Horizontal tab.[Format] ASCII HT Hexadecimal 09 Decimal 9[Description] Moveprintpositiontonexttabmarkinthecurrentline.[Notes] Tabmarksexistbydefaultateveryeightcharactercolumns.Defaulttabmarkpositionscanbe modifiedbytheESCDcommand.

ESC D n1 ... nk NUL

[Function] Set horizontal tab marks.[Format] ASCII ESCDn1 ... nkNUL Hexadecimal 1B 44 n1 ... nk 00 Decimal 2768n1 ... nk 0[Range] 1≤n≤255 0≤k≤32[Default] Thedefaulttabmarksareatintervalsof8characters(columns9,17,25,...)forfont12x24.[Description] Sethorizontaltabmarks. •nspecifiesthecolumnnumberforsettingahorizontaltabpositionfromthebeginningoftheline. •kindicatesthetotalnumberofhorizontaltabpositionstobeset.[Notes] •Thehorizontaltabmarkisstoredasavalueof[characterwidth×n],measuredfromthe

beginning of the line. The character width includes the right-side character spacing, and double-width characters are set with twice the width of normal characters.•Thiscommandcancelsprevioushorizontaltabsettings.•Whensettingn=8,theprintpositionismovedtocolumn9bysendingHT.•Upto32tabpositions(k=32)canbeset.Dataexceeding32tabpositionsisprocessedas normal data.•Transmit[n]kinascendingorderandplaceaNULcode0attheend.•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.•ESCDNULcancelsallhorizontaltabmarks.•Thepreviouslyspecifiedhorizontaltabmarksdonotchange,evenifcharacterwidthchanges.

Page 27: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

20

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC Q n

[Function] Set right margin.[Format] ASCII E SCQn Hexadecimal 1B 51 n Decimal 2781n[Range] 0≤n≤255[Description] Setrightmargininnumberofcharacters,startingfromdefaultleftmargin.[Notes] If requested right margin is on the left side of current horizontal position, the new margin will become valid only in the next line.

ESC l n

[Function] Set left margin.[Format] ASCII ESCln Hexadecimal 1B6Cn Decimal 27108n[Range] 0≤n≤255[Description] Setleftmargininnumberofcharacters,startingfromthedefaultleftmargin.[Notes] If requested left margin is on the right side of current horizontal position, the new margin will become valid only in the next line.

ESC a n

[Function] Character alignment.[Format] ASCII ESCan Hexadecimal 1B61n Decimal 2797n[Range] n=0,1,2[Default] n=0[Description] Thiscommandsethorizontalalignmentjustification. Ifnis0(00hor30h),alignmentissettoleftjustified. Ifnis1(01hor31h),alignmentissettocenterjustified. Ifnis2(02hor32h),alignmentissettorightjustified.[Notes] After initialization the default alignment is left justified.

ESC - n

[Function] Enable/disableunderlineprintmode.[Format] ASCII ESC-n Hexadecimal 1B2Dn Decimal 2745n[Range] n=0,1[Default] n=0[Description] Enableordisableunderlineprintmode. Ifnis0(00hor30h),underlinemodeisdisabled. Ifnis1(01hor31h),underlinemodeisenabled.[Notes] After processing this command, the printer will underline every character or space sent for printing.

ESC 4

[Function] Enableitalicprintmode.

Page 28: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

21

MP-4200 TH Programmer’s Manual - Revision 1.0

[Format] ASCII ESC4 Hexadecimal 1B34 Decimal 2752[Description] Enableitalicprintmode.

[Notes] Italic is available in all other print modes.

ESC 5

[Function] Disableitalicprintmode.[Format] ASCII ESC5 Hexadecimal 1B35 Decimal 2753

[Description] Disableitalicprintmode.

ESC E

[Function] Enableemphasizedprintmode.[Format] ASCII ESCE Hexadecimal 1B 45 Decimal 2769

[Description] Enableemphasizedprintmode.[Notes] Emphasizedmodeisbolderthannormalprint.Emphasizedisavailableinallotherprintmodes.

ESC F

[Function] Disableemphasizedprintmode.[Format] ASCII ESCF Hexadecimal 1B46 Decimal 2770

[Description] Disableemphasizedprintmode.

ESC t n

[Function] Codepage selection.[Format] ASCII ESCtn Hexadecimal 1B74n Decimal 27116n[Range] 2≤n≤12;n=14;n=21[Default] n=2[Description] Thiscommandselectsthecodepagetobeused,accordingtothefollowingoptions. Ifnis2(02hor32h),CODEPAGE850isselected. Ifnis3(03hor33h),CODEPAGE437isselected. Ifnis4(04hor34h),CODEPAGE860isselected. Ifnis5(05hor35h),CODEPAGE858isselected. Ifnis6(06hor36h),CODEPAGE866isselected. Ifnis7(07hor37h),CODEPAGE864isselected. Ifnis8(08hor38h),UTF8(Unicode)isselected. Ifnis9(09hor39h),Big-5Eisselected. Ifnis10(0Ahor3Ah),JISisselected. Ifnis11(0Bhor3Bh),SHIFTJISisselected. Ifnis12(0Chor3Ch),GB2312isselected.

Page 29: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

22

MP-4200 TH Programmer’s Manual - Revision 1.0

Ifnis14(0Ehor3Eh),EUC-CNisselected. Ifnis21(15hor45h),CODEPAGE862isselected.

[Notes] CODEPAGE850isthedefault.

ESC R n

[Function] Select an international character set.[Format] ASCII ESCRn Hexadecimal 1B 52 n Decimal 2782n[Range] 0≤n≤12[Default] n=12

[Description] Thiscommandselectsthecodepagetobeused,accordingtothefollowingoptions.

Ifnis0,CODEPAGE437isselected.

If1≤n≤11,CODEPAGE858isselected.

Ifnis12,CODEPAGE850isselected.[Notes] CODEPAGE850isthedefault.ThiscommandissimilartoESCtn.Thelastcommandreceived is effective.

ESC S n

[Function] Enablesuperscriptand/orsubscriptprintmode.[Format] ASCII ESCSn Hexadecimal 1B53n Decimal 2783n[Range] n=0,1[Description] Enablesuperscriptorsubscriptcharactermode. Ifnis0(00hor30h),thesuperscriptisenabled.Thenextarrivingcharacterswillbeprintedon the upper side of the print line. Ifnis1(01hor31h),thesubscriptisenabled.Thenextarrivingcharacterswillbeprintedon the bottom side of the print line.

ESC T

[Function] Disablesuperscriptandsubscriptprintmodes.[Format] ASCII ESCT Hexadecimal 1B 54 Decimal 2784

[Description] Disablebothsuperscriptandsubscriptprintmodes.

ESC N n

[Function] Select printing intensity.[Format] ASCII ESCNn Hexadecimal 1B4En Decimal 2778n[Range] 0≤n≤4[Description] Obsolete.KeptheretomaintaincompatibilitywithearlierBematechproducts.

Page 30: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

23

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC ! n

[Function] Select print mode.[Format] ASCII ESC!n Hexadecimal 1B 21 n Decimal 2733n[Description] Selectstheprintmodedependingonthevalueofn,aspresentedinthetablebelow:

Bit FunctionValue

0 1

0 Undefined

1 Undefined

2 Undefined

3 Emphasized Clear Set

4 Doubleheight Clear Set

5 Doublewidth Clear Set

6 Undefined

7 Underline Clear Set

ESC } n

[Function] Turn upside-down printing mode on/off.[Format] ASCII ESC}n Hexadecimal 1B7Dn Decimal 27125n[Range] n=0,1[Default] n=0[Description] Enableordisableupside-downprintingmode,inthefollowingconditions: Ifnis1(01hor31h),upside-downprintingmodeisenabled. Ifnis0(00hor30h),upside-downprintingmodeisdisabled.

ESC Z

[Function] Print supported Unicode sets.[Format] ASCII ESCZ Hexadecimal 1B 5A Decimal 2790

0 1 2 3 4 5 6 7 8 9 A B C D E F

0

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

Page 31: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

24

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC [ n

[Function] Print a specific Unicode set.[Format] ASCII ESC[n Hexadecimal 1B 5B n Decimal 2791n[Range] 0≤n≤255[Description] PrintselectedUnicodecharacterset.

DC2

[Function] Disablecondensedmode.[Format] ASCII DC2 Hexadecimal 12 Decimal 18[Description] Disablecondensedmode,ifpreviouslysetbyESCSIorSIcommand.

DC4

[Function] Disableon-lineexpandedprint.[Format] ASCII DC4 Hexadecimal 14 Decimal 20[Description] Disableon-lineexpandedprint,ifpreviouslysetbyESCSOorSOcommand.

ESC d n

[Function] Enable/disabledoubleheightprintmode.[Format] ASCII ESCdn Hexadecimal 1B64n Decimal 27100n[Range] n=0,1[Default] n=0[Description] Enableordisabledoubleheightprintmode,accordingtothefollowingrules: Ifnis0(00hor30h),doubleheightisdisabled. Ifnis1(01hor31h),doubleheightisenabled.

ESC H

[Function] Disablecondensedmode.[Format] ASCII ESCH Hexadecimal 1B 48 Decimal 2772[Description] ThiscommandisthesameasDC2orESCP.

ESC P

[Function] Disablecondensedmode.[Format] ASCII ESCP

Hexadecimal 1B 50Decimal 2780

[Description] ThiscommandisthesameasDC2orESCH.

Page 32: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

25

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC SI

[Function] Enablecondensedmode.[Format] ASCII ESCSI Hexadecimal 1B 0F Decimal 2715[Description] Turnoncondensedmode.

ESC SO

[Function] Enableon-lineexpandedmode.[Format] ASCII ESCSO Hexadecimal 1B0E Decimal 2714[Description] Ifthiscommandisreceivedatthebeginningofaline,expandedisvalidforthewholeline. Otherwise, condensed will be valid only for next incoming characters. In the next line the printer will return to normal mode.

ESC V

[Function] Enableon-linedoubleheightmode.[Format] ASCII ESCV Hexadecimal 1B56 Decimal 2786[Description] Ifthiscommandisreceivedinthebeginningofaline,doubleheightisvalidforthewholeline. Otherwise, double height will be valid only for next incoming characters. In the next line the printer will return to normal mode.ESC W n

[Function] Enable/disableexpandedmode.[Format] ASCII ESCWn Hexadecimal 1B57n Decimal 2787n[Range] n=0,1[Default] n=0[Description] Setexpandedmode(doublewidth). Ifnis0(00hor30h),expandedmodeisdisabled. Ifnis1(01hor31h),expandedmodeisenabled.[Note] This command can be sent to the printer at any time, and it will take effect immediately.

SI

[Function] Enablecondensedmode.[Format] ASCII SI Hexadecimal 0F Decimal 15[Description] ThiscommandisthesameasESCSI.

SO

[Function] Enableon-lineexpandedmode.[Format] ASCII SO Hexadecimal 0E Decimal 14[Description] ThiscommandisthesameasESCSO.

Page 33: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

26

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC $ n1 n2

[Function] Fill in blank bit columns.[Format] ASCII ESC$n1 n2

Hexadecimal 1B 24 n1 n2

Decimal 2736n1 n2

[Description] Thiscommandfillsinblankbitcolumns,fromcurrentcolumnuntilcolumnnumber(n1+n2*256), where n1+n2*256shouldbelessthanorequaltoN.‘N’istheprintingwidth,dependingonthe print mode.

ESC * ! n1 n2 b1 ... bn

[Function] 24-bit graphics.[Format] ASCII ESC*!n1 n2 b1 ... b2

Hexadecimal 1B 2A 21 n1 n2 b1 ... b2

Decimal 274233n1 n2 b1 ... b2

[Description] This command downloads a 24-bit bit image with n1+n2*256 columns and b1...bn bytes to composetheimage.Eachcolumncontains3bytes,asshowninthefigurebelow.

1st byte {2nd byte {3rd byte {

1st bit-column

8th bit-column

MSB (bit 7)

LSB (bit 0)

Thisillustrationshowsa24-bitgraphiccontaining8bit-columnswith3bytesheighteach(24bits). It shows how bytes are interpreted by the printer when this command is used. A full printlinewith‘N’columnswillneedN*3bytes.Iftheimagetoprinthaslessthan‘N’graphiccolumns,aLFcommandmustbesenttoperformlineprinting.Textandgraphicmaybemixedin the same line.

ESC K n1 n2 b1 ... bn

[Function] 8-bit graphics.[Format] ASCII ESCKn1 n2 b1 ... b2

Hexadecimal 1B 4B n1 n2 b1 ... b2

Decimal 2775n1 n2 b1 ... b2

[Description] Select“8pin”bit image (compatiblewithdot-matrixprinters)where [n1+(n2*256)] is the number of columns, and each column is 1 byte in length. As to fill the line it is necessary to expandthissinglebytein3bytes,8-bitimagesarealwayslowresolution.Theorganizationof an eight-bit image is presented in the figure below.

Page 34: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

27

MP-4200 TH Programmer’s Manual - Revision 1.0

1 byte {1st bit-column

8th bit-column

MSB (bit 7)

LSB (bit 0)

If the image to print has less than ‘N’ graphic columns, a LFmust be sent to perform line printing. Text and graphic may be mixed in the same line.

FS p n m

[Function] Print non-volatile (NV) bit image.[Format] ASCII FS p n m Hexadecimal 1C70nm Decimal 28112nm[Description] Printthen-thNVbitimageusingmprintmode.

m Mode Vertical Dot Density Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

n is the NV bit image number, as defined by the FS q command.m is bit image print mode.This command has no effect when the n-th NV bit image is not defined.

FS q n [xL xH yL yH d1 ... dn]1 ... [xL xH yL yH d1 ... dn]n

[Function] DefineNVbitimage.[Format] ASCII FS q n [xL xH yL yH d1 ... dn]1 ... [xL xH yL yH d1 ... dn]n

Hexadecimal 1C71n[xL xH yL yH d1 ... dn]1 ... [xL xH yL yH d1 ... dn]n

Decimal 28112n[xL xH yL yH d1 ... dn]1 ... [xL xH yL yH d1 ... dn]n

[Range] 1≤n≤255 0≤xL≤255 0≤xH≤3(when1≤(xL+xH×256)≤1023) 0≤yL≤255 0≤yL≤1(when1≤(yL+yH×256)≤288) 0≤d≤255 k=(xL+xH×256)×(yL+yH×256)×8[Description] DefinenNVbitimagestobestoredonthenon-volatilememory. n specifies the number of NV bit images. xL, xH specifies (xL+xH×256)×8dotsinthehorizontaldirectionfortheNVbitimage. yL, yH specifies (yL+yH×256)×8dotsintheverticaldirectionfortheNVbitimage. This command erases all NV bit images defined previously and set new ones.

Page 35: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

28

MP-4200 TH Programmer’s Manual - Revision 1.0

GS / m

[Function] Print downloaded bit image.[Format] ASCII GS/m Hexadecimal 1D2Fm Decimal 2947m[Description] Printadownloadedbitimageusingthemodespecifiedbym.

m Mode Vertical Dot Density Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

m is bit image print mode. This command has no effect when a downloaded bit image has not been defined.

GS * x y d1 ... d(x*y*8)

[Function] Definedownloadedbitimage.[Format] ASCII GS*xyd1 ... d(x*y*8) Hexadecimal 1D2Axyd1 ... d(x*y*8) Decimal 2942xyd1 ... d(x*y*8)[Range] 1≤x≤255 1≤y≤64 0≤d≤255[Description] Definesadownloadedbitimageusingthespecifiednumberofdots. (x × 8) defines the number of dots in the horizontal direction. (y × 8) defines the number of dots in the vertical direction. ThedownloadedbitimageisclearedwhenESC@orFSqcommandisexecuted,whenprinter is restarted or when power supply is cycled. The following picture shows the relationship between the downloaded bit image and print data:

Page 36: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

29

MP-4200 TH Programmer’s Manual - Revision 1.0

GS v 0 m xL xH yL yH d1 ... dk

[Function] Print raster bitmap.[Format] ASCII GSv0mxL xH yL yH d1 ... dk

Hexadecimal 1D7630mxL xH yL yH d1 ... dk

Decimal 2911848mxL xH yL yH d1 ... dk

[Range] 0≤m≤3or48≤m≤51 0≤xL≤255;0≤xH≤255 0≤yL≤255;0≤yH≤8 0≤d≤255 k=(xL+xH×256)×(yL+yH×256)(k≠0)[Description] Printrasterbitmapusingthemodedefinedbym:

m Mode Vertical Dot Density Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

xL and xH, define the number of bytes (xL+xH×256)inthehorizontaldirectionforthebitimage.yL and yH define the number of bytes (yL+yH×256)intheverticaldirectionforthebitimage.Dataoutsideprintingareaisdiscarded.ThepositionatwhichsubsequentcharactersareprintedforrasterbitimageisspecifiedbyHT,ESC$,ESC\andGSL.ESCaisaffectiveonrasterbitimages. d indicates bit-image data. Setting a bit to 1 prints a dot and clearing a bit does not print a dot

[Example] Whenprinting640dots,xL+xH×256mustbe80,asillustratedonfollowingfigure:

Page 37: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

30

MP-4200 TH Programmer’s Manual - Revision 1.0

7 6 5 4 3 2 1 0MSB LSB

(XL+XHx256)x8 dots = 640 dots

d1 d2 d3 ... d78 d79 d80

d81 d82 d83 ... d158 d159 d160

...

dK-79 dK-78 dK-77 ... dK-2 dK-1 dK

...(YL+YHx256) dots

... ... ... ... ...

ENQ

[Function] Printer status enquiry.[Format] ASCII ENQ Hexadecimal 05 Decimal 05[Description] Issuingthiscommand,theprintershouldreturnastatusbyte,asdefinedbelow:

Status bit number Logic “0” Logic “1”

0 PrinterOffLine PrinterOnLine

1 Paper Present Paper Out

2* Drawerpinlow Drawerpinhigh

2** Paper Present Paper Out

3 Print head raised Print head down

4 Paper Full PaperNearEnd

5 Command not executed Command executed

6–7 Unused(alwaysreturn“0”)

*Refertodraweruser’smanualtoknowwhatthisvaluemean.**Drawerstatusorpaperstatusonbitnumber2dependsonESCb.

GS F8h 1

[Function] Printer extended status enquiry.[Format] ASCII GSF8h1 Hexadecimal 1DF831 Decimal 2924849[Description] Issuingthiscommandmakestheprintertoreturnfivestatusbytes.

The first byte is the printer status:

7 6–5 4 3 2 1 0

1 BufStat Wait Offline OVR 0 0

Bit2:OVR(OverrunError) 0–Printerisreadytoreceivedata.

Page 38: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

31

MP-4200 TH Programmer’s Manual - Revision 1.0

1–Printerisinoverruncondition.Ifmoredatais received, it will be lost.

Bit3:Offline.0–Printerison-line.1–Printerisoff-line.

Bit 4: Wait.0–Printerisprinting(busycondition).1–Printerbufferisempty,waitingformoredata or commands.

Bit6&5:BufStat-Bufferstatus.00–Printerbufferempty.01–Printerbufferisunder1/3ofitscapacity.10–Printerbufferisabove1/3ofitscapacity.11–Printerbufferisbeyond¾ofitscapacity.

The second byte is the off-line status:

7 6 5 4 3 2 1 0

Cover Error NoPaper Drawer 0 PS PNES 1

Bit1:PNES–PaperNear-endSensor0–Paperisnotneartheendofroll.1–Paperisneartheendofroll.Bit2:PS–Papersensor0–Printerhaspaper.1–Printerhasnopaperatall.

Bit4:Drawer0–Drawersensorisinlowlevel(logical0).1–Drawersensorisinhighlevel(logical1).

Bit 5: NoPaper0–Printerhaspaper.1–Printerhasnopaperatall.Bit6:Error0–Noerrorconditionexistintheprinter.1–Atleastoneerrorconditionisbeingreportedby the printer.

Bit7:Cover0–Printercoverisopened.1–Printercoverisclosed.

The third byte is printer error status:

7 6 5 4 3 2 1 0

1 RE NRE 1 CE CA 0 0

Bit2:CA–CutterAbsence0–Cutterpresent.1–Cutterabsent.

Page 39: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

32

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit3:CE–CutterError 0–Noerrorconditiondetectedinthecutter.1–Cuttererrorconditiondetected.Bit5:NRE–Non-recoverableError0–NREconditionnotdetected.1–NREconditiondetected.

Bit6:RE–RecoverableError0–REconditionnotpresent.1–REconditionpresent.

The fourth byte is printer head and command set status:

7 6 5 4 3 2 1 0

1 CMD 0 1 0 HOH 0 1

Bit2:HOH–HeadOverheat0–Printheadhasnormaltemperature.1–Printheadisoverheated.

Bit6:CMD–Currentcommandset0–ESC/Bemacommandset1–ESC/POScommandset

The fifth byte is firmware version and revision:

7 6–4 3–0

0 Firmware version Firmware revision

[Notes] This command does not work in a parallel printer using Compatibility Mode.

ETX

[Function] Endbuffer.[Format] ASCII ETX Hexadecimal 03 Decimal 3[Description] TheprinterwillremainintheBUSYstatefromthemomentitreceivesthiscommanduntilthe printbufferbecomesempty.OnserialinterfacesDTR(RTS)willalsoremaindeactivatedwhile printing is on going.

STX

[Function] Clear buffer.[Format] ASCII STX

Hexadecimal 02Decimal 2

[Description] Thiscommandclearstheprintbufferwithoutrestoringdefaultprinterconditions.

CAN

[Function] Cancel last line.[Format] ASCII CAN Hexadecimal 18 Decimal 24[Description] Thiscommandclearsthelastlinesenttotheprinter.Ifdataisalreadydispatchedtoprinthead, no action is taken.

Page 40: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

33

MP-4200 TH Programmer’s Manual - Revision 1.0

DEL

[Function] Cancel last character.[Format] ASCII DEL Hexadecimal 7F Decimal 127[Description] Thiscommandclearsthelastcharactersenttotheprinter.Ifthelastcharacterhasbeenalready dispatched to print head, no action is taken.

GS h n

[Function] Set barcode height.[Format] ASCII GShn Hexadecimal 1D68n Decimal 29104n[Range] 1≤n≤255[Default] n=162[Description] Barcodeheightissettonx0.125mm.

GS w n

[Function] Set barcode width.[Format] ASCII GSwn Hexadecimal 1D77n Decimal 29119n[Range] 2≤n≤4[Default] n=3[Description] Thiscommandchangesbarcodewidth.

n=2meansnormalwidth.n=3meansdoublewidth.n=4meansquadruplewidth.

GS H n

[Function] Choose the position of human readable information (HRI) in the barcode.[Format] ASCII GSHn Hexadecimal 1D48n Decimal 2972n[Range] 0≤n≤3[Default] n=1[Description] n=0meansnoHRI.

n=1meansHRIontopofbarcode.n=2meansHRIonbottomofbarcode.n=3meansHRIonbothtopandbottomofbarcode.

GS f n

[Function] Set the font to be used for human readable information (HRI).[Format] ASCII GSfn Hexadecimal 1D66n Decimal 29102n[Range] n=0,1,48or49[Default] n=0[Description] n=0orn=48selectsthenormalfont. n=1orn=49selectsthecondensedfont.

Page 41: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

34

MP-4200 TH Programmer’s Manual - Revision 1.0

GS k NUL d1 ... d11 NUL

[Function] Print an UPC-A barcode.[Format] ASCII GSkNULd1 ... d11NUL Hexadecimal 1D6B00d1 ... d11 00 Decimal 291070d1 ... d11 0[Range] 48≤dn≤57[Description] d1…d11isasequenceof11bytescontainingbarcodeinformation.Thechecksumdigitisadded automatically by the printer.

GS k A VT d1 ... d11

[Function] Print an UPC-A barcode.[Format] ASCII GSkAVTd1 ... d11

Hexadecimal 1D6B410Bd1 ... d11

Decimal 291076511d1 ... d11

[Range] 48≤dn≤57[Description] ThiscommandisacopyofGSkNULd1…d11NUL.

GS k SOH d1 ... d6 NUL

[Function] PrintanUPC-Ebarcode.[Format] ASCII GSkSOHd1 ... d6NUL Hexadecimal 1D6B01d1...d600 Decimal 291071d1...d60[Range] 48≤dn≤57[Description] d1…d6isasequenceof6bytescontainingbarcodeinformation.Thechecksumdigitisadded automatically by the printer.

GS k B ACK d1 ... d6

[Function] PrintanUPC-Ebarcode.[Format] ASCII GSkBACKd1 ... d6 Hexadecimal 1D6B4206d1 ... d6 Decimal 29107666d1 ... d6[Range] 48≤dn≤57[Description] ThiscommandisacopyofGSkSOHd1…d6NUL.

GS k STX d1 ... d12 NUL

[Function] PrintanEAN-13barcode.[Format] ASCII GSkSTXd1 ... d12NUL Hexadecimal 1D6B02d1 ... d12 00 Decimal 291072d1 ... d12 0[Range] 48≤dn≤57[Description] d1…d12 isasequenceof12bytescontainingbarcode information.Printergenerates the13

th digit automatically.

GS k C FF d1 ... d12

[Function] PrintanEAN-13barcode.[Format] ASCII GSkCFFd1 ... d12

Hexadecimal 1D6B430Cd1 ... d12

Decimal 291076712d1 ... d12

Page 42: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

35

MP-4200 TH Programmer’s Manual - Revision 1.0

[Range] 48≤dn≤57[Description] ThiscommandisacopyofGSkSTXd1…d12NUL.

GS k ETX d1 ... d7 NUL

[Function] PrintanEAN-8barcode.[Format] ASCII GSkETXd1 ... d7NUL Hexadecimal 1D6B03d1 ... d7 00 Decimal 291073d1 ... d7 0[Range] 48≤dn≤57[Description] d1…d7isasequenceof7bytescontainingbarcodeinformation.Printergeneratesthe8

th digit automatically.

GS k D BEL d1 ... d7

[Function] PrintanEAN-8barcode.[Format] ASCII GSkDBELd1 ... d7 Hexadecimal 1D6B4407d1 ... d7 Decimal 29107687d1 ... d7[Range] 48≤dn≤57[Description] ThiscommandisacopyofGSkETXd1…d7NUL.

GS k EOT d1 ... dn NUL

[Function] PrintaCODE39barcode.[Format] ASCII GSkEOTd1 ... dnNUL Hexadecimal 1D6B04d1 ... dn 00 Decimal 291074d1 ... dn 0[Range] dmaybe32,36,37,42,43,45-57and65-90(uppercaseletters).[Description] d1…dn is a sequence of n bytes containing barcode information. The checksum digit is generated automatically by the printer. The number of barcode digits is limited by the physical print width, aswellastheprogrammedbarcodewidth(GSwn).

GS k E n d1 ... dn

[Function] PrintaCODE39barcode.[Format] ASCII GSkEnd1 ... dn

Hexadecimal 1D6B45nd1 ... dn

Decimal 2910769nd1 ... dn

[Description] ThiscommandisacopyofGSkEOTd1…dnNUL.

GS k ENQ d1 ... dn NUL

[Function] Print an ITF barcode.[Format] ASCII GSkENQd1 ... dnNUL Hexadecimal 1D6B05d1 ... dn 00 Decimal 291075d1 ... dn 0[Range] 48≤dn≤57[Description] d1…dn is a sequence of n bytes containing barcode information. The number of barcode digits is limitedbythephysicalprintwidth,aswellastheprogrammedbarcodewidth(GSwn).

Page 43: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

36

MP-4200 TH Programmer’s Manual - Revision 1.0

GS k F n d1 ... dn

[Function] Print an ITF barcode.[Format] ASCII GSkFnd1 ... dn

Hexadecimal 1D6B46nd1 ... dn

Decimal 2910770nd1 ... dn

[Range] 48≤dn≤57[Description] ThiscommandisacopyofGSkENQd1…dnNUL.

GS k ACK d1 ... dn NUL

[Function] PrintaCODABARbarcode.[Format] ASCII GSkACKd1 ... dnNUL Hexadecimal 1D6B06d1 ... dn 00 Decimal 291076d1 ... dn 0[Range] dmaybe36,43,45-57and65-68(uppercaseletters)or97-100(lowercaseletters).Uppercase and lowercase letters cannot be combined in the same barcode.[Description] d1…dn is a sequence of n bytes containing barcode information. The number of barcode digits islimitedbythephysicalprintwidth,aswellastheprogrammedbarcodewidth(GSwn).Ifd1 is a letter, the last character (dn) must be a letter too.

GS k G n d1 ... dn

[Function] PrintaCODABARbarcode.[Format] ASCII GSkGnd1 ... dn

Hexadecimal 1D6B47nd1 ... dn

Decimal 2910771nd1 ... dn

[Description] ThiscommandisacopyofGSkACKd1…dnNUL.

GS k H n d1 ... dn

[Function] PrintaCODE93barcode.[Format] ASCII GSkHnd1 ... dn

Hexadecimal 1D6B48nd1 ... dn

Decimal 2910772nd1 ... dn

[Range] 0≤dn≤127[Description] d1…dn is a sequence of n bytes containing barcode information. The checksum digit is generated automatically by the printer. The number of barcode digits is limited by the physical print width, aswellastheprogrammedbarcodewidth(GSwn).

GS k I n d1 ... dn

[Function] PrintaCODE128barcode.[Format] ASCII GSkInd1 ... dn

Hexadecimal 1D6B49nd1 ... dn

Decimal 2910773nd1 ... dn

[Range] 0≤dn≤127[Description] d1…dn is a sequence of n bytes containing barcode information. The checksum digit is generated automatically by the printer. The number of barcode digits is limited by the physical print width, as wellastheprogrammedbarcodewidth(GSwn).

Page 44: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

37

MP-4200 TH Programmer’s Manual - Revision 1.0

GS k 80h n1 n2 n3 n4 n5 n6 d1 ... dn

[Function] PrintaPDF-417barcode.[Format] ASCII GSk80hn1 n2 n3 n4 n5 n6 d1 ... dn

Hexadecimal 1D6B80n1 n2 n3 n4 n5 n6 d1 ... dn

Decimal 29107128n1 n2 n3 n4 n5 n6 d1 ... dn

[Range] 0≤n1≤8 1≤n2≤8 1≤n3≤4 0≤n4≤255[Description] n1istheECClevel. n2isthepitchheight,withheight=n2 x 0.125mm. n3isthepitchwidth,withwidth=n3 x 0.125mm.

n4isthenumberofcodewordsperrow–ifn4 is 0, the maximum number of columns allowed for the pitch width will be used. If the barcode can’t fit the print width the printer automatically adjusts it for the maximum permitted width.n5 and n6 indicate the number of bytes that will be coded, where total=n5+n6x256,andtotalmustbelessthan900.d1…dn is the actual sequence of bytes that will be coded.

GS k NAK d1 ... d9 NUL

[Function] Print an ISBN barcode.[Format] ASCII GSkNAKd1 ... d9NUL Hexadecimal 1D6B15d1 ... d9 00 Decimal 2910721d1 ... d9 0[Range] dmaybe45,48-57and88.Uppercaseandlowercaseletterscannotbecombinedinthesame barcode.[Description] d1…d9isthesequenceof9bytescontainingthebarcodeinformation.Ifhyphensareincluded

in the information, as in the example below, they will not be computed as a dn byte. After the ninthvaliddigit,anhyphencanbeaddedfollowedbyan“X”(58h)oranyotherdigit(30hto39h).Inthiscasetherearetwooptions:- Send the 00h and the barcode will be printed, or-Sendspace(20h)andmore5digits(30hto39h)Example:1-56592-292-X90000 1-56592-292-190000 1-56592-292-X 1-56592-292-1

GS k SYN d1 ... dn NUL

[Function] Print a MSI barcode.[Format] ASCII GSkSYNd1 ... dnNUL Hexadecimal 1D6B16d1 ... dn 00 Decimal 2910722d1 ... dn 0[Range] 48≤dn≤57[Description] d1…dn is a sequence of n bytes containing barcode information. The checksum digit is generated automatically by the printer. The number of barcode digits is limited by the physical print width, aswellastheprogrammedbarcodewidth(GSwn).

Page 45: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

38

MP-4200 TH Programmer’s Manual - Revision 1.0

GS k 82h n d1 ... dn

[Function] Print a MSI barcode.[Format] ASCII GSk82hnd1 ... dn

Hexadecimal 1D6B82nd1 ... dn

Decimal 29107130nd1 ... dn

[Description] ThiscommandisacopyofGSkSYNd1…dnNUL.

GS k ETB d1 ... dn NUL

[Function] PrintaPLESSEYbarcode.[Format] ASCII GSkETBd1 ... dnNUL

Hexadecimal 1D6B17d1 ... dn 00Decimal 2910723d1 ... dn 0

[Range] dmaybe48-57plus65-70(uppercaseletters)or97-102(lowercaseletters).Uppercaseand lowercase letters cannot be combined in the same barcode.[Description] d1…dn is a sequence of n bytes containing barcode information. The checksum digit is generated automatically by the printer. The number of barcode digits is limited by the physical print width, aswellastheprogrammedbarcodewidth(GSwn).

GS k 83h n d1 ... dn

[Function] PrintaPLESSEYbarcode.[Format] ASCII GSk83hnd1 ... dn

Hexadecimal 1D6B83nd1 ... dn

Decimal 29107131nd1 ... dn

[Description] ThiscommandisacopyofGSkETBd1…dnNUL.

GS k 84h n1 n2

[Function] Program barcode left margin.[Format] ASCII GSk84hn1 n2

Hexadecimal 1D6B84n1 n2

Decimal 29107132n1 n2

[Description] Setaleftmarginforprintingbarcodes.Themarginpositionisgivenby[n1+n2x256].

Page 46: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

39

MP-4200 TH Programmer’s Manual - Revision 1.0

Chapter 4

ESC/POS® Command Set ThischapterpresentsdetailedinformationabouteachESC/POS®commandimplementedbytheMP-4200TH printer. SometermsusedinthedescriptionofESC/POScommandsetneedfurtherexplanation,asdescribedbelow.

•Printbuffer:abufferthatstorestheimagedatatobeprinted.•Printbufferfull:thestatewheretheprintbufferisfull.Ifnewprintdataisinputwhiletheprint buffer is full, the data in the print buffer is printed out and a line feed is executed. This is thesameoperationastheLFoperation.•Startofline:astatethatsatisfiesthefollowingconditions: o Print buffer is empty. o There is no data to print (including portions of data skipped due to HT). oTheprintpositionhasnotbeenspecifiedbytheESC$orESC\command.•Printablearea:themaximumspaceavailableforprinting.TheprintableareaunderESC/POSforMP-4200THisspecifiedbyhorizontaldirection(73.6mm{588/203”}).• Printingarea:avaluesetbythecommand.Itmustbealwayslessthanorequaltoprintablearea.•Ignore:astateinwhichallcodes,includingparameters,arereadinanddiscarded,andnothinghappens.•MSB:MostSignificantBit•LSB:LeastSignificantBit

HT

[Function] Horizontal tab.[Format] ASCII HT Hexadecimal 09 Decimal9[Description] Moveprintpositiontothenexthorizontaltabmark.[Details] •Thiscommandisignoredifnexthorizontaltabmarkhasnotbeenset.

•HorizontaltabmarksaresetwithESCD.•Ifthiscommandisreceivedwhentheprintingpositionisat[printingareawidth+1],theprinter executes print buffer-full printing of the current line and horizontal tab processing from the beginning of the next line.

[Reference] ESCD

LF

[Function] Print and line feed.[Format] ASCII LF Hexadecimal 0A Decimal 10[Description] Printdataintheprintbuffer,ifany,andfeedonelinebasedoncurrentlinespacing.[Details] Thiscommandsetprintpositiontothebeginningofthenextline.[Reference] ESC2,ESC3

Page 47: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

40

MP-4200 TH Programmer’s Manual - Revision 1.0

CR

[Function] Print and carriage return.[Format] ASCII CR Hexadecimal 0D Decimal 13[Description] Whenautomaticlinefeedisenabled,thiscommandfunctionsthesameasLF;whenautomatic line feed is disabled this command is ignored.[Details] •Setprintpositiontothebeginningoftheline. •Automaticlinefeedisignoredwithaserialinterfacemodel.[Reference] LF

DLE EOT n

[Function] Real-time status transmission.[Format] ASCII DLEEOTn Hexadecimal 10 04 n Decimal 164n[Range] 1≤n≤4

[Description] Transmitstheselectedprinterstatusspecifiedbyninreal-time,accordingtothe following parameters:n=1:Transmitprinterstatusn=2:Transmitofflinestatusn=3:Transmiterrorstatusn=4:Transmitpaperrollsensorstatus

[Details] •Theprintertransmitscurrentstatus.Eachstatusisrepresentedbyone-bytedata.•Theprintertransmitsthestatuswithoutconfirmingwhetherthehostcomputercanreceivedata.•Theprinterexecutesthiscommanduponreceivingit.•Thiscommandisexecutedevenwhentheprinterisoffline,thereceivebufferisfull,orthereis an error status with a serial interface model.•Withaparallelinterfacemodel,thiscommandcannotbeexecutedwhentheprinterisbusy.This command is executed even when printer is offline.•WhenAutoStatusBack(ASB)isenabledusingtheGSacommand,thestatustransmittedbytheDLEEOTcommandandtheASBstatusmustbedifferentiated.•EventhoughtheprinterisnotselectedusingESC=(selectperipheraldevice),thiscommandis effective.

[Notes] •Thiscommandshouldnotbeusedwithinadatasequenceofanothercommandthatconsists of 2 or more bytes. n=1:Printerstatus

Bit On/Off Hex Dec Function

0 Off 00 0 Not used. Fixed to off.

1 On 02 2 Not used. Fixed to on.

2

Off 00 0 Draweropen/closesignalisLOW(connectorpin3).

On 04 4 Draweropen/closesignalisHIGH(connectorpin3).

3Off 00 0 Printer online.

On 08 8 Printer offline.

4 On 10 16 Not used. Fixed to on.

5,6 - - - Undefined.

7 Off 00 0 Not used. Fixed to off.

Page 48: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

41

MP-4200 TH Programmer’s Manual - Revision 1.0

n=2:Offlinestatus

Bit Off/On Hex Decimal Function

0 Off 00 0 Not used. Fixed to Off.

1 On 02 2 Not used. Fixed to On.

2 Off 00 0 Cover is closed.

On 04 4 Cover is open.

3 Off 00 0 PaperisnotbeingfedbyusingtheFEEDbutton.

On 08 8 PaperisbeingfedbytheFEEDbutton.

4 On 10 16 Not used. Fixed to On.

5 Off 00 0 No paper-end stop.

On 20 32 Printing is being stopped.

6 Off 00 0 No error.

On 40 64 Erroroccurs.

7 Off 00 0 Not used. Fixed to Off.

Bit 5: Becomes on when paper end sensor detects paper end.n=3:Errorstatus

Offline status

Bit Off/On Hex Decimal Function

0 Off 00 0 Not used. Fixed to Off.

1 On 02 2 Not used. Fixed to On.

2 – – – Undefined

3Off 00 0 No autocutter error.

On 08 8 Autocutter error occurs.

4 On 10 16 Not used. Fixed to On.

5 Off 00 0 No unrecoverable error.

On 20 32 Unrecoverable error occurs.

6 Off 00 0 No auto-recoverable error.

On 40 64 Auto recoverable error occurs.

7 Off 00 0 Not used. Fixed to Off.

Bit3:Iftheseerrorsoccurduetopaperjam,itispossibletorecoveritbyopeningcoverandclosing it again. If an error due to a circuit failure (e.g. wire break) occurs, it is impossible to recover.Bit6:Becomesonwhenprinting is stoppeddue tohighprinthead temperature, theprinterremains stopped until the print head temperature drops sufficiently or when the paper roll cover is open during printing.

Page 49: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

42

MP-4200 TH Programmer’s Manual - Revision 1.0

n=4:Continuouspapersensorstatus

Continuous paper sensor status

Bit Off/On Hex Decimal Function

0 Off 00 0 Not used. Fixed to Off.

1 On 02 2 Not used. Fixed to On.

2,3 Off 00 0 Paper roll near-end sensor: paper adequate.

On 0C 12 Paper near-end is detected by the paper roll near-end sensor.

4 On 10 16 Not used. Fixed to On.

5,6 Off 00 0 Paper roll sensor: Paper present.

On 60 96 Paper roll end detected by paper roll sensor.

7 Off 00 0 Not used. Fixed to Off.

[References] DLEENQ,GSa,GSr

DLE ENQ n

[Function] Real-time request to printer.[Format] ASCII DLEENQn Hexadecimal 10 05 n Decimal 165n[Range] 1≤n≤2[Description] Respondstoarequestfromthehostcomputer.

n=1:Recoverfromanerrorandrestartprintingfromthelinewheretheerroroccurred.n=2:Recoverfromanerrorafterclearingreceiveandprintbuffers.

[Notes] Do nothing command. Implemented to adhere to ESC/POS. Auto-cutter error recovery is performed by opening the cover and closing it again.

DLE DC4 fn m t (fn = 1)

[Function] Generatepulseatreal-time.[Format] ASCII DLEDC4fn m t Hexadecimal 10 14 fn m t Decimal 1620fn m t[Range] ƒn=1

m=0,11≤t≤8

[Description] Outputsthepulsespecifiedbyttoconnectorpinmasfollows:

m Connector pin

0 Drawerkick-outconnectorpin2.

1 Drawerkick-outconnectorpin5.

The pulse ON or OFF time is [t × 100 ms].

[Details] •Whentheprinterisinanerrorstatus,thiscommandisignored.•ThiscommandisignoredwhenanESCporaDLEDC4isbeingexecutedinthesameoutputpin.

Page 50: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

43

MP-4200 TH Programmer’s Manual - Revision 1.0

•Theprinterexecutesthiscommanduponreceivingit.•Thiscommandisexecutedevenwhentheprinterisoffline.• This command is effective evenwhen the printer is disabledwithESC= (Select peripheraldevice).

[Notes] •ThiscanbeenabledordisabledbyGS(Dcommand.[Reference] ESCp,GS(D

DLE DC4 fn a b (fn = 2)

[Function] Executepower-offsequence.[Format] ASCII DLEDC4fn m t Hexadecimal 10 14 fn m t Decimal 1620fn m t[Visibility] Public[Range] ƒn=2 a=1 b=8[Details] •Donothingcommand.ImplementedtoadheretoESC/POS.

DLE DC4 fn d1 ... d7 (fn = 8)

[Function] Clear buffer.[Format] ASCII DLEDC4fn d1 ... d7 Hexadecimal 10 14 fn d1 ... d7 Decimal 1620fn d1 ... d7[Range] ƒn=8 d1=1;d2=3;d3=20;d4=1;d5=6;d6=2;d7=8[Details] •Donothingcommand.ImplementedtoadheretoESC/POS.

ESC SP n

[Function] Set right-side character spacing.[Format] ASCII ESCSPn Hexadecimal 1B 20 n Decimal 2732n[Range] 0≤n≤255[Default] n=0[Description] Setcharacterspacingfortherightsideofacharacterto[n×horizontalmotionunit].[Details] • The right-side character spacing for double-width mode is twice the normal value. When characters are enlarged, the right-side character spacing is n times normal value.

•Thiscommanddoesnotaffectthesettingofideograms.•ThehorizontalmotionunitcanbespecifiedbyGSP.Changinghorizontalmotionunitdoesnotaffect the current right-side spacing.• TheGSP command can change horizontal and verticalmotion units.However, the valuecannot be less than minimum horizontal movement amount, and it must be in even units of minimum horizontal movement amount.•Themaximumright-sidespacingis31.91mm{255/203”}.Anysettingexceedingthemaximumis converted to the maximum automatically.

[Reference] GSP

Page 51: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

44

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC ! n

[Function] Select print mode(s).[Format] ASCII ESC!n Hexadecimal 1B 21 n Decimal 2733n[Range] 0≤n≤255[Default] n=0[Description] Selectprintmode(s)usingnasfollows:

Bit Off/On Hex Decimal Function

0Off 00 0 Character font C (14 × 24).

On 01 1 CharacterfontD(10.5×24).

1 - - - Undefined.

2 - - - Undefined.

3Off 00 0 Emphasizedmodenotselected.

On 08 8 Emphasizedmodeselected.

4Off 00 0 Double-heightmodenotselected.

On 10 16 Double-heightmodeselected.

5Off 00 0 Double-widthmodenotselected.

On 20 32 Double-widthmodeselected.

6 - - - Undefined.

7Off 00 0 Underline mode not selected.

On 80 128 Underline mode selected.

[Details] •Whenbothdouble-heightanddouble-widthmodesareselected,quadruplesizecharactersare printed.

•Theprintercanunderlineallcharacters,butcannotunderlinethespacesetbyHTor90°clockwise rotated characters.•ThethicknessoftheunderlinecanbeselectedbyESC−,regardlessofthecharactersize.•Whensomecharactersinalinearedoubleormoreheight,allthecharactersonthelinearealigned at the baseline.•ESCEcanalsoturnonoroffemphasizedmode.However, thesettingof the lastreceivedcommand is effective.•ESC− can also turn on or off underlinemode.However, the setting of the last receivedcommand is effective.•GS ! canalso select character size.However, the settingof the last received command iseffective.• Emphasized mode is effective for alphanumeric and ideograms. All print modes exceptemphasized mode is effective only for alphanumeric.

[References] ESC-,ESCE,GS!

ESC $ nL nH

[Function] Set absolute print position.[Format] ASCII ESC$nLnH Hexadecimal 1B24nLnH Decimal 2736nLnH[Range] 0≤nL≤255 0≤nH≤255[Description] Setthedistancefromthebeginningofthelinetothepositionatwhichsubsequentcharacters are to be printed.

Page 52: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

45

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thedistancefromthebeginningofthelinetotheprintpositionis(nL+nH×256).[Details] •Settingavalueoutsideprintableareaisignored.

•ThehorizontalmotionunitisspecifiedbyGSP.•TheGSPcommandcanchangehorizontalmotionunit.However,thevaluecannotbelessthan minimum horizontal movement amount, and it must be in even units of minimum horizontal movement amount.

[References] ESC\,GSP

ESC ( A ENQ NUL a d c t1 t2

[Function] Activate/deactivate buzzer.[Format] ASCII ESC(AENQNULadct1 t2

Hexadecimal 1B284105006164ct1 t2

Decimal 2740655097100ct1 t2

[Range] 0≤c≤63;0≤t1≤255;0≤t2≤255[Description] Activatestheintegratedbuzzer.

•cspecifiesthenumberofbeepingcycles.•t1 specifies buzzer on time (t1 × 100 ms) for each cycle.•t2 specifies buzzer off time (t2 × 100 ms) for each cycle.

ESC * m nL nH d1 ... dk

[Function] Select bit-image mode.[Format] ASCII ESC*mnL nH d1 ... dk

Hexadecimal 1B 2A m nL nH d1 ... dk

Decimal 2742mnLnH d1 ... dk

[Range] m=0,132,330≤nL≤2550≤nH≤2550≤d≤255

[Description] Selectbit-imagemodeusingmforthenumberofdotsspecifiedbynL and nH, as follows:

m ModeVertical Direction Horizontal Direction

Dots Dot Density Dot Density Data Count (K)

0 8-dot single-density 8 68dpi 101 dpi nL+nHx256

1 8-dot double-density 8 68dpi 203dpi nL+nHx256

32 24-dot single-density 24 203dpi 101 dpi (nL+nHx256)x3

33 24-dot double-density 24 203dpi 203dpi (nL+nHx256)x3

[Details] •Ifmisoutofrange,nLandthedatafollowingitareprocessedasnormaldata.•(nL+nH×256)indicatethenumberofbitimagedotsinthehorizontaldirection.•Ifbit-imagedatainputexceedthenumberofdotstobeprintedonaline,theexcessdataisignored.•dindicatebit-imagedata.•IfthewidthoftheprintingareasetbyGSLandGSWislessthanthewidthrequiredbythedatasentwiththeESC*command,theexcessdatawillbeperformedonthelineinquestion(but the printing cannot exceed the maximum printable area): o The width of the printing area is extended to the right to accommodate the amount of data. o If previous step does not provide sufficient width for the data, the left margin is reduced to accommodate the data.•Afterprintingabitimage,theprinterreturnstonormaldataprocessingmode.•Thiscommandisnotaffectedbyprintmodes(emphasized,double-strike,underline,charactersize or white/black reverse printing), except upside-down printing mode.

Page 53: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

46

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC - n

[Function] Turn underline mode on/off.[Format] ASCII ESC-n Hexadecimal 1B2Dn Decimal 2745n[Range] 0≤n≤2,48≤n≤50[Default] n=0[Description] Turnunderlinemodeonoroff,basedonthefollowingvaluesofn:

n Function

0, 48 Turn off underline mode.

1,49 Turn on underline mode (1-dot thick).

2, 50 Turn on underline mode (2-dot thick).

[Details] •Theprintercanunderlineallcharacters(includingright-sidecharacterspacing),butcannot underline the space set by HT.

• The printer cannot underline 90° clockwise rotated characters and white/black invertedcharacters.•Whenunderlinemodeisturnedoffbysettingthevalueofnto0or48,thefollowingdataisnot underlined, and the underline thickness set before the mode is turned off does not change. The default underline thickness is 1 dot.•Changingcharactersizedoesnotaffectthecurrentunderlinethickness.•UnderlinemodecanalsobeturnedonoroffbyusingESC!.Note,however,thatthe lastreceived command is effective.•Thiscommanddoesnotaffectideogramprinting.

[Reference] ESC!

ESC 2

[Function] Select default line spacing.[Format] ASCII ESC2 Hexadecimal 1B32 Decimal 2750[Description] Selectapproximately4.23mm{1/6”}oflinespacing.[Reference] ESC3

ESC = n

[Function] Select peripheral device.[Format] ASCII ESC=n Hexadecimal 1B3Dn Decimal 2761n[Range] 1≤n≤255[Default] n=1[Description] Selectdevicetosenddatafromthehostcomputer,usingnasfollows:

Bit On/Off Hex Decimal Function

0 Off 00 0 Printer disabled.

On 01 1 Printer enabled.

1-7 - - - Undefined.

Page 54: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

47

MP-4200 TH Programmer’s Manual - Revision 1.0

[Details] Whenprinter isdisabled, it ignoresalldataexcept thosecommandsused for error-recovery commands(DLEEOT,DLEENQ,DLEDC4).

ESC @

[Function] Initialize printer.[Format] ASCII ESC@ Hexadecimal 1B 40 Decimal 2764[Description] Cleardataintheprintbufferandresetprintermodetothatwasineffectwhenpowerwasturnedon.[Details] •DIPswitchsettingsarenotcheckedagain.

•Datainthereceivebufferisnotcleared.•Macrodefinitionisnotcleared.•NVbitimagedataisnotcleared. •DataonNVusermemoryisnotcleared.

ESC D n1 ... nk NUL

[Function] Set horizontal tab marks.[Format] ASCII ESCDn1 ... nkNUL Hexadecimal 1B 44 n1 ... nk 00 Decimal 2768n1 ... nk 0[Range] 1≤n≤255 0≤k≤32[Default] Thedefaulttabmarksareatintervalsof8characters(columns9,17,25,...)forfont14x24.[Description] Sethorizontaltabmarks.

•nspecifiesthecolumnnumberforsettingahorizontaltabpositionfromthebeginningoftheline.•kindicatesthetotalnumberofhorizontaltabpositionstobeset.

[Details] •Thehorizontaltabmarkisstoredasavalueof[characterwidth×n],measuredfromthebeginning of the line. The character width includes the right-side character spacing, and double-width characters are set with twice the width of normal characters.•Thiscommandcancelsprevioushorizontaltabsettings.•Whensettingn=8,theprintpositionismovedtocolumn9bysendingHT.•Upto32tabpositions(k=32)canbeset.Dataexceeding32tabpositionsisprocessedasnormal data.•Transmit[n]kinascendingorderandplaceaNULcode0attheend.•When[n]kislessthanorequaltotheprecedingvalue[n]k-1,tabsettingisfinishedandthefollowing data is processed as normal data.•ESCDNULcancelsallhorizontaltabmarks.•Thepreviouslyspecifiedhorizontaltabmarksdonotchange,evenifcharacterwidthchanges.

[Reference] HT

ESC E n

[Function] Turn emphasized mode on/off.[Format] ASCII ESCEn Hexadecimal 1B 45 n Decimal 2769n[Range] 0≤n≤255[Default] n=0[Description] Turnemphasizedmodeonoroff.

•WhentheLSBofnis0,emphasizedmodeisturnedoff.

Page 55: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

48

MP-4200 TH Programmer’s Manual - Revision 1.0

•WhentheLSBofnis1,emphasizedmodeisturnedon.[Details] •Onlytheleastsignificantbitofnisused. •ThiscommandandESC!turnonandoffemphasizedmodeinthesameway.[Reference] ESC!

ESC G n

[Function] Turn on/off double-strike mode.[Format] ASCII ESCGn Hexadecimal 1B47n Decimal 2771n[Range] 0≤n≤255[Default] n=0[Description] Turndouble-strikemodeonoroff.

•WhentheLSBofnis0,double-strikemodeisturnedoff.•WhentheLSBofnis1,double-strikemodeisturnedon.

[Details] •Onlytheleastsignificantbitofnisused. •Printeroutputisthesameindouble-strikemodeandinemphasizedmode.[Reference] ESCE

ESC J n

[Function] Print and feed paper.[Format] ASCII ESCJn

Hexadecimal 1B 4A nDecimal 2774n

[Range] 0≤n≤255[Default] n=0[Description] Printdataintheprintbufferandfeedpaper[n×verticalmotionunit].[Details] •Afterprinting,thiscommandsetstheprintpositiontothebeginningoftheline.

•ThepaperfeedamountsetbythiscommanddoesnotaffectthevaluessetbyESC2orESC3.•VerticalmotionunitcanbespecifiedbyGSP.•TheGSPcommandcanchangeverticalmotionunit.However,thevaluecannotbelessthanthe minimum vertical movement amount, and it must be set in even units of minimum vertical movement amount.•Themaximumlinespacingis1016mm{40”}.Whenthesettingvalueexceedsthemaximum,it is converted to the maximum automatically.

[Reference] GSP

ESC M n

[Function] Select character font.[Format] ASCII ESCMn Hexadecimal 1B4Dn Decimal 2777n[Range] n=0,1,48,49[Description] Selectacharacterfont.

n Function

0, 48 Character font C (14 x 24) selected.

1,49 CharacterfontD(10.5x24)selected.

[Details] ESC!commandcanalsoselectacharacterfont.Thesettingofthelastreceivedcommandis effect.[Reference] ESC!

Page 56: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

49

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC R n

[Function] Select an international character set.[Format] ASCII ESCRn Hexadecimal 1B 52 n Decimal 2782n[Range] 0≤n≤12[Default] n≤0[Description] Selectsaninternationalcharactersetnfromthefollowingtable.

n Character Set

0 U.S.A.(Codepage437)

1 - 11 International (Codepage 858)

12 LatinAmerica(Codepage850)

ESC V n

[Function] Turn90ºclockwiserotationmodeon/off.[Format] ASCII ESCVn Hexadecimal 1B56n Decimal 2786n[Range] n=0,1,48,49[Default] n=0[Description] Turn90ºclockwiserotationmodeonoroff.nisusedasfollows:

n Function

0, 48 Turnoff90ºclockwiserotationmode.

1,49 Turnon90ºclockwiserotationmode.

[Details] • Even when underline mode is turned on, the printer does not underline characters 90º clockwise-rotated.

•Double-widthanddouble-heightcommandsin90ºrotationmodeenlargecharactersintheopposite directions from double-height and double-width commands in normal mode.

[References] ESC!,ESC-

ESC \ nL nH

[Function] Set relative print position.[Format] ASCII ESC\nL nH

Hexadecimal 1B 5C nL nH

Decimal 2792nL nH

[Range] 0≤nL≤255 0≤nH≤255[Description] Setstheprintstartingpositionbasedoncurrentpositionbyusingthehorizontalmotionunit. •Thiscommandsetthedistancefromthecurrentpositionto[(nL+nH×256)×horizontal motion unit].[Details] •Anysettingthatexceedsprintableareaisignored.

•WhenpitchNisspecifiedtotheright:nL+nH×256=N•WhenpitchNisspecifiedtotheleft:nL+nH×256=65536–N

Page 57: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

50

MP-4200 TH Programmer’s Manual - Revision 1.0

•Theprintstartingpositionmovesfromcurrentpositionto[N×horizontalmotionunit].•ThehorizontalmotionunitcanbespecifiedbyGSP.•TheGSPcommandcanchangethehorizontalmotionunit.However,thevaluecannotbelessthan the minimum horizontal movement amount, and it must set be in even units of the minimum horizontal movement amount.

[References] ESC$,GSP

ESC a n

[Function] Select justification.[Format] ASCII ESCan Hexadecimal 1B61n Decimal 2797n[Range] 0≤n≤2;48≤n≤50[Default] n=0[Description] Aligndatainonelinetothespecifiedposition.nselectsthejustificationasfollows:

n Justification

0, 48 Leftjustification.

1,49 Centering.

2, 50 Right justification.

[Details] •Thecommandisenabledonlywhenprocessedatthebeginningofaline.•Thiscommandexecutesjustificationintheprintingarea.•ThiscommandjustifiesthespaceareaaccordingtoHT,ESC$orESC\.

ESC c 3 n

[Function] Select paper sensor(s) to output paper end signals.[Format] ASCII ESCc3n Hexadecimal 1B6333n Decimal 279951n[Range] 0≤n≤255[Default] n=15[Description] Selectsthepapersensor(s)tooutputpaperendsignals,usingeachbitofnasfollows:

Bit Off/On Hex Decimal Function

0Off 00 0 Paper roll near-end sensor disabled

On 01 1 Paper roll near-end sensor enabled

1Off 00 0 Paper roll near-end sensor disabled

On 02 2 Paper roll near-end sensor enabled

2Off 00 0 Paper roll end sensor disabled

On 04 4 Paper roll end sensor enabled

3Off 00 0 Paper roll end sensor disabled

On 08 8 Paper roll end sensor enabled

4-7 - - - Undefined

[Details] •Itispossibletoselectmultiplesensorstooutputsignal.Then,ifanyofthesensorsdetectsapaper end, the paper end signal is output.

•Thecommandisavailableonlywithaparallelinterfaceprinter,anditisignoredwithother

Page 58: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

51

MP-4200 TH Programmer’s Manual - Revision 1.0

interfaces.•Sensorisswitchedduringcommandexecution.Thepaperendsignalswitchingmaybedelayeddepending on the receive buffer state.•Ifeitherbit0orbit1ison,thepaperrollnear-endsensorisselectedasthepapersensoroutputting paper-end signals.•Ifeitherbit2orbit3ison,thepaperrollendsensorisselectedasthepapersensoroutputtingpaper-end signals.•Whenbothsensorsaredisabled,thepaperendsignalalwaysoutputsapaperpresentstatus.

ESC c 4 n

[Function] Select paper sensor(s) to stop printing.[Format] ASCII ESCc4n Hexadecimal 1B6334n Decimal 279952n[Range] 0≤n≤255[Default] n=0[Description] Selectpapersensor(s)usedtostopprintingwhenapaper-endisdetected,usingnasfollows:

Bit Off/On Hex Decimal Function

0Off 00 0 Paper roll near-end sensor disabled.

On 01 1 Paper roll near-end sensor enabled.

1Off 00 0 Paper roll near-end sensor disabled.

On 02 2 Paper roll near-end sensor enabled.

2-7 - - - Undefined.

[Details] • When a paper sensor is enabled with this command, printing is stopped only when the corresponding paper is selected for printing.

•Whenapaper-endisdetectedbythesensor,theprintergoesofflineandstopsprinting.•Wheneitherbit0or1ison,theprinterselectsthepaperrollnear-endsensorforthepapersensor to stop printing.

Page 59: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

52

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC c 5 n

[Function] Enable/disablepanelbuttons.[Format] ASCII ESCc5n Hexadecimal 1B6335n Decimal 279953n[Range] 0≤n≤255[Default] n=0[Description] Enableordisablepanelbuttons.

•WhentheLSBofnis0,panelbuttonsareenabled.•WhentheLSBofnis1,panelbuttonsaredisabled.

[Details] •Onlytheleastsignificantbitofnisused.•Whenpanelbuttonsaredisabled,noneofthemareusablewhentheprintercoverisclosed.•ThepanelbuttonsareFEEDandCUT.• In themacro readymode, the FEED button is enabled regardless of the settings of thiscommand; however, the paper cannot be fed by using this button.

ESC d n

[Function] Print and feed n lines.

[Format] ASCII ESCdn Hexadecimal 1B64n Decimal 27100n[Range] 0≤n≤255[Description] Printdataavailableintheprintbufferandfeednlines.[Details] •Thiscommandsetstheprintstartingpositiontothebeginningoftheline.

•ThiscommanddoesnotaffectthelinespacingsetbyESC2orESC3.• Themaximumpaper feedamount is1016mm{40”}.If thepaper feedamount(n×linespacing)ofmorethan1016mm{40”}isspecified,theprinterfeedsthepaperonly1016mm{40”}.

[References] ESC2,ESC3

ESC i

[Function] Perform partial paper cut.[Format] ASCII ESCi Hexadecimal 1B69 Decimal 27105[Description] Performsapartialcutoftherollpaper.

ESC m

[Function] Perform partial paper cut.[Format] ASCII ESCm Hexadecimal 1B6D Decimal 27109[Description] Thiscommandoperatestheauto-cutter,performingapartialcutinthepaper.

Page 60: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

53

MP-4200 TH Programmer’s Manual - Revision 1.0

ESC p m t1 t2

[Function] Generatepulse.[Format] ASCII ESCpmt1 t2

Hexadecimal 1B70mt1 t2

Decimal 27112mt1 t2

[Range] m=0,1,48,490≤t1≤2550≤t2≤255

[Description] Outputsthepulsespecifiedbyt1 and t2 to connector pin m as follows:

m Connector pin

0 Drawerkick-outconnectorpin2.

1 Drawerkick-outconnectorpin5.

[Details] •ThepulseONtimeis[t1 × 2 ms] and the OFF time is [t2 × 2 ms].•Ift2 < t1, the OFF time is [t1 × 2 ms]

[Reference] DLEDC4

ESC t n

[Function] Select character code table.[Format] ASCII ESCtn Hexadecimal 1B74n Decimal 27116n[Range] n=0,2,3,17,19,22[Default] n=2[Description] Selectsapagenfromthecharactercodetable.

n Connector pin

0 PC437[U.S.A.andStandardEurope]

2 PC850 [Multilingual]

3 PC860[Portuguese]

17 PC866[Cyrillic]

19 PC858[MultilingualwithEurosymbol]

22 PC864[Arabic]

ESC u n

[Function] Transmit peripheral device status[Format] ASCII ESCun Hexadecimal 1B75n Decimal 27117n[Range] n=0,48[Description] Transmitstheperipheraldevicestatusas1byteofdata. •Theperipheraldevicestatustobetransmittedisasfollows:

Page 61: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

54

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit Bin Hex Dec Status

0 0 00 0 Drawerkick-outconnectorpin3isLOW.

1 01 1 Drawerkick-outconnectorpin3isHIGH.

1-3 - - - Undefined.

4 0 00 0 Not used. Fixed to Off.

5,6 - - - Undefined.

7 0 00 0 Not used. Fixed to Off.

ESC v

[Function] Transmit paper sensor status[Format] ASCII ESCv Hexadecimal 1B76 Decimal 27118[Description] Transmitsthestatusofpapersensor(s)as1byteofdata. •Thepapersensorstatustobetransmittedisasfollows:

Bit Bin Hex Dec Status

0,1 00 00 0 Roll paper near-end sensor: paper adequate.

11 03 3 Roll paper near-end sensor: paper near end.

2,3 00 00 0 Roll paper end sensor: paper present.

11 OC 12 Roll paper end sensor: paper not present.

4 00 00 0 Not used. Fixed to Off.

5,6 - - - Undefined.

7 0 00 0 Not used. Fixed to Off.

ESC { n

[Function] Turn upside-down print mode on/off.[Format] ASCII ESC{n Hexadecimal 1B7Bn Decimal 27123n[Range] 0≤n≤255[Default] n=0[Description] Turnupside-downprintmodeon/off.

•WhentheLSBofnis0,upside-downmodeisturnedoff.•WhentheLSBofnis1,upside-downmodeisturnedon.

[Details] •Onlytheleastsignificantbitofnisvalid. •Thiscommandisenabledonlywhenprocessedatthebeginningofaline. •Inupside-downprintingmode,theprinterrotatesthelinetobeprintedby180°andthenprintsit.

Page 62: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

55

MP-4200 TH Programmer’s Manual - Revision 1.0

FS p n m

[Function] Print NV bit image.[Format] ASCII FS p n m Hexadecimal 1C70nm Decimal 28112nm[Range] 1≤n≤255;0≤m≤3,48≤m≤51[Description] Printn-thNVbitimageusingmodespecifiedbym.

m Mode Vertical Dot Density

Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

•nisthenumberoftheNVbitimagetoprint,asdefinedbyFSqcommand.•mspecifiesthebitimagemode.

[Details] •NVbitimagemeansabitimagestoredinNVmemorybyFSq.•ThiscommandisnoteffectivewhenthespecifiedNVbitimagehasnotbeendefined.•Thiscommandiseffectiveonlywhenthereisnodataintheprintbuffer.•Thiscommandisnotaffectedbyprintmodes(emphasized,double-strike,underline,charactersize,white/blackreverseprinting,or90°rotatedcharacters,etc.),exceptupside-downprintingmode.•IftheprintableareawidthsetbyGSLandGSWfortheNVbitimageislessthanoneverticalline, the following processing is performed only on the line in question. However, in NV bit image mode,oneverticallinemeans1dotinnormalmode(m=0,48)andindouble-heightmode(m=2,50),anditmeans2dotsindouble-widthmode(m=1,49)andinquadruplemode(m=3,51).

o The printing area width is extended to the right in NV bit image mode up to one line vertically. In this case, printing does not exceed the printable area.o If printing area width cannot be extended vertically by one line, the left margin is reduced to accommodate one line vertically.

•Ifdownloadedbit-imageexceedsoneline,theexcessdataisnotprinted.•Thiscommandfeedsdots(fortheheightnoftheNVbit-image)innormalanddouble-widthmodes, and (for the height n × 2 of the NV bit-image) in double-height and quadruple modes, regardlessofthelinespacingspecifiedbyESC2orESC3.•Afterprintingthebitimage,thiscommandsetstheprintpositiontothebeginningofthenextline and processes the data that follows as normal data.

[References] ESC*,FSq,GS/,GSv0

FS q n [xL xH yL yH d1...dk]1...[xL xH yL yH d1...dk]n

[Function] DefineNVbitimage.[Format] ASCII FS q n [xL xH yL yH d1...dk]1 … [xL xH yL yH d1...dk]n

Hexadecimal 1C71n[xL xH yL yH d1...dk]1 … [xL xH yL yH d1...dk]n

Decimal 28113n[xL xH yL yH d1...dk]1 … [xL xH yL yH d1...dk]n

[Range] 1≤n≤255;0≤xL≤255;0≤xH≤3(when1≤[xL+xH...256]≤1023)0≤yL≤255;0≤yH≤1(when1≤[yL+yH×256]≤288)k=[xL+xH×256]×[xL+xH×256]×8Totaldefineddataarea=2Mbits(256Kbytes)

[Description] DefinetheNVbitimagespecifiedbyn.•nspecifiesthenumberofthedefinedNVbitimage.

Page 63: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

56

MP-4200 TH Programmer’s Manual - Revision 1.0

•xL, xH specifies (xL+xH×256)×8dotsinthehorizontaldirection.•yL, yH specifies (xL+xH×256)×8dotsintheverticaldirection.

[Details] •ThiscommandcancelsallNVbitimagesthathavealreadybeendefined.•Theprintercannotredefineonlyoneofseveraldatadefinitionspreviouslydefined.Inthiscase, all data needs to be sent again.•NVbitimagemeansabitimagewhichisdefinedinanon-volatilememorybyFSqandprintedby FS p.•Thiscommandiseffectiveonlywhenprocessedatthebeginningoftheline.• This command is effective when at least 7 bytes <FS~yH> are processed with normalvalues.•InthefirstgroupofNVbitimagesifxL, xH, yL, yH is out of range, this command is disabled.•Afterprocessingthefirstbitimage,ifthereareotherimageswithxL, xH, yL, yH out of range, the printer stops processing this command and starts writing already received images to NV memory.•Thedisdatatobeprinted.• Thiscommanddefinesnas thenumberofaNVbit image.Numbers shouldrise inorder,starting from 1. Therefore, the first data group [xL xH yL yH d1...dk] is NV bit image 1, and the last data group [xL xH yL yH d1...dk] is NV bit image n. The total number of bit images should agree with number of NV bit images specified by command FS p.•AdatadefinitioninNVbitimageconsistsof[xL xH yL yH d1...dk]. Therefore, when only one NV bitimageisbeingdefined(n=1)theprinterprocessesadatagroup[xL xH yL yH d1...dk] once.•Whenthiscommandisreceivedduringmacrodefinition,theprinterendsmacrodefinition,and begins executing this command.•OnceaNVbitimageisdefined,itisnoterasedbyperformingESC@,reset,orpoweroff.

[Reference] FS p

GS ! n

[Function] Select a character size.[Format] ASCII GS!n Hexadecimal 1D21n Decimal 2933n[Range] 0≤n≤255 (1≤verticalnumberoftimes≤8,1≤horizontalnumberoftimes≤8)[Default] n=0[Description] Select character height using bits 0 to 3 and selects character width using bits 4 to 7, asfollows:

Bit Off/On Hex Decimal Function

0

Character height selection.1

2

3

4

Character width selection.5

6

7

Page 64: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

57

MP-4200 TH Programmer’s Manual - Revision 1.0

Hex Decimal Width

00 0 1 (normal)

10 16 2 (double-width)

20 32 3

30 48 4

40 64 5

50 80 6

60 96 7

70 112 8

Hex Decimal Height

00 0 1 (normal)

01 1 2 (double-height)

02 2 3

03 3 4

04 4 5

05 5 6

06 6 7

07 7 8

[Details] •Thiscommandiseffectiveonallcharacters(alphanumericandideograms),exceptonHRI characters. •Ifnisoutofrange,commandisignored.

•Verticaldirectionisthepaperfeeddirection,andthehorizontaldirectionisperpendiculartothepaperfeeddirection.However,whencharacterorientationchangesfor90°clockwise-rotation mode, the relationship between vertical and horizontal directions is reversed.•Whencharactersareenlargedwithdifferentsizesononeline,allthecharactersonthelineare aligned at the baseline.•TheESC!commandcanalsoturndouble-widthanddouble-heightmodesonoroff.However,the setting of the last received command is effective.

[Reference] ESC!

GS * x y d1 ... d(x×y×8)

[Function] Definedownloadedbitimage.[Format] ASCII GS*xyd1 ... d(x×y×8)

Hexadecimal 1D2Axyd1 ... d(x×y×8)

Decimal 2942xyd1 ... d(x×y×8)

[Range] 1≤x≤2551≤y≤48x×y≤15360≤d≤255

[Description] Definesadownloadedbitimageusingthenumberofdotsspecifiedbyxandy:•xspecifiesthenumberofdotsinthehorizontaldirection.•yspecifiesthenumberofdotsintheverticaldirection.

[Details] •Thenumberofdotsinthehorizontaldirectionisx×8,andintheverticaldirectionisy×8.•Ifx×yisoutofrange,thiscommandisdisabled.•dindicatesbit-imagedata.Ifabitindata(d)isset,itwillbeprinted,whileifiscleared,thebit will not be printed.

Page 65: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

58

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thedownloadedbitimagedefinitionisclearedwhen:[email protected] FS q is executed.o Printer is reset or the power is turned off.

•Thefollowingfigureshowstherelationshipbetweendownloadedbitimageandprintdata:

Reference] GS/

GS / m

[Function] Print downloaded bit image.[Format] ASCII GS/m Hexadecimal 1D2Fm Decimal 2947m[Range] 0≤m≤3,48≤m≤51[Description] Printdownloadedbitimageusingthemodespecifiedbym.

m Mode Vertical Dot Density Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

[Details] •Thiscommandisignoredifadownloadedbitimagehasnotbeendefined.•Thiscommandiseffectiveonlywhenthereisnodataintheprintbuffer.•Thiscommandhasnoeffectinprintmodes(emphasized,double-strike,underline,charactersize, or white/black reverse printing), except for upside-down printing mode.•Ifdownloadedbit-imageexceedstheprintablearea,theexcessdataisnotprinted.•IftheprintingareawidthsetbyGSLandGSWislessthanonelineinvertical,thefollowingprocessing is performed only on the line in question:

o The printing area width is extended to the right up to one line in vertical. In this case, printing does not exceed the printable area.o If the printing area width cannot be extended by one line in vertical, the left margin is reduced to accommodate one line in vertical.

[Reference] GS*

Page 66: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

59

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( A pL pH n m

[Function] Executetestprint.[Format] ASCII GS(ApL pH n m Hexadecimal 1D2841pL pH n m Decimal 294065pL pH n m[Range] (pL+(pH×256))=2(pL=2,pH=0) 0≤n≤2,48≤n≤50 1≤m≤3,49≤m≤51[Description] •Executesatestprintwithaspecifiedtestpatternonaspecifiedpaper. •pLandpHspecifiesthenumberoftheparametersuchasn,mto(pL+(pH×256))bytes. n specifies the paper to be tested.

n Paper

0, 48 Paper roll.

1,49

2, 50

m specifies a test pattern.

m Test Pattern

1,49 Hexadecimal dump.

2, 50 Printer status print.

3,51 Rolling pattern print.

[Details] •Thiscommandisenabledonlywhenprocessedatthebeginningofaline.•Whenthiscommandisreceivedduringmacrodefinition,theprinterendsmacrodefinitionandbegins executing this command.•After testprint is finished, theprinterresets itselfautomatically.Therefore, thealready-defined data before this command is executed, such as user-defined characters, downloaded bit image, and macro, becomes undefined, the receive buffer and print buffer are cleared, and each setting returns to its default value.•Theprintercutsthepaperattheendofthetestprint.•TheprintergoesBUSYwhilethiscommandisbeingexecuted.

GS ( D pL pH m [a1 b1] ... [ak bk]

[Function] Enable/disablereal-timecommand.[Format] ASCII GS(DpL pH m [a1 b1] ... [ak bk] Hexadecimal 1D2844pL pH m [a1 b1] ... [ak bk] Decimal 294068pLpHm[a1 b1] ... [ak bk][Range] (pL+pH×256)=3,5(pL=3,5;pH=0)

m=20 a=1,2 b=0,1,48,49[Default]

a Real-time command type Default

1 DLEDC4ƒn m t (ƒn=1):Generatepulseinreal-time Enabled(b=1)

2 DLEDC4ƒn a b (ƒn=2):Executepower-offsequence Disabled(b=0)

Page 67: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

60

MP-4200 TH Programmer’s Manual - Revision 1.0

[Description] Enableordisablereal-timecommands,asdescribedbelow:

a b Function

1 0, 48 DisableDLEDC4ƒn m t (ƒn=1)processing.

1,49 EnableDLEDC4ƒn m t (ƒn=1)processing.

2 0, 48 DisableDLEDC4ƒn a b (ƒn=2)processing.

1,49 EnableDLEDC4ƒn a b (ƒn=2)processing

•pL, pH specifies (pL+pH×256)asthenumberofbytesafterpH (m and [a1 b1]...[ak bk]).•aspecifiesthetypeofreal-timecommand.•bspecifieswhencommandisbeingenabledordisabled.

GS ( L pL pH m fn [parameters]GS 8 L p1 p2 p3 p4 m fn [parameters]

[Function] Process graphics data.[Format] ASCII GS(LpL pH m fn [parameters]

Hexadecimal 1D284CpL pH m fn [parameters]Decimal 294076pL pH m fn [parameters]ASCII GS8Lp1p2p3p4mfn[parameters]Hexadecimal 1D384Cp1p2p3p4mfn[parameters]Decimal 295676p1p2p3p4mfn[parameters]

[Range] fn=0,2,3,4,48,50,51,52,64,65,66,67,69,80,81,82,83,85and112.[Description] Processgraphicsdataaccordingtofunctioncodefn:

ƒn Format Function

0, 48

GS(LpL pH m fn Transmit NV graphics memory capacity.

2, 50

GS(LpL pH m fn Print graphics data in the print buffer.

3,51 GS(LpL pH m fn Transmit the remaining capacity of NV graphics memory.

4, 52 GS(LpL pH m fn Transmit the remaining capacity of downloaded graphics memory.

64 GS(LpL pH m fn d1 d2 Transmit the key code list for defined NV graphics.

65 GS(LpL pH m fn d1 d2 d3 DeleteallNVgraphicsdata.

66 GS(LpL pH m fn kc1 kc2 DeletespecifiedNVgraphicsdata.

67 GS(LpLpHmfnakc1kc2bxL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

DefinearasterNVgraphicsdata.

69 GS(LpL pH m fn kc1 kc2 x y Print specified NV graphics data.

80 GS(LpL pH m fn d1 d2 Transmit key code list for defined download graphics

81 GS(LpL pH m fn d1 d2 d3 Deletealldownloadedgraphicsdata.

82 GS(LpL pH m fn kc1 kc2 Deletespecifieddownloadedgraphicsdata.

83 GS(LpL pH m fn a kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Definearasterdownloadedgraphicsdata.

85 GS(LpL pH m fn kc1 kc2 x y Print specified downloaded graphics data.

112 GS(LpL pH m fn a bx by c xL xH yL yH d1 ... dk Store raster graphics data in the print buffer memory.

•pL, pH specifies (pL+pH×256)asthenumberofbytesafterpH (m, ƒn and [parameters]).•p1, p2, p3, and p4 specify (p1+p2×256+p3×65536+p4×16777216)asthenumberofbytesafter p4 (m, fn, and [parameters]).

Page 68: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

61

MP-4200 TH Programmer’s Manual - Revision 1.0

•[parameters]isdescribedineachfunction.•ƒn defines the function code for the command.•Functioncodes(ƒn)areidenticalforbothGS(LandGS8Lcommands.Theonlydifferencebetween them is the parameters (pL, pH, p1, p2, p3, and p4), used to specify the number of bytes afterm.Becauseofthat,GS(Lcanhandleupto65,535bytes,whileGS8Lcanhandleupto4,294,967,296bytes.

[Notes] •ThegraphicfunctionalityprovidedbybothGS(LandGS8Lcommandsmaintainupwardcompatibility with conventional NV graphics commands (FS p and FS q), downloaded graphics (GS*andGS/)andgraphics(GSv0).•NVgraphics(functions48,51,64,65,66,67and69)storedatainNVmemory.•Downloadedgraphics(functions52,80,81,82,83and85)storedatainvolatilememory.ThisdataislostwhencommandESC@isexecuted,theprinterisresetorpoweristurnedoff.•Graphics(functions50and112)storedataintheprintbuffer.Printingstartsusingfunction50, which also clear the print buffer. Function 50 should be executed just after function 112.•NVgraphicsanddownloadedgraphicsdataaremanagedusingkeycodes,expressedaskc1and kc2. The key codes have a 2-byte configuration and can be specified using the full range of charactercodes(32hto7Eh).•ItisimpossibletocreatedefinitionsforbothNVgraphicsdata(thiscommand)andNVbitimage data (FS q). NV bit image data definitions are deleted when this command is used.•Itisimpossibletocreatedefinitionsforbothdownloadedgraphicsdata(thiscommand)andbitimagedata(GS*).Downloadbitimagedatadefinitionsaredeletedwhenthiscommandsisused.•Functions64and80requireESC/POShandshakingprotocol,asdescribedbelow:

Step Host operation Printer operation

1 This command sends function64/80.

Function64/80isinitiated.

2 Dataisreceivedfrom printer.

Keycodelistissent.

3 Responsecode(*1)issent. Procedures(*2and*3)areperformedaccording to response code.

(*1)ResponseCode

ASCII Hex Dec Request definition

ACK 60 6 Send next data group.

NAK 15 21 Resend just-received data group.

CAN 18 24 Cancel send operation.

(*2) Processing According to Response Code (When Send Data Remains (indicated byidentification status of send data group))

ASCII Description

ACK Initiates operation to send next data.

NAK Resends the just-received data.

CAN Cancels processing initiated by this command.

(*3)ProcessingAccordingtoResponseCode(WhenNoMoreSendDataRemains(indicatedbyidentification status of send data group))

ASCII Description

ACK,CAN Cancels procedure initiated by this command.

NAK Resends the just-received data.

Page 69: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

62

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( L pL pH m fn <fn = 48>

[Function] Transmit NV graphics memory capacity.[Format] ASCII GS(LpL pH m fn

Hexadecimal 1D284CpL pH m fn

Decimal 294076pL pH m fn

[Range] (pL+pH×256)=2(pL=2;pH=0)m=48ƒn=0,48

[Description] TransmitstheentirecapacityoftheNVgraphicsarea,inbytes,asdescribedinthetablebelow:

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 30 48 1

Entirecapacity 30to39 48to57 1 to 8

NUL 00 0 1

The decimal value for the entire capacity is converted to text data and sent, starting from the high order end.

GS ( L pL pH m fn <fn = 50>

[Function] Print graphics data in the print buffer.[Format] ASCII GS(LpL pH m fn

Hexadecimal 1D284CpL pH m fn

Decimal 294076pL pH m fn

[Range] (pL+pH×256)=2(pL=2;pH=0)m=48ƒn=2,50

[Description] PrintbufferedgraphicsdatapreviouslystoredbyGS(L<function112>.[Notes] •Printercannotprintwhenthereisnographicsdatastoredintheprintbuffer.

GS ( L pL pH m fn <fn = 51>

[Function] Transmit the remaining capacity of NV graphics memory.[Format] ASCII GS(LpL pH m fn

Hexadecimal 1D284CpL pH m fn

Decimal 294076pL pH m fn

[Range] (pL+pH×256)=2(pL=2;pH=0)m=48ƒn=3,51

[Description] •Transmitthenumberofbytesofremainingmemory(unusedarea)intheNVgraphicsarea,as described below.

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 30 48 1

Entirecapacity 30to39 48to57 1 to 8

NUL 00 0 1

Page 70: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

63

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thedecimalvaluefortheunusedcapacityisconvertedtotextdataandsent,startingfromthe high order end.•ThisfunctioncannotbeusedtogetherwithNVbitimages(FSq).

GS ( L pL pH m fn <fn = 52>

[Function] Transmit the remaining capacity of downloaded graphics memory.[Format] ASCII GS(LpL pH m fn

Hexadecimal 1D284CpL pH m fn

Decimal 294076pL pH m fn

[Range] (pL+pH×256)=2(pL=2;pH=0)m=48ƒn=4,52

[Description] •Transmitthenumberofbytesofremainingmemory(unusedarea)inthedownloadedgraphics area, as described below.

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 72 114 1

Identificationstatus(*1)(*2) 40 or 41 64or65 1

Data(*3) 30to39 48to57 2 to 80

NUL 00 0 1

•Thedecimalvaluefortheunusedcapacityisconvertedtotextdataandsent,startingfromthe high order end.•Thisfunctioncannotbeusedtogetherwithdownloadedbitimages(GS*).

GS ( L pL pH m fn d1 d2 <fn = 64>

[Function] Transmit key code list for defined NV graphics.[Format] ASCII GS(LpL pH m fn d1 d2

Hexadecimal 1D284CpL pH m fn d1 d2

Decimal 294076pL pH m fn d1 d2

[Range] (pL+pH×256)=4(pL=4;pH=0)m=48ƒn=64d1=75d2=67

[Description] •TransmitdefinedNVgraphicskeycodelist,asdescribedbelow.Thisfunctiondoesrequire ESC/POSHandshakingProtocol.

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 72 114 1

Identificationstatus(*1)(*2) 40 or 41 64or65 1

Data(*3) 30to39 48to57 2 to 80

NUL 00 0 1

Page 71: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

64

MP-4200 TH Programmer’s Manual - Revision 1.0

(*1)WhenthenumberofNVgraphicsdatagroupexceeds40,thegroupsaredividedintoblocksin compliance with the following conditions:

o When unsent data is present, the Identification status byte (byte 3) is set tohexadecimalvalue41h(decimalvalue65).o Whenunsentdata isnotpresent, the Identification statusbyte (byte3) is set tohexadecimalvalue40h(decimalvalue64).

(*2)IfthenumberofNVgraphicsdatagroupsis40orless,theyaresentinsinglebatch,withtheIdentificationstatusbyte(byte3)settohexadecimalvalue40h(decimalvalue64).(*3)Thedatagroupsarearrangedaccordingtothekeycodes.

•Whennokeycodesarepresent,printerresponselookslike:

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 72 114 1

Identification status 40 64 1

NUL 00 0 1

•ThisfunctioncannotbeusedtogetherwithNVbitimages(FSq).

GS ( L pL pH m fn d1 d2 d3 <fn = 65>

[Function] DeleteallNVgraphicsdata.[Format] ASCII GS(LpL pH m fn d1 d2 d3 Hexadecimal 1D284CpL pH m fn d1 d2 d3 Decimal 294076pL pH m fn d1 d2 d3[Range] (pL+pH×256)=5(pL=5;pH=0)

m=48ƒn=65d1=67d2=76d3=82

[Description] •DeleteallNVgraphicsdatadefinedwithfunction67.•Thisfunctionshouldbesendatthebeginningofaline.•Thisfunctioncannotbeusedinsidemacros.

GS ( L pL pH m fn kc1 kc2 <fn = 66>

[Function] DeletespecifiedNVgraphicsdata.[Format] ASCII GS(LpL pH m fn kc1 kc2

Hexadecimal 1D284CpL pH m fn kc1 kc2

Decimal 294076pL pH m fn kc1 kc2

[Range] (pL+pH×256)=4(pL=4;pH=0)m=48ƒn=6632≤kc1≤12632≤kc2≤126

[Description] •DeletestheNVgraphicsdatadefinedbythekeycodeskc1 and kc2.•Thisfunctionshouldbesendatthebeginningofaline.•Thisfunctioncannotbeusedinsidemacros.

Page 72: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

65

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( L pL pH m fn a kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b <fn = 67>GS 8 L p1 p2 p3 p4 m fn a kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

[Function] DefinearasterNVgraphicsdata.[Format] ASCII GS(LpL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Hexadecimal 1D284CpL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Decimal 294076pL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

ASCII GS8Lp1 p2 p1 p2 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Hexadecimal 1D384Cp1 p2 p3 p4 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Decimal 295676p1 p2 p3 p4 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

[Range] 12≤(pL+pH×256)≤65,53512≤(p1+p2×256+p3×65536+p4×16777216)≤4,718,604m=48ƒn=67a=4832≤kc1≤12632≤kc2≤126b=11≤(xL+xH×256)≤8,192(0≤xL≤255,0≤xH≤32)1≤(yL+yH×256)≤2,304(0≤yL≤255,0≤yH≤9)c=490≤d≤255k=(int((xL+xH×256)+7)/8)×(yL+yH×256)

[Description] DefinearasterNVgraphicsdataasarecordspecifiedbythekeycodekc1 and kc2 in the NV graphics area.

o b specifies the number of colors for the defined data.o xL and xH specify the number of dots in the horizontal direction (xL+xH×256).o yL and yH specify the number of dots in the vertical direction (yL+yH×256).o c specifies the color of defined data.o d specify raster data.o k indicates the number of the definition data. k is an explanation parameter; therefore it does not need to be transmitted.

•IfthespecifiedkeycodealreadyexistsinNVmemory,datawillbeoverwritten.[Notes] •Thisfunctionisincompatiblewithmacros,somakesuretoavoidincludingitwhendefiningmacros.

• In caseswhere there is insufficient capacity available for storingNVgraphics data, thisfunction cannot be used. Function 51 should be used to check the available capacity in the NV graphics data area.•Thisfunctionshouldbesendatthebeginningofaline.•Thedataforbytekofd1...dkisprocessedasasingleitemofdefinedNVgraphicsdata.Thedefineddata(d)specifies“1”forbitscorrespondingtodotsthatwillbeprintedand“0”forbitscorresponding to dots that will not be printed.•Specifysingledatagroups[cd1 ... dk]whenmonochromeisselected(b=1)asthecolor.•NVgraphicsdataisprintedusingfunction69.•NotethatitisnotpossibletocreatedefinitionsforbothNVgraphicsdata(thiscommand)andNV bit image data (FS q). NV bit image data definitions are deleted when this command is used.• The relationshipbetweenrasterNVgraphicsdataandprint results is shown in the tablebelow.

d1 d2 … dx

x=xL+xH×256

dx+1 dx+2 … dxx2

: : … :

… dk-2 dk-1 dk

Page 73: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

66

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( L pL pH m fn kc1 kc2 x y <fn = 69>

[Function] Print specified NV graphics data.[Format] ASCII GS(LpL pH m fn kc1 kc2 x y Hexadecimal 1D284CpL pH m fn kc1 kc2 x y Decimal 294076pL pH m fn kc1 kc2 x y[Range] (pL+pH×256)=6(pL=6;pH=0)

m=48ƒn=6932≤kc1≤12632≤kc2≤126x=1,2y=1,2

[Description] •PrintstheNVgraphicsdatadefinedbythekeycodeskc1 and kc2.•x=2definesdoubleheightNVgraphicsprint.•y=2definesdoublewidthNVgraphicsprint.

[Notes] •ThisfunctionisusedtoprintNVgraphicsdatadefinedusingfunction67.•ThespecifiedkeycodemustexistfortheprintertoprintNVgraphicsdata.•Settingsfortexteffect(bold,underline,orientation,etc.exceptforupside-down)andfontsize do not affect the printing of the NV graphics data.

GS ( L pL pH m fn d1 d2 <fn = 80>

[Function] Transmit key code list for defined downloaded graphics.[Format] ASCII GS(LpL pH m fn d1 d2

Hexadecimal 1D284CpL pH m fn d1 d2

Decimal 294076pL pH m fn d1 d2

[Range] (pL+pH×256)=4(pL=4;pH=0)m=48fn=80d1=75d2=67

[Description] •Transmitdefineddownloadedgraphicskeycodelist,asdescribedbelow.Thisfunctiondoes requireESC/POSHandshakingProtocol.

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 73 115 1

Identificationstatus(*1)(*2) 40 or 41 64or65 1

Data(*3) 30to39 48to57 2 to 80

NUL 00 0 1

(*1)Whenthenumberofdownloadedgraphicsdatagroupexceeds40,thegroupsaredividedinto blocks in compliance with the following conditions:Whenunsentdataispresent,theIdentificationstatusbyte(byte3)issettohexadecimalvalue 41h(decimalvalue65).Whenunsentdataisnotpresent,theIdentificationstatusbyte(byte3)issettohexadecimal value40h(decimalvalue64).(*2)IfthenumberofNVgraphicsdatagroupsis40orless,theyaresentinsinglebatch,withtheIdentificationstatusbyte(byte3)settohexadecimalvalue40h(decimalvalue64).(*3)Thedatagroupsarearrangedaccordingtothekeycodes.

Page 74: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

67

MP-4200 TH Programmer’s Manual - Revision 1.0

•Whennokeycodesarepresent,printerresponselookslike:

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 73 114 1

Identification status 40 64 1

NUL 00 0 1

•Thisfunctioncannotbeusedtogetherwithdownloadedbitimages(GS*).

GS ( L pL pH m fn d1 d2 d3 <fn = 81>

[Function] Deletealldownloadedgraphicsdata.[Format] ASCII GS(LpL pH m fn d1 d2 d3 Hexadecimal 1D284CpL pH m fn d1 d2 d3 Decimal 294076pL pH m fn d1 d2 d3[Range] (pL+pH×256)=5(pL=5;pH=0)

m=48ƒn=81d1=67d2=76d3=82

[Description] •Deletealldownloadedgraphicsdatadefinedwithfunction83.•Thisfunctionshouldbeusedatthebeginningofaline.•Thisfunctioncannotbeusedinsidemacros.

GS ( L pL pH m fn kc1 kc2 <fn = 82>

[Function] Deletespecifieddownloadedgraphicsdata.[Format] ASCII GS(LpL pH m fn kc1 kc2

Hexadecimal 1D284CpL pH m fn kc1 kc2

Decimal 294076pL pH m fn kc1 kc2

[Range] (pL+pH×256)=4(pL=4;pH=0)m=48ƒn=8232≤kc1≤12632≤kc2≤126

[Description] •Deletesthedownloadedgraphicsdatadefinedbythekeycodeskc1 and kc2.•Thisfunctionshouldbeusedatthebeginningofaline.•Thisfunctioncannotbeusedinsidemacros.

GS ( L pL pH m fn a kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b <fn = 83>GS 8 L p1 p2 p3 p4 m fn a kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

[Function] Definearasterdownloadedgraphicsdata.[Format] ASCII GS(LpL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Hexadecimal 1D284CpL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Decimal 294076pL pH m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

ASCII GS8Lp1 p2 p1 p2 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Hexadecimal 1D384Cp1 p2 p3 p4 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Decimal 29 5676 p1 p2 p3 p4 m fn kc1 kc2 b xL xH yL yH [c d1 ... dk]1 ... [c d1 ... dk]b

Page 75: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

68

MP-4200 TH Programmer’s Manual - Revision 1.0

[Range] 12≤(pL+pH×256)≤65,53512≤(p1+p2×256+p3×65536+p4×16777216)≤4,718,604m=48ƒn=83a=4832≤kc1≤12632≤kc2≤126b=1,21≤(xL+xH×256)≤8,192(0≤xL≤255,0≤xH≤32)1≤(yL+yH×256)≤2,304(0≤yL≤255,0≤yH≤9)c=49,500≤d≤255

[Description] Definearasterdownloadedgraphicsdataasarecordspecifiedbythekeycodekc1 and kc2 in the downloaded graphics area.

o b specifies the number of colors for the defined data.o xL and xH specify the number of dots in the horizontal direction (xL+xH×256).o yL and yH specify the number of dots in the vertical direction (yL+yH×256).o c specifies the color of defined data.o d specify raster data.o k indicates the number of the definition data. k is an explanation parameter; therefore it does not need to be transmitted.

•Ifthespecifiedkeycodealreadyexistsindownloadedmemory,datawillbeoverwritten.[Notes] •Downloadedgraphicsindicateimagedatagroupsdefinedintheprinter’sinternalvolatile memory(RAM).Oncethedownloadgraphicsdatahavebeendefined,theyareavailableuntilGS (L<function83>[email protected] lostwhen the power is turned off or the printer is reset.

•Thisfunctionisincompatiblewithmacros,somakesuretoavoidincludingitwhendefiningmacros.•Incaseswherethereisinsufficientcapacityavailableforstoringdownloadedgraphicsdata,this function cannot be used. Function 52 should be used to check the available capacity in the downloaded graphics data area.•Thedataforbytekofd1 ... dk is processed as a single item of defined downloaded graphics data.Thedefineddata(d)specifies“1”forbitscorrespondingtodotsthatwillbeprintedand“0”forbitscorrespondingtodotsthatwillnotbeprinted.•Specifysingledatagroups[cd1 ... dk]whenmonochromeisselected(b=1)asthecolor.•Downloadedgraphicsdataisprintedusingfunction85.• Note that it is not possible to create definitions for both downloaded graphics data (thiscommand)anddownloadedbitimagedata(GS*).Downloadedbitimagedatadefinitionsaredeleted when this command is used.•Therelationshipbetweenrasterdownloadedgraphicsdataandprintresultsisshowninthetable below.

d1 d2 … dx

x=xL+xH×256

dx+1 dx+2 … dxx2

: : … :

… dk-2 dk-1 dk

GS ( L pL pH m fn kc1 kc2 x y <fn = 85>

[Function] Print specified downloaded graphics data.[Format] ASCII GS(LpL pH m fn kc1 kc2 x y

Hexadecimal 1D284C pL pH m fn kc1 kc2 x yDecimal 294076pL pH m fn kc1 kc2 x y

[Range] (pL+pH×256)=6(pL=6;pH=0)

Page 76: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

69

MP-4200 TH Programmer’s Manual - Revision 1.0

m=48ƒn=8532≤kc1≤12632≤kc2≤126x=1,2y=1,2

[Description] •Printsthedownloadedgraphicsdatadefinedbythekeycodeskc1 and kc2.•x=2definesdoubleheightdownloadedgraphicsprint.•y=2definesdoublewidthdownloadedgraphicsprint.

[Notes] •Thisfunctionisusedtoprintdownloadedgraphicsdatadefinedusingfunction83.•Thespecifiedkeycodemustexistfortheprintertoprintdownloadedgraphicsdata.•Settingsfortexteffect(bold,underline,orientation,etc.exceptforupside-down)andfontsize do not affect the printing of the downloaded graphics data.

GS ( L pL pH m fn a bx by c xL xH yL yH d1 ... dk <fn = 112>GS 8 L p1 p2 p3 p4 m fn a bx by c xL xH yL yH d1 ... dk

[Function] Definearasterdownloadedgraphicsdata.[Format] ASCII GS(LpL pH m fn a bx by c xL xH yL yH d1 ... dk

Hexadecimal 1D284CpL pH m fn a bx by c xL xH yL yH d1 ... dk

Decimal 294076pL pH m fn a bx by c xL xH yL yH d1 ... dk

ASCII GS8Lp1 p2 p1 p2 m fn a bx by c xL xH yL yH d1 ... dk

Hexadecimal 1D384Cp1 p2 p3 p4 m fn a bx by c xL xH yL yH d1 ... dk

Decimal 295676p1p2p3p4mfn a bx by c xL xH yL yH d1 ... dk

[Range] 11≤(pL+pH...256)≤32,77811≤(p1+p2×256+p3×65536+p4×16777216)≤32,778m=48;ƒn=112;a=48;0≤d≤2551≤(xL+xH×256)≤1,024(0≤xL≤255,0≤xH≤8)1≤(yL+yH×256)≤1,476(0≤yL≤255,0≤yH≤2:by=1)1≤(yL+yH×256)≤738(0≤yL≤255,0≤yH≤2:by=2)c=49,50

[Description] Storerastergraphicsdataintheprintbuffer.o bx specify horizontal mode (normal or double width) and by specify vertical mode (normal or double height).o xL and xH specify the number of dots in the horizontal direction (xL+xH×256).oyLandyHspecifythenumberofdotsintheverticaldirection(yL+yH×256).o c specifies the color of defined data.o d specify raster data.o k indicates the number of the graphics data. k is an explanation parameter; therefore it does not need to be transmitted.

[Notes] •Thisfunctionisincompatiblewithmacros,somakesuretoavoidincludingitwhendefiningmacros.•Settingsfortexteffect(bold,underline,orientation,etc.exceptforupside-down)andfontsize do not affect the printing of the raster graphics data.•Thedataforbytekofd1...dkisprocessedasasingleitemofdefinedgraphicsdata.Thedefineddata(d)specifies“1”forbitscorrespondingtodotsthatwillbeprintedand“0”forbitscorresponding to dots that will not be printed.•Rastergraphicsdataisprintedusingfunction50.•Therelationshipbetweenrastergraphicsdataandprintresultsisshowninthetablebelow.

d1 d2 … dx

x=xL+xHx256

dx+1 dx+2 … dxx2

: : … :

… dk-2 dk-1 dk

Page 77: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

70

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( N pL pH fn [parameter]

[Function] Select character effects.[Format] ASCII GS(NpL pH fn

Hexadecimal 1D284EpL pH fn

Decimal 294078pL pH fn

[Range] ƒn=48[Description] Selectscharactereffects,accordingtofnvalue,asdescribedinthetablebelow.

ƒn Function

48 Select character color.

•pL, pH specifies (pL+pH×256)asthenumberofbytesafterpH (ƒn and [parameter]).[Notes] •Settingofthiscommandaffectprintingofalphanumeric,multilingual,user-definedcharacters

and user defined ideograms.•SettingofthiscommandiseffectiveuntilESC@isexecuted,theprinterisresetofthepoweris turned off.•Settingofthiscommanddoesnotaffectprintingofgraphics,bitimage,barcode(includingHRI characters) and two dimension code.•ThecolorofthegraphicscanbespecifiedbyGS(L.•Dualcolorprintingdependsondualcolorthermalpaperusage.Color#1isblackanduseshigh energy in the print head. Color #2 is red and uses low energy in the print head.•Thiscommandiseffectiveonlyinmodelswithdualcolorfeatureenabled.

GS ( N pL pH fn m <fn = 48>

[Function] Select character color.[Format] ASCII GS(NpL pH fn m Hexadecimal 1D284EpL pH fn m Decimal 294078pL pH fn m[Range] (pL+pH×256)=2(pL=2;pH=0)

ƒn=48m=48,49,50

[Default] m=49[Description] Selectscharactercolorspecifiedbymasfollows.

m Character color

48 Not (do not print).

49 Color #1 (Black)

50 Color #2 (Red)

[Notes] •Whenunderlineisturnedon,theunderlinewillbeprintedinthecolorspecifiedbythisfunction.

•Inwhite/blackreverseprintmode,theprintertreatsthecharacterasnon-printingdotsandprints the background in the color specified by this function.•Thiscommandiseffectiveonlyinmodelswithdualcolorfeatureenabled.

GS ( k pL pH cn fn [parameters]

[Function] Specify and print symbol.[Format] ASCII GS(kpL pH cn fn [parameters] Hexadecimal 1D286BpL pH cn fn [parameters] Decimal 2940107pLpH cn fn [parameters]

Page 78: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

71

MP-4200 TH Programmer’s Manual - Revision 1.0

[Range] cn=48(PDF417code).ƒn=65,66,67,68,69,70,80,81,82.

[Description] Processdatafortwo-dimensionalcodes.•Symboltypeisspecifiedbycn.•Functioncodeƒn specifies the function.

cn ƒn Function

48 65 PDF417:Setnumberofcolumnsinthedataregion.

66 PDF417:Setnumberofrows.

67 PDF417:Setthewidthofthemodule.

68 PDF417:Settherowheight.

69 PDF417:Settheerrorcorrectionlevel.

70 PDF417:Selectoptions.

80 PDF417:Storedatainthesymbolstoragearea.

81 PDF417:Printsymboldatainthesymbolstoragearea.

82 PDF417:Transmitthesizeinformationofthesymboldatainthesymbol storage area

•pL, pH specifies (pL+pH×256)asthenumberofbytesafterpH(cnandfnand[parameters].•[parameters]aredescribedineachfunction.

[Notes] •Thesymboldataspecifiedbyfunction80d1...dk is stored in memory and it can be printed using function 81. The symbol data in the symbol storage area is reserved until the following processing is performed:

o Function 80 is [email protected] The printer is reset or the power is turned off.

•Whenprocessingfunction81or82,thesettingvaluesoffunctions65to70areused.Iftheprintable area is not large enough, the symbol may not be printed.•Executingfunction81afterexecutingfunction80repeatedlyprintsthesamesymboldata.•Byusingfunctions65to70combinedwithfunction81,thesamesymboldatad1...dk is printed differently.•Byusingfunction82,thesymbolsizeprintedbyfunction81isavailable.

GS ( k pL pH cn fn n <fn = 65>

[Function] PDF417:Setnumberofcolumnsinthedataregion.[Format] ASCII GS(kpL pH cn fn n Hexadecimal 1D286BpL pH cn fn n Decimal 2940107pL pH cn fn n[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=650≤n≤30

[Default] n=0[Description] SetsthenumberofcolumnsinthedataregionforPDF417.

•Whenn=0,automaticprocessingisselected.•Whenn≠0,thenumberofcolumnsinthedataregionissettoncodeword.

[Notes] •Settingofthisfunctionaffecttheprocessingoffunctions81and82.•Whenautoprocessing(n=0)isselected,themaximumnumberofcolumnsinthedataareais30columns.

Page 79: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

72

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thefollowingdataisnotincludedinthenumberofcolumns:o Start pattern and stop pattern.o Indicator codeword of left and right.

•Whenautomaticprocessing(n=0)isselected,thenumberofcolumnsiscalculatedbytheprintareawhenprocessing functions81,82,modulewidth (function67),andoptionsetting(function70).•SettingsofthisfunctionareeffectiveuntilESC@isexecuted,theprinterisreset,orthepower is turned off.

GS ( k pL pH cn fn n <fn = 66>

[Function] PDF417:Setnumberofrows.[Format] ASCII GS(kpL pH cn fn n Hexadecimal 1D286BpL pH cn fn n Decimal 2940107pL pH cn fn n[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=66n=0(automaticprocessing)

[Description] SetnumberofrowsforPDF417.Onlyautomaticprocessing(n=0)isavailable.

GS ( k pL pH cn fn n <fn = 67>

[Function] PDF417:Setthewidthofthemodule.[Format] ASCII GS(kpL pH cn fn n Hexadecimal 1D286BpL pH cn fn n Decimal 2940107pL pH cn fn n[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=672≤n≤8

[Default] n=3[Description] SettondotsthewidthofthemoduleforPDF417.[Notes] •Settingsofthisfunctionaffecttheprocessingoffunctions81and82.

•SettingsofthisfunctionareeffectiveuntilESC@isexecuted,theprinterisreset,orthepower is turned off.

GS ( k pL pH cn fn n <fn = 68>

[Function] PDF417:Settherowheight.[Format] ASCII GS(kpL pH cn fn n Hexadecimal 1D286BpL pH cn fn n Decimal 2940107pL pH cn fn n[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=682≤n≤8

[Default] n=3[Description] Setrowheightto[n×(modulewidth)]forPDF417.[Notes] •Settingsofthisfunctionaffecttheprocessingoffunctions81and82. • Settings of this function are effective until ESC@ is executed, the printer is reset, or the power is turned off.

Page 80: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

73

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( k pL pH cn fn m n <fn = 69>

[Function] PDF417:Settheerrorcorrectionlevel.[Format] ASCII GS(kpL pH cn fn m n

Hexadecimal 1D286BpL pH cn fn m n Decimal 2940107pL pH cn fn m n[Range] (pL+pH×256)=4(pL=4;pH=0)

cn=48(PDF417code)ƒn=69m=48,4948≤n≤56[m=48]1≤n≤40[m=49]

[Default] m=49,n=1[Description] SeterrorcorrectionlevelforPDF417.

m Function

48 Theerrorcorrectionlevelissetby“level”.

49 Theerrorcorrectionlevelissetby“ratio”.Theratiois[nx10%]

[Notes] •Settingsofthisfunctionaffecttheprocessingoffunctions81and82.•Errorcorrectionlevelisspecifiedbyeither“level”or“ratio.”•Errorcorrectionlevelspecifiedby“level”(m=48)isasfollows.Thenumberoftheerrorcorrection codeword is fixed regardless of the number of codeword in the data area.

n Function Number of error correction codeword

48 Errorcorrectionlevel0 2

49 Errorcorrectionlevel1 4

50 Errorcorrectionlevel2 8

51 Errorcorrectionlevel3 16

52 Errorcorrectionlevel4 32

53 Errorcorrectionlevel5 64

54 Errorcorrectionlevel6 128

55 Errorcorrectionlevel7 256

56 Errorcorrectionlevel8 512

•Errorcorrectionlevelspecifiedby“ratio”(m=49)isasfollows.Theerrorcorrectionlevelisdefinedby[numberofdatacodeword×n×0.1=(A)].Thenumberoftheerrorcorrectioncodeword changes depending on the number of codeword in the data area.

(A) Function Number of error correction codeword

0–3 Errorcorrectionlevel1 4

4–10 Errorcorrectionlevel2 8

11–20 Errorcorrectionlevel3 16

21–45 Errorcorrectionlevel4 32

46–100 Errorcorrectionlevel5 64

101–200 Errorcorrectionlevel6 128

201–400 Errorcorrectionlevel7 256

401 or more Errorcorrectionlevel8 512

•Theerrorcorrectioncodewordcalculatedbymodulus929.•SettingsofthisfunctionareeffectiveuntilESC@isexecuted,theprinterisreset,orthepower is turned off.

Page 81: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

74

MP-4200 TH Programmer’s Manual - Revision 1.0

GS ( k pL pH cn fn n <fn = 70>

[Function] PDF417:Selectoption.[Format] ASCII GS(kpL pH cn fn n Hexadecimal 1D286BpLpH cn fn n Decimal 2940107pL pH cn fn n[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=70n=0(standardPDF417)

[Description] SelectoptionforPDF417.OnlystandardPDF417issupported.

GS ( k pL pH cn fn m d1 ... dk <fn = 80>

[Function] PDF417:Storedatainthesymbolstoragearea.[Format] ASCII GS(kpL pH cn fn m d1 ... dk

Hexadecimal 1D286BpL pH cn fn m d1 ... dk

Decimal 2940107pL pH cn fn m d1 ... dk

[Range] 4≤(pL+pH×256)≤65,535(pL≤255;pH≤255)cn=48(PDF417code)ƒn=80m=480≤d≤255k=(pL+pH×256)–3

[Description] StorePDF417symboldata(d1 ... dk) in the symbol storage area.[Notes] •Datastoredinthesymbolstorageareaisprocessedbyfunctions81and82.Thisdataisnot

destroyed after execution of function 81 or 82.•kbytesofd1...dk are processed as symbol data.•Specifyonlythedatacodewordofthesymbolwiththisfunction.Theinformationlistedbelowis added automatically by the printer:

o Start pattern and stop pattern.o Indicator codeword of left and right.o The descriptor of symbol length (the first codeword in the data area).oTheerrorcorrectioncodewordcalculatedbymodulus929.

•Settingsofthisfunctionareeffectiveuntilthefollowingprocessingisperformed:o Function 80 is [email protected] The printer is reset or the power is turned off.

GS ( k pL pH cn fn m <fn = 81>

[Function] PDF417:Printsymboldatainthesymbolstoragearea.[Format] ASCII GS(kpL pH cn fn m Hexadecimal 1D286BpLpHcnfnm Decimal 2940107pLpHcnfnm[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=81m=48

[Description] EncodesandprintsthePDF417symboldatastoredinthesymbolstorageareabyfunction80.[Notes] •Asymbolthatsizeexceedstheprintareacannotbeprinted.

•Ifthereisanyaninconsistenceinthedataofsymbolstoragearea,itcannotbeprinted. o There is no data (function 80 was not executed).

o If [(number of columns × number of rows) < number of codeword] when auto processing is specified for number of columns and number of rows.

oNumberofcodewordexceeds928inthedataarea.

Page 82: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

75

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thefollowingdataareaddedautomaticallybytheencodeprocess: o Start pattern and stop pattern. o Indicator codeword of left and right. o The descriptor of symbol length (the first codeword in the data area). oTheerrorcorrectioncodewordcalculatedbymodulus929. o Pad codeword.•Whenautoprocessing(function65)isspecified,thenumberofcolumnsiscalculatedbythecurrentprintarea,modulewidth(function67),optionsetting(function70),andthecodewordinthedataarea.Maximumnumberofcolumnsis30.•Printingofsymbolisnotaffectedbyprintmode(emphasized,double-strike,underline,white/black reverseprinting,or90°clockwise-rotated), except forcharacter sizeandupside-downprint mode.• This command executes paper feeding for the amount needed for printing the symbolregardless of the paper feed amount set by the paper feed setting command. The print position returns to the left side of the printable area after printing the symbol.•Thequietzoneisnotincludedintheprintingdata.Besuretoincludethequietzonewhenusing this function.

GS ( k pL pH cn fn m <fn = 82>

[Function] PDF417:Transmitthesizeinformationofthesymboldatainthesymbolstoragearea.[Format] ASCII GS(kpL pH cn fn m Hexadecimal 1D286BpL pH cn fn m Decimal 2940107pL pH cn fn m[Range] (pL+pH×256)=3(pL=3;pH=0)

cn=48(PDF417code)ƒn=82m=48

[Description] Transmitthesize informationfortheencodedPDF417symboldatastoredinsymbolstorage area by function 80.[Notes] •Thesizeinformationforeachdataisasfollows:

Transmit data Hex Dec Data bytes

Header 37 55 1

Identifier 2F 47 1

Horizontalsize(*1) 30–39 48–57 1–5

Separator 1F 31 1

Verticalsize(*1) 30–39 48–57 1–5

Separator 1F 31 1

Fixed value 31 49 1

Separator 1F 31 1

Otherinformation(*2) 30or31 48to49 1

NUL 00 0 1

(*1)“Horizontalsize”and“verticalsize”indicatethenumberofdotsofthesymbol.(*2)“Otherinformation”indicateswhetherprintingofthedatainthesymbolstorageareaispossibleorimpossible.The“otherinformation”isthefollowing.

Hex Dec Condition

30 48 Printing is possible.

31 49 Printing is impossible.

Page 83: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

76

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thedecimalvalueoftheverticalsizeandhorizontalsizeisconvertedtotextdataandsentstarting from the high order end.•Sizeinformationindicatesthesizeofsymbolprintedbyfunction81.•Thequietzoneisnotincludedinthesizeinformation.

GS :

[Function] Start/end macro definition.[Format] ASCII GS: Hexadecimal 1D3A Decimal 2958[Description] Start/endmacrodefinition.[Details] • Macro definition starts when this command is received during normal operation.Macro definition ends when this command is received during macro definition.

•WhenGS^isreceivedduringmacrodefinition,theprinterendsmacrodefinitionandclearsthe definition.•[email protected],ESC@canbeincludedinthecontentsof a macro.•Macrocontentsmayhaveupto2048bytes.Ifamacroisdefinedwithmorethan2048bytes,excess data is not stored.

[Reference] GS^

GS B n

[Function] Turn white/black reverse printing mode on/off.[Format] ASCII GSBn Hexadecimal 1D42n Decimal 2966n[Range] 0≤n≤255[Default] n=0[Description] Turnon/offwhite/blackreverseprintingmode.

•WhentheLSBofnis0,white/blackreversemodeisturnedoff.•WhentheLSBofnis1,white/blackreversemodeisturnedon.

[Details] •Onlytheleastsignificantbitofnisvalid.•Thiscommandisvalidforbuilt-incharactersanduser-definedcharacters.• Whenwhite/blackreverseprintingmode ison, italsoapplies tocharacter spacingsetbyESCSP.•Thiscommanddoesnotaffectbitimage,user-definedbitimage,barcode,HRIcharactersandspacingskippedbyHT,ESC$,andESC\.•Thiscommanddoesnotaffectthespacesbetweenlines.•White/blackreversemodehasahigherprioritythanunderlinemode.Evenifunderlinemodeis on, it is disabled (but not canceled) when white/black reverse mode is selected.

Page 84: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

77

MP-4200 TH Programmer’s Manual - Revision 1.0

GS H n

[Function] Select print position for HRI characters.[Format] ASCII GSHn Hexadecimal 1D48n Decimal 2972n[Range] 0≤n≤3,48≤n≤51[Default] n=0[Description] SelectprintpositionforHRIinbarcodes.nselectstheprintpositionasfollows:

n Print position

0, 48 Not printed.

1,49 Above barcode.

2, 50 Below barcode.

3,51 Both above and below barcode.

[Details] •HRIstandsforHumanReadableInterpretation. •HRIcharactersareprintedusingthefontspecifiedbyGSf.[References] GSf,GSk

GS I n

[Function] TransmitprinterID.[Format] ASCII GSIn Hexadecimal 1D49n Decimal 2973n[Range] 1≤n≤3,49≤n≤51,65≤n≤69[Description] TransmitstheprinterIDspecifiedbynasfollows:

n Printer ID Specification ID (Hex)

1,49 PrinterIDModel MP-4200 TH 55

2, 50 TypeID See table below.

3,51 ROMversionID DependsonROMversion.

65 Firmware version Dependsonfirmwareversion.

66 Manufacturer Bematech

67 Printer name MP-4200 TH

68 Serial number Dependsonserialnumber.

69 Type of model Japanesemodel:KANJIJAPANESESimplifiedChinese:CHINAEUC-CNTraditionalChinese:TAIWANBIG-5E

n=2:TypeID

Page 85: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

78

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit Off/On Hex Decimal Function

0 Off 00 0 Two-byte character code not supported.

On 01 1 Two-byte character code supported.

1 On 02 2 Auto-cutter equipped.

2 Off 00 0 Not used. Fixed to off.

3 Off 00 0 Not used. Fixed to off.

4 Off 00 0 Not used. Fixed to off.

5 - - - Undefined.

6 - - - Undefined.

7 Off 00 0 Not used. Fixed to off.

[Details] •WhenDTR/DSRcontrolisselectedintheserialinterfacemodel,theprintertransmitsprinter IDafterconfirmingthatthehostisreadytoreceivedata.

•WhenXON/XOFFcontrolisselectedintheserialinterfacemodel,theprintertransmitstheprinterIDwithoutconfirmingtheconditionoftheDSRsignal.• The printer ID is transmitted when command bytes are processed in the receive buffer.Therefore, there may be a time gap between receiving this command and transmitting the status, depending on the receive buffer status.•WhenprinterIDtransmissionisspecifiedwith(1≤n≤3)or(49≤n≤51),onebytecodeis transmitted.•WhenAutoStatusBack(ASB)isenabledusingGSa,theprinterIDtransmittedbyGSIandthe ASB status must be differentiated.•WhenprinterIDisspecifiedwith(65≤n≤69),the[Header+Data+NUL]contentsistransmitted, where:

oHeader:Hexadecimal=5Fh/Decimal=95(1byte)oData:PrinterinformationoNUL:Hexadecimal=00h/Decimal=0(1byte)

GS L nL nH

[Function] Set left margin.[Format] ASCII GSLnL nH

Hexadecimal 1D4CnL nH

Decimal 2979nL nH

[Range] 0≤nL≤255 0≤nH≤255[Default] nL=0,nH=0[Description] SetleftmarginusingnL and nH. •Theleftmarginissetto[(nL+nH×256)×horizontalmotionunit)]inches.

[Details] •Thiscommandiseffectiveonlywhenprocessedatthebeginningofaline.•Ifsettingsexceedprintablearea,themaximumvalueoftheprintableareaisused.•ThehorizontalandverticalmotionunitsarespecifiedbyGSP.Changingthehorizontalandvertical motion unit does not affect the current left margin.

Page 86: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

79

MP-4200 TH Programmer’s Manual - Revision 1.0

•Thehorizontalmotionunit(x) isusedforcalculatingleftmargin.Thecalculatedresult istruncated to the minimum value of the mechanical pitch.

[References] GSP,GSW

GS P x y

[Function] Set horizontal and vertical motion units.[Format] ASCII GSPxy Hexadecimal 1D50xy Decimal 2980xy[Range] 0≤x≤255 0≤y≤255[Description] Sets the horizontal and verticalmotionunits to approximately25.4/xmm{1/x inches}and approximately25.4/ymm{1/yinches},respectively.[Details] •Thehorizontaldirectionisperpendiculartothepaperfeeddirectionandtheverticaldirection is the paper feed direction.

•Thefollowingcommandsusexory,regardlessofcharacterrotation(upside-downor90°clockwise rotation):

oCommandsusingx:ESCSP,ESC$,ESC\,FSS,GSL,GSWoCommandsusingy:ESC3,ESCJ,GSV

•Thecommanddoesnotaffectpreviouslyspecifiedvalues.•Thecalculatedresultfromcombiningthiscommandwithothersistruncatedtotheminimumvalue of the mechanical pitch.

[References] ESCSP,ESC$,ESC3,ESCJ,ESC\,GSL,GSV,GSW

GS V m

[Function] Select paper cut mode.[Format] ASCII GSVm Hexadecimal 1D56m Decimal 2986m[Range] m=0,1,48,49[Description] Ifm=0orm=48performafullpapercut. Ifm=1orm=49performapartialpapercut.[Details] •Thiscommandiseffectiveonlyifprocessedatthebeginningofaline.

GS V m n

[Function] Feed and cut paper.[Format] ASCII GSVmn Hexadecimal 1D56mn Decimal 2986mn[Range] m=66 0≤n≤255[Description] Feedandcutpaper.Forthiscommand,mshouldbe66andnistheamountofpapertofeed.First of all, paper is advanced and then cut.[Details] •Thiscommandiseffectiveonlyifprocessedatthebeginningofaline.

•Whenn=0,theprinterfeedsthepapertothecuttingpositionandcutsit.•Whenn≠0,theprinterfeedsthepaperto(cuttingposition+[n×verticalmotionunit])and cuts it.•ThehorizontalandverticalmotionunitsarespecifiedbyGSP.•Thepaperfeedamountiscalculatedusingtheverticalmotionunit(y).However,thevaluecannot be less than the minimum vertical movement amount, and it must be in even units of the minimum vertical movement amount.

GS W nL nH

Page 87: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

80

MP-4200 TH Programmer’s Manual - Revision 1.0

[Function] Set printing area width.[Format] ASCII GSWnL nH

Hexadecimal 1D57nL nH

Decimal 2987nL nH

[Range] 0≤nL≤255 0≤nH≤255[Default] nL=0;nH=2[Description] Setprintingareawidthto[(nL+nH×256)×horizontalmotionunit].

[Details] •Thiscommandiseffectiveonlywhenprocessedatthebeginningofaline.

•Ifsettingsexceedprintablearea,themaximumvalueoftheprintableareaisused.•ThehorizontalandverticalmotionunitsarespecifiedbyGSP.Changingthehorizontalandvertical motion unit does not affect the current left margin.•Thehorizontalmotionunit(x) isusedforcalculatingleftmargin.Thecalculatedresult istruncated to the minimum value of the mechanical pitch.•Ifrequestedprintingareawidthlessthanonecharacterthefollowingprocessingisperformed:1. The printing area width is extended to the right to accommodate one character.

2. If printing area width cannot be extended, the left margin is reduced to accommodate one character.

3.Ifprintingareawidthcannotbeextended,therightmarginisreducedtoaccommodateonecharacter.•Ifthewidthsetfortheprintingareaislessthanoneverticalline,thefollowingprocessingisperformedonlyonthe line in question when data other than character data (e.g., bit image, user-defined bit image) is being processed:1. The printing area width is extended to the right to accommodate one line in vertical for the bit image within the printable area.2. If the printing area width cannot be extended sufficiently, the left margin is reduced to accommodate one line in vertical.• Thecommandswhich set theprintingareawidth forbit imageprintingand itsminimumwidths are as follows:•Bitimage(ESC*):Singledensitymode=2dotsDoubledensitymode=1dot•Downloadedbitimage(GS/):DoublewidthmodeorQuadruplemode=2dotsNormalmodeorDouble-heightmode=1dot

Page 88: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

81

MP-4200 TH Programmer’s Manual - Revision 1.0

•NVbitimage(FSp):DoublewidthmodeorQuadruplemode=2dotsNormalmodeorDouble-heightmode=1dot•Rasterbitimage(GSv0):DoublewidthmodeorQuadruplemode=2dotsNormalmodeorDouble-heightmode=1dot

[References] GSL,GSP

GS ^ r t m

[Function] Executemacro.[Format] ASCII GS^rtm Hexadecimal 1D5Ertm Decimal 2994rtm[Range] 0≤r≤255 0≤t≤255 m=0,1[Description] Executeamacro.

•rspecifiesthenumberofmacroexecutions.•tspecifiesthewaitingtimebetweenconsecutivemacroexecutions.•mspecifiesmacroexecutingmode. oWhentheLSBofm=0,themacroexecutesrtimescontinuouslyattheinterval specified by t. oWhentheLSBofm=1,afterwaitingfortheperiodspecifiedbyt,theINFOled blinksand theprinterwaits for theFEEDbutton tobepressed.After thebutton is pressed, the printer executes the macro once again. The printer repeats this operation r times.

[Details] •Thewaitingtimeist×100msforeverymacroexecution.•Ifthiscommandisreceivedwhileamacroisbeingdefined,themacrodefinitionisabortedand the definition is cleared.•Ifthemacroisnotdefinedorifris0,nothingisexecuted.•Whenamacroisexecuted(m=1),papercannotbefedusingtheFEEDbutton.

[Reference] GS:

GS a n

[Function] Enable/disableAutomaticStatusBack(ASB).[Format] ASCII GSan Hexadecimal 1D61n Decimal 2997n[Range] 0≤n≤255[Description] EnableordisableASBandspecifywhichstatusitemsshouldbeincludedaccordington,asfollows:

Bit Off/On Hex Decimal Function

0 Off 00 0 Drawerkick-outconnectorpin3statusdisabled.

On 01 1 Drawerkick-outconnectorpin3statusenabled.

1 Off 00 0 Online/offline status disabled.

On 02 2 Online/offline status enabled.

2 Off 00 0 Errorstatusdisabled.

On 04 4 Errorstatusenabled.

3 Off 00 0 Paper roll sensor status disabled.

On 08 8 Paper roll sensor status enabled.

4-7 - - - Undefined.

Page 89: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

82

MP-4200 TH Programmer’s Manual - Revision 1.0

[Details] •Ifanystatusitemisenabled,theprintertransmitsthestatuswhenthiscommandisexecuted. The printer automatically transmits the status whenever an enabled status item changes.

•Ifallstatusitemsaredisabled,theASBfunctionisalsodisabled.•IfASBisenabledbydefault,assoonasprinteristurnedonandisabletotransmitandreceivedata transmits, the status is send.•Thefourstatusbytesaretransmittedwithoutconfirmingwhetherthehostisreadytoreceivedataornot.Thefourstatusbytesmustbeconsecutive,exceptfortheXOFFcode.•Sincethiscommandisexecutedafterdataisprocessedinthereceivebuffer,theremaybeatime gap between command reception and status transmission.• When printer is disabled byESC= (Select peripheral device), the four status bytes aretransmitted whenever the status changes.•Thestatustobetransmittedareasfollows:

Firs byte (Printer information)

Bit On/Off Hex Dec Function

0 Off 00 0 Not used. Fixed to off.

1 Off 00 0 Not used. Fixed to off.

2 Off 00 0 Drawerkick-outconnectorpinisLOW.

On 04 4 Drawerkick-outconnectorpinisHIGH.

3 Off 00 0 Printer online.

On 08 8 Printer offline.

4 On 10 16 Not used. Fixed to on.

5 On 00 0 Cover is closed.

Off 20 32 Cover is opened.

6 On 00 0 PaperisnotbeingfedbyFEEDbutton.

Off 40 64 PaperisbeingfedbyFEEDbutton.

7 Off 00 0 Not used. Fixed to off.

o Second byte (Printer information)

Bit Off/On Hex Dec Function

0 - - - Undefined.

1 - - - Undefined.

2 - - - Undefined.

3 Off 00 0 No auto-cutter error.

On 08 8 An auto-cutter error has occurred.

4 Off 00 0 Not used. Fixed to Off.

5 Off 00 0 No unrecoverable error.

On 20 32 An unrecoverable error has occurred.

6 Off 00 0 No automatically recoverable error.

On 40 64 An automatically recoverable error has occurred.

7 Off 00 0 Not used. Fixed to Off.

•Bit3:Iftheseerrorsoccurduetopaperjam,itispossibletorecoverbycorrectingthecauseoftheerrorandexecutingDLEENQn(1≤n≤2).Ifanerrorduetoacircuitfailure(e.g.wirebreak) occurs, it is impossible to recover.• Bit 6:Whenprinting is stopped due to high print head temperature, the printer remainsstopped until the print head temperature drops sufficiently. This error can also occur when paper roll cover is opened.

Page 90: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

83

MP-4200 TH Programmer’s Manual - Revision 1.0

o Third byte (Paper sensor information)

Bit Off/On Hex Dec Function

0, 1 Off 00 0 Paper roll near-end sensor: paper OK.

On 03 3 Paper roll near-end sensor: paper near end.

2, 3 Off 00 0 Paper roll end sensor: paper present.

On 0C 12 Paper roll end sensor: paper not present.

4 Off 10 16 Not used. Fixed to Off.

5, 6 - - - Undefined.

7 Off 00 0 Not used. Fixed to Off.

o Fourth byte (Paper sensor information)

Bit Off/On Hex Dec Function

0,3 - - - Undefined.

4 Off 00 0 Not used. Fixed to off.

5,6 - - - Undefined.

7 Off 00 0 Not used. Fixed to off.

[References] DLEEOT,GSr

GS f n

[Function] Select font for Human Readable Interpretation (HRI) characters.[Format] ASCII GSfn Hexadecimal 1D66n Decimal 29102n[Range] n=0,1,48,49[Default] n=0[Description] SelectafontfortheHRIcharactersusedduringabarcodeprinting.nselectsafontfromthe following table:

n Print position

0, 48 Font C (14 x 24).

1,49 FontD(10.5x24).

[Details] •HRIstandsforHumanReadableInterpretation. •HRIcharactersareprintedatthepositionspecifiedbyGSH.[References] GSH,GSk

GS h n

[Function] Select barcode height.[Format] ASCII GShn Hexadecimal 1D68n Decimal 29104n[Range] 1≤n≤255[Default] n=192[Description] Selectbarcodeheight.nspecifiesthenumberofdotsintheverticaldirection.[Reference] GSk

Page 91: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

84

MP-4200 TH Programmer’s Manual - Revision 1.0

(1) GS k m d1 ... dk NUL (2) GS k m n d1 ... dn

[Function] Print barcode.[Format] ASCII (1)GSkmd1 ... dkNUL (2)GSkmnd1 ... dn

Hexadecimal (1)1D6Bmd1 ... dk 00 (2)1D6Bmnd1 ... dn

Decimal (1)29107md1 ... dk 0 (2)29107mnd1 ... dn

[Range] (1)0≤m≤6(kandddependsonthebarcodesystemused) (2)65≤m≤73(nandddependsonthebarcodesystemused)[Description] Selectsabarcodesystemandprintsthebarcode.

m Barcode System Number of Characters Remarks

(1) 0 UPC-A 11≤k≤12 48≤d≤57

1 UPC-E 11≤k≤12 48≤d≤57

2 EAN13 12≤k≤13 48≤d≤57

3 EAN8 7≤k≤8 48≤d≤57

4 CODE39 1≤k 48≤d≤57,65≤d≤90,32,36,37,43,45,46,47

5 ITF 1≤k(evennumber) 48≤d≤57

6 CODABAR 1≤k 48≤d≤57,65≤d≤68,36,43,45,46,47,58

(2) 65 UPC-A 11≤n≤12 48≤d≤57

66 UPC-E 11≤n≤12 48≤d≤57

67 EAN13 12≤n≤13 48≤d≤57

68 EAN8 7≤n≤8 48≤d≤57

69 CODE39 1≤n≤255 48≤d≤57,65≤d≤90,32,36,37,43,45,46,47

70 ITF 1≤n≤255(evennumber) 48≤d≤57

71 CODABAR 1≤n≤255 48≤d≤57,65≤d≤68,36,43,45,46,47,58

72 CODE93 1≤n≤255 0≤d≤127

73 CODE128 2≤n≤255 0≤d≤127

[Detailsfor(1)] •ThiscommandendswithaNULcode.•WhenthebarcodesystemusedisUPC-AorUPC-E,theprinterprintsbarcodedataafterreceiving the 12 bytes.• When the barcode system used is EAN13, the printer prints barcode after receiving 13bytes.•WhenthebarcodesystemusedisEAN8,theprinterprintsbarcodeafterreceiving8bytes.•TheamountofdataforITFbarcodemustbeeven.Whenanoddnumberofbytesareinput,the printer ignores the last byte.

[Detailsfor(2)] • n indicates thenumberofbarcodebytes,andtheprinterprocessesnbytes fromthenext character data as barcode data.

• If n is outside of the specified range, the printer stops command processing and startsprocessing incoming data as normal data.

Page 92: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

85

MP-4200 TH Programmer’s Manual - Revision 1.0

[Details] • If d is outsideof the range, theprinteronly feedspaperandprocesses incomingdataas normal data.

•Ifthehorizontalsizeexceedsprintingarea,theprinteronlyfeedsthepaper.•Thiscommandfeedsasmuchpaperasisrequiredtoprintthebarcode,regardlessofthelinespacingspecifiedbyESC2orESC3.•Thiscommandisenabledonlywhennodataexistsintheprintbuffer.Whendataexistsintheprint buffer, the printer processes the data following m as normal data.•Afterprintingbarcode,thiscommandsetstheprintpositiontothebeginningoftheline.•Thiscommandisnotaffectedbyprintmodes(emphasized,double-strike,underline,charactersize, white/black reverse printing, or 90° rotated character, etc.), except for upside-downprinting mode.

[References] GSH,GSf,GSh,GSw

GS r n

[Function] Transmit status.[Format] ASCII GSrn Hexadecimal 1D72n Decimal 29114n[Range] n=1,2,49,50[Description] Transmitsthestatusspecifiedbynasfollows:

n Function

1,49 Transmit paper sensor status.

2, 50 Transmit drawer kick-out connector status.

[Details] •WhenserialinterfacewithDTR/DSRcontrolisbeingusedtheprintertransmitsonly1byte after confirming the host is ready to receive data. If the host computer is not ready to receive data,theprinterwaitsuntilthehostisready.WhenserialinterfacewithXON/XOFFcontrolisbeingusedtheprintertransmitsonly1bytewithoutconfirmingtheconditionoftheDSRsignal.• This command is executed when commands bytes are processed in the receive buffer.Therefore, there may be a time gap between receiving this command and transmitting the status, depending on the receive buffer status.•WhenAutoStatusBack(ASB)isenabledusingGSa,itispossibletodifferentiatestatustransmittedbyGSrandbyASB.•Thestatustypestobetransmittedareshownbelow:oPapersensorstatus(n=1,49)

Bit On/Off Hex Dec Function

0, 1 Off 00 0 Paperrollnear-endsensorstatus:OK.

On 03 3 Paper roll near-end sensor status: low paper.

2,3 Off 00 0 Paperrollendsensorstatus:OK.

On 0C 12 Paper roll end sensor status: low paper.

4 Off 00 0 Not used. Fixed to off.

5,6 - - - Undefined

7 Off 00 0 Not used. Fixed to off.

Bits2and3:Whenpaperendsensordetectsapaperend,theprintergoesofflineanddoesnotexecutethiscommand.Therefore,bits2and3donottransmitthestatusofpaperend.oDrawerkick-outconnectorstatus(n=2,50)

Page 93: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

86

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit On/Off Hex Dec Function

0 Off 00 0 Drawerkick-outconnectorpin3isLOW.

On 01 1 Drawerkick-outconnectorpin3isHIGH.

1-3 - - - Undefined.

4 Off 00 0 Not used. Fixed to off.

5,6 - - - Undefined

7 Off 00 0 Not used. Fixed to off.

[References] DLEEOT,GSa

GS v 0 m xL xH yL yH d1 ... dk

[Function] Print raster bit image.[Format] ASCII GSv0mxL xH yL yH d1 ... dk

Hexadecimal 1D7630mxL xH yL yH d1 ... dk

Decimal 2911848mxL xH yL yH d1 ... dk

[Range] 0≤m≤3,48≤m≤510≤xL≤255;0≤xH≤2550≤yL≤255;0≤yH≤80≤d≤255k=[(xL+xH×256)×(yL+yH×256)](k≠0)

[Description] Selectrasterbit-imagemode(m),asfollows:

m Mode Vertical Dot Density Horizontal Dot Density

0, 48 Normal 203dpi 203dpi

1,49 Double-width 203dpi 101 dpi

2, 50 Double-height 101 dpi 203dpi

3,51 Quadruple 101 dpi 101 dpi

•xL, xH, select the number of data bytes (xL+xH×256)inthehorizontaldirectionforthebitimage.•yL, yH, select the number of data bytes (yL+yH×256)intheverticaldirectionforthebitimage.

[Details] •Thiscommandiseffectiveonlywhenthereisnodataintheprintbuffer.•Thiscommandhasnoeffectinallprintmodes(charactersize,emphasized,double-strike,upside-down, underline, white/black reverse printing, etc.) for raster bit image.•IftheprintingareawidthsetbyGSLandGSWislessthantheminimumwidth,theprintingarea is extended to the minimum width only on the line in question. The minimum width means 1dotinnormal(m=0,48)anddouble-height(m=2,50)modes,2dotsindouble-width(m=1,49)andquadruple(m=3,51)modes.•Dataoutsideprintingareaisreadanddiscardedonadot-by-dotbasis.•ThepositionatwhichsubsequentcharactersaretobeprintedforrasterbitimageisspecifiedbyHT(HorizontalTab),ESC$(Setabsoluteprintposition),ESC\(Setrelativeprintposition),andGSL(Setleftmargin).Ifthepositionatwhichsubsequentcharactersaretobeprintedisnot a multiple of 8, print speed may decrease.•TheESCa(Selectjustification)settingisalsoeffectiveonrasterbitimages.•Whenthiscommandisreceivedduringmacrodefinition,theprinterendsmacrodefinition,and begins performing this command. The definition of this command should be cleared.•dindicatesbit-imagedata.Settingabitprintsadotandresettingabitdoesnotprintadot.

Page 94: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

87

MP-4200 TH Programmer’s Manual - Revision 1.0

GS w n

[Function] Set barcode width.[Format] ASCII GSwn Hexadecimal 1D77n Decimal 29119n[Range] 2≤n≤6[Default] n=3[Description] Setbarcodehorizontalsize.nspecifiesbarcodewidthasfollows:

n Module width (mm) for Multi-level Barcode

Binary-level Barcode

Thin element width (mm)

Thick element width (mm)

2 0.250 0.250 0.625

3 0.375 0.375 1.000

4 0.500 0.500 1.250

5 0.625 0.625 1.625

6 0.750 0.750 2.000

Multi-levelbarcodesareasfollows:UPC-A,UPC-E,EAN13,EAN8,CODE93,CODE128Binary-levelbarcodesareasfollows:CODE39,ITF,CODABAR

[Reference] GSk

GS F9h 5 n

[Function] Select printer operating mode.[Format] ASCII GSF9h5n Hexadecimal 1DF935n Decimal 2924953n[Range] n=0;n=1;n=48;n=49;[Default] n=0[Description] Ifnis0(00hor30h),ESC/Bemaisselected. Ifnis1(01hor31h),ESC/POSisselected.[Notes] This command modifies printer flags and save the new values to printer configuration memory.

GS F9h 7 n

[Function] SetandsaveprinterdefaultcodepageforESC/Bemacommandset.[Format] ASCII GSF9h7n Hexadecimal 1DF937n Decimal 2924955n[Range] 2≤n≤12;n=14;n=21[Default] n=2[Description] Thiscommandselectsthecodepagetobeused,accordingtothefollowingoptions.

Ifnis2(02hor32h),CODEPAGE850isselected.Ifnis3(03hor33h),CODEPAGE437isselected.Ifnis4(04hor34h),CODEPAGE860isselected.Ifnis5(05hor35h),CODEPAGE858isselected.Ifnis6(06hor36h),CODEPAGE866isselected.Ifnis7(07hor37h),CODEPAGE864isselected.

Page 95: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

88

MP-4200 TH Programmer’s Manual - Revision 1.0

Ifnis8(08hor38h),UTF8(Unicode)isselected.Ifnis9(09hor39h),Big-5Eisselected.Ifnis10(0Ahor3Ah),JISisselected.Ifnis11(0Bhor3Bh),SHIFTJISisselected.Ifnis12(0Chor3Ch),GB2312isselected.Ifnis14(0Ehor3Eh),EUC-CNisselected.Ifnis21(15hor45h),CODEPAGE862isselected.

GS F9h 8 n

[Function] SetandsaveESC/POSideogrammode.[Format] ASCII GSF9h8n Hexadecimal 1DF938n Decimal 2924956n[Visibility] Public[Range] 0≤n≤3[Default] n=0[Description] Ifnis0(00hor30h),UTF8(Unicode)ideogrammodeisselected. Ifnis1(01hor31h),ESC/POSJapaneseideogrammodeisselected. Ifnis2(02hor32h),ESC/POSSimplifiedChineseideogrammodeselected. Ifnis3(03hor33h),ESC/POSTraditionalChineseideogrammodeisselected.

GS F9h C 00h

[Function] Getprintercurrentcommandset.[Format] ASCII GSF9hC00h Hexadecimal 1DF94300 Decimal 29249670[Description] Returnonebytewithcurrentcommandset.Ifreturnedbyteis0(00h),printerisoperatingin ESC/Bemamode.Ifreturnedbyteis1(01h),printerisoperatinginESC/POSmode.

GS F9h SP n

[Function] Select printer operating mode of operation temporarily.[Format] ASCII GSF9hSPn Hexadecimal 1DF920n Decimal 2924932n[Range] n=0;n=1;n=48;n=49;[Description] Ifnis0(00hor30h),ESC/Bemaisselected. Ifnis1(01hor31h),ESC/POSisselected.[Notes] This command modifies printer flags but does not save the new values to the printer configuration memory. The new mode starts as the printer has been just initialized (ESC @ has beenexecuted).

GS F9h 1Fh 1

[Function] Return to previously set mode of operation.[Format] ASCII GSF9h1Fh1 Hexadecimal 1DF91F31 Decimal 292493149[Description] ConfigurationcommandusedtoputprintermodebacktothatusedbeforeissuingGSF9hSPn command.Thepreviousmodere-startsastheprinterhasbeenjustinitialized(ESC@hasbeen executed).

Page 96: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

89

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h - n

[Function] Set and save printer mode.[Format] ASCII GSF9h–n Hexadecimal 1DF92Dn Decimal 2924945n[Default] n=0[Description] Setprinterprioritytohighqualityofhighspeed.

n=0or30h–normal.n=1or31h–highquality.n=2or32h–highspeed.

GS F9h ! n

[Function] Set and save paper width.[Format] ASCII GSF9h!n Hexadecimal 1DF921n Decimal 2924933n[Description] Setpaperwidthasdescribedinthetablebelow:

n Paper width (mm) Printing width (mm)

00h 58 48

01h 76 72

02h 80 72

03h 80 76

04h 82.5 72

05h 82.5 76

06h 82.5 80

[Notes] ThiscommandhaseffectonlywhenprinterisinESC/Bemaoperatingmode.ForESC/POSmode paperwidthisalwayssetto80mm/73.5mm.

GS F9h , n

[Function] Enable/disablepapernear-endsensor.[Format] ASCII GSF9h,n Hexadecimal 1DF92Cn Decimal 2924944n[Default] n=1[Description] Enableordisablepapernear-endsensor(PNES).Thissettingissavedtoconfiguration(non- volatile) memory.

n=1or31h–enablePNES.n=0or30h–disablePNES.

GS F9h + n

[Function] Set and save printing intensity.[Format] ASCII GSF9h+n Hexadecimal 1DF92Bn Decimal 2924943n[Description] Obsolete.KeptheretomaintaincompatibilitywithearlierBematechproducts.

Page 97: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

90

MP-4200 TH Programmer’s Manual - Revision 1.0

GS FAh n

[Function] Set and save printer language.[Format] ASCII GSFAhn Hexadecimal 1DFAn Decimal 29250n[Description] Setprinterlanguage.

n=0or30h–Englishn=1or31h–Portuguesen=2or32h–Spanishn=3or33h–Germann=4or34h–Italiann=5or35h–Frenchn=6or36h–SimplifiedChinesen=7or37h–TraditionalChinesen=8or38h–Japanese

GS F9h ‘ n

[Function] Getprinterinformation.[Format] ASCII GSF9h‘n Hexadecimal 1DF927n Decimal 2924939n[Description] Retrieveprinterinformationaccordingtovaluesdescribedinthefollowingtable:

n Information Data type Return size

0,30h Productcode(“MP-4200TH”) ASCII string 10 bytes

1,31h Serial number ASCII string 20 bytes

2,32h Manufacturing date ASCII string 4 bytes

3,33h Firmware version ASCII string 3bytes

4,34h Reserved

5,35hManufacturing timestamp (“dd/mm/yyhh:mm:ss”format)

ASCII string 17bytes

6,36h Reserved

7,37h Reserved

8,38hInterfacetype(0=None;1=SerialDB-9;2=SerialDB-25;3=Ethernet,-1=Unknown)

Integer 1 byte

GS F9h ( 0

[Function] Loaddefaultuserconfiguration.[Format] ASCII GSF9h(0 Hexadecimal 1DF92830 Decimal 292494048[Description] Reloadallconfigurationsfromnon-volatilememoryanddipswitches.

GS F9h ) 0

[Function] Print user configuration.[Format] ASCII GSF9h)0 Hexadecimal 1DF92930 Decimal 292494148[Description] Printonpaperthecurrentuserconfiguration.

Page 98: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

91

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F8h 1

[Function] Printer extended status enquiry.[Format] ASCII GSF8h1 Hexadecimal 1DF831 Decimal 2924849[Description] Issuingthiscommandmakestheprintertoreturnfivestatusbytes.

The first byte is the printer status:

7 6–5 4 3 2 1 0

1 BufStat Wait Offline OVR 0 0

Bit2:OVR(OverrunError)0–Printerisreadytoreceivedata.1–Printerisinoverruncondition.Ifmoredatais received, it will be lost.

Bit3:Offline.0–Printerison-line.1–Printerisoff-line.

Bit 4: Wait.0–Printerisprinting(busycondition).1–Printerbufferisempty,waitingformoredata or commands.

Bit6&5:BufStat-Bufferstatus.00–Printerbufferempty.01–Printerbufferisunder1/3ofitscapacity.10–Printerbufferisabove1/3ofitscapacity.11–Printerbufferisbeyond¾ofitscapacity.

The second byte is the off-line status:

7 6 5 4 3 2 1 0

Cover Error NoPaper Drawer 0 PS PNES 1

Bit1:PNES–PaperNear-endSensor0–Paperisnotneartheendofroll.1–Paperisneartheendofroll.

Bit2:PS–Papersensor0–Printerhaspaper.1–Printerhasnopaperatall.

Bit4:Drawer0–Drawersensorisinlowlevel(logical0).1–Drawersensorisinhighlevel(logical1).

Bit 5: NoPaper0–Printerhaspaper.1–Printerhasnopaperatall.

Page 99: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

92

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit6:Error0–Noerrorconditionexistintheprinter.1–Atleastoneerrorconditionisbeingreportedby the printer.

Bit7:Cover0–Printercoverisopened.1–Printercoverisclosed.

The third byte is printer error status:

7 6 5 4 3 2 1 0

1 RE NRE 1 CE CA 0 0

Bit2:CA–CutterAbsence0–Cutterpresent.1–Cutterabsent.

Bit3:CE–CutterError0–Noerrorconditiondetectedinthecutter.1–Cuttererrorconditiondetected.

Bit5:NRE–Non-recoverableError0–NREconditionnotdetected.1–NREconditiondetected.

Bit6:RE–RecoverableError0–REconditionnotpresent.1–REconditionpresent.

The fourth byte is printer head and command set status:

7 6 5 4 3 2 1 0

1 CMD 0 1 0 HOH 0 1

Bit2:HOH–HeadOverheat0–Printheadhasnormaltemperature.1–Printheadisoverheated.

Bit6:CMD–Currentcommandset0–ESC/Bemacommandset1–ESC/POScommandset

The fifth byte is firmware version and revision:

7 6–4 3–0

0 Firmware version Firmware revision

[Notes] Valid only when ethernet or wi-fi interface is being used.

Page 100: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

93

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F8h F

[Function] Printer reset.[Format] ASCII GSF8hF Hexadecimal 1DF846 Decimal 2924870[Description] Forceahardwareresetontheprinter.

GS F9h D m n

[Function] Activate buzzer on cut.[Format] ASCII GSF9hDmn Hexadecimal 1DF944mn Decimal 2924968mn[Range] m=0,1,2 0≤n≤255[Default] m=0,n=2[Description] Setbuzzeractivationonpapercut.

Ifm=0nobuzzerisactivatedIfm=1theinternalbuzzerisactivatedIfm=2theexternalbuzzerisactivatedThe activation time is n x 100ms.

GS F9h E n

[Function] SetDHCPusage.[Format] ASCII GSF9hEn Hexadecimal 1DF945n Decimal 2924969n[Range] 0≤n≤255[Default] n=0[Description] IfLSBofnis1,theDHCPisenabled.

GS F7h BS NUL “ i1...i4 s1...s4

[Function] Set IP address and subnet mask.[Format] ASCII GSF7hBSNUL“i1...i4 s1...s4

Hexadecimal 1DF7080022i1...i4 s4...s4

Decimal 292478034i1...i4 s4...s4

[Description] ProgramafixedIPaddressandsubnetmasktotheprinter.[Example] TodefineanIPaddressof10.10.1.2andasubnetmaskof255.255.0.0,thefollowingcommand should be send: 1DF70800220A0A0102FFFF0000[Notes] ValidonlywhenEthernetinterfaceisbeingused.

FS ! n

[Function] Set print mode(s) for ideograms.[Format] ASCII FS!n Hexadecimal 1C 21 n Decimal 2833n[Range] 0≤n≤255[Default] n=0[Description] Setprintmodeforideograms,usingnasfollows:

Page 101: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

94

MP-4200 TH Programmer’s Manual - Revision 1.0

Bit On/Off Hex Dec Function

0, 1 - - - Undefined.

2Off 00 0 Double-widthmodeisOFF.

On 04 4 Double-widthmodeisON.

3Off 00 0 Double-heightmodeisOFF.

On 08 8 Double-heightmodeisON.

4–6 - - - Undefined.

7Off 00 0 Underline mode is OFF.

On 80 128 Underline mode is ON.

[Notes] • When both double-width and double-heightmodes are set (including right- and left-side character spacing), quadruple-size characters are printed.

•Theprintercanunderlineallcharacters(includingright-andleft-sidecharacterspacing),butcannotunderlinethespacesetbyHTand90°clockwise-rotatedcharacters.•ThethicknessoftheunderlineisthatspecifiedbyFS−,regardlessofthecharactersize.•Whensomeofthecharactersinalinearedoubleormoreheight,allcharactersarebaselinealigned.•ItispossibletoemphasizetheideogramusingFSWorGS!,thesettingofthelastreceivedcommand is effective.•ItispossibletoturnunderlinemodeonoroffusingFS−,andthesettingofthelastreceivedcommand is effective.

[References] FS-,FSW,GS!

FS &

[Function] Select ideogram mode.[Format] ASCII FS & Hexadecimal 1C26 Decimal 2838[Description] Switchfromcodepagetoideogrammode.[Notes] •WhenideogramcodesystemisSHIFTJIS,theprinterperformsonlyinternalflagoperations. Printing is not affected. Behavior when in Japanese mode (JIS and SHIFT JIS):

•ThiscommandiseffectiveonlywhentheJIScodesystemisselected.•Whenideogrammodeisselected,theprinterprocessesallideogramcodesforeachtwobytes.•Ideogramcodesareprocessedintheorderofthefirstbyteandsecondbyte.•Ideogrammodeisnotselectedwhenthepoweristurnedon.•UsingFSC,theideogramcodesystemisselected.BehaviorwheninChinesemode(EUC-CNandBIG-5E):•Whenideogrammodeisselected,theprintercheckswhetherthecodeisforideogramsornot, then processed the first byte and the second byte if the code is for ideograms.•Ideogramcodesareprocessedintheorderofthefirstbyteandsecondbyte.•Ideogrammodeisselectedwhenthepoweristurnedon.

[References] FS ., FS C

FS - n

[Function] Turn underline mode on/off for ideograms.[Format] ASCII FS - n Hexadecimal 1C2Dn Decimal 2845n[Range] 0≤n≤2,48≤n≤50[Default] n=0[Description] Turnunderlinemodeforideogramsonoroff,basedonthefollowingvaluesofn:

Page 102: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

95

MP-4200 TH Programmer’s Manual - Revision 1.0

n Function

0, 48 Turn off underline mode for ideograms.

1,49 Turn on underline mode for ideograms (1-dot thick).

2, 50 Turn on underline mode for ideograms (2-dot thick).

[Notes] •Theprintercanunderlineallcharacters(includingright-andleft-sidecharacterspacing),but cannotunderlinethespacesetbyHTand90°clockwise-rotatedcharacters.

•Afterunderlinemodeforideogramsisturnedoffbysettingnto0,underlineprintingisnolonger performed, but the previously specified underline thickness is not changed. The default underline thickness is 1 dot.•Thespecifiedlinethicknessdoesnotchangeevenwhenthecharactersizechanges.•ItispossibletoturnunderlinemodeonoroffusingFS!,andthelastreceivedcommandiseffective.

[Reference] FS!

FS .

[Function] Cancel ideogram mode.[Format] ASCII FS .

Hexadecimal 1C2E Decimal 2846[Description] Cancelideogrammode.[Notes] Behavior in Japanese models (JIS and SHIFT JIS):

•ThiscommandiseffectiveonlywhentheJIScodesystemisselected.•Whentheideogrammodeisnotselected,allcharactercodesareprocessedonebyteatatimeas ASCII code.•Ideogrammodeisnotselectedwhenthepoweristurnedon.BehaviorinChinesemodels(EUC-CNandBIG-5E):•Whentheideogrammodeisnotselected,allcharactercodesareprocessedonebyteatatimeas ASCII codes.•Ideogrammodeisselectedwhenthepoweristurnedon.

[References] FS &, FS C

FS C n

[Function] Select ideogram code system.[Format] ASCII FS C n

Hexadecimal 1C43n Decimal 2867n[Range] 0≤n≤2,48≤n≤50[Default] n=0[Description] Selectstheideogramcodesystem,basedonthefollowingvaluesofn:

n Ideogram Code System

0, 48 JIS code

1,49 SHIFT JIS code

[Notes] •ThiscommandiseffectiveonlyforJapanesemodel.•IntheJIScodesystem,thefollowingcodesareavailable:oPrimarybyte:21hto7EhoSecondarybyte:21hto7Eh•IntheSHIFTJIScodesystem,thefollowingcodesareavailable:oPrimarybyte:81hto9FhandE0htoEFh.oSecondarybyte:40hto7Ehand80htoFCh.

Page 103: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

96

MP-4200 TH Programmer’s Manual - Revision 1.0

FS S n1 n2

[Function] Set left- and right-side ideogram spacing.[Format] ASCII FS S n1 n2

Hexadecimal 1C53n1 n2

Decimal 2883n1 n2

[Range] 0≤n1≤255 0≤n2≤255[Default] n1=0,n2=0[Description] Setleft-andright-sideideogramspacingusingn1andn2,respectively.

•WhentheprintermodelusedsupportsGSP,theleft-sidecharacterspacingis[n1×horizontal motion unit], and the right-side character spacing is [n2 × horizontal motion unit].

[Notes] •Whendouble-widthmodeisset,theleft-andright-sidecharacterspacingistwicethenormalvalue. •HorizontalmotionunitcanbesetbyGSP.Thepreviouslyspecifiedcharacterspacingdoesnot

change,evenifhorizontalmotionunitischangedbyGSP.•Thevaluecannotbelessthantheminimumhorizontalmovementamount,andmustbesetin even units of the minimum horizontal movement amount.

[Reference] GSP

FS W n

[Function] Turn quadruple-size mode on/off for ideograms.[Format] ASCII FS W n Hexadecimal 1C57n Decimal 2887n[Range] 0≤n≤255[Default] n=0[Description] Turnquadruple-sizemodeonoroffforideograms.

•WhentheLSBofnis0,quadruple-sizemodeforideogramsisturnedoff.•WhentheLSBofnis1,quadruple-sizemodeforideogramsisturnedon.

[Notes] •Onlytheleastsignificantbitofnisused.•Inquadruple-sizemode,theprinterprintsthesamesizecharactersaswhendouble-widthanddouble-height modes are both turned on.•Whenquadruple-sizemodeisturnedoffusingthiscommand,thenextcharactersareprintedin normal size.•Ifsomeofthecharactersonasinglelinearedifferentinheight,they’rebaselinealigned.•FS!andGS!canbeusedtoselectandcancelquadruple-sizemode,selectingdouble-heightand double-width modes.

[References] FS!,GS!

GS F7h EOT NUL ‘ g1…g4

[Function] Set default gateway IP address[Format] ASCII GSF7hEOTNUL‘g1…g4 Hexadecimal 1DF7040027g1…g4 Decimal 292474039g1…g4[Default] 0.0.0.0[Description] ThiscommandsetsthedefaultgatewayIPaddress,whereg1..g4aretheIPaddressoctets.[Notes] Valid only when ethernet or wi-fi interface is being used.[Example] Ifyouwanttosetthegatewayaddressto192.168.1.2thecommandmustbesentas1DF704 0027C0A80102

Page 104: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

97

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h D m n

[Function] Activate buzzer on cut[Format] ASCII GSF9hDmn Hexadecimal 1DF944mnDecimal 2924968mn[Range] 0≤m≤2 0≤n≤255[Default] m=0 n=200[Description] •Thiscommandtellstheprintertoactivethebuzzeratthesametimeofacutisbeingperformed. •Thebuzzertobeactivatedisdefinedbymasfollow:

m buzzer

0 none (deactivate previous settings)

1 internal

2 external

•(n×100ms)definestheactivationtime

GS F9h E n

[Function] SetDHCPusage.[Format] ASCII GSF9hEn Hexadecimal 1DF945n Decimal 2924969n[Range] 0≤n≤255[Default] n=0

[Description] IfLSBofnis1,theDHCPisenabled.

GS F9h S m ip1..ip4 n c1..cn

[Function] Set SNMP settings[Format] ASCII GSF9hSmip1..ip4nc1..cn Hexadecimal 1DF953mip1..ip4nc1..cn Decimal 2924983mip1..ip4nc1..cn[Range] 0≤n≤64[Default] m=0 n=0[Description] ThiscommandsetsSNMPtrapparameters. •Whenm=0,SNMPtrapsaredisabled. •Whenm≠0,SNMPtrapsareenabled. •ndefinestheSNMPcommunityandislimitedto64bytes. •c1..cndefinethecommunityname.[Notes] Valid only when ethernet or wi-fi interface is being used.

Page 105: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

98

MP-4200 TH Programmer’s Manual - Revision 1.0

GS F9h W a s c m n e1..em p1..pn

[Function] Set Wi-Fi settings[Format] ASCII GSF9hWascmne1..emp1..pn Hexadecimal 1DF957ascmne1..emp1..pn Decimal 2924987ascmne1..emp1..pn[Range] a=0,1

s=0,1,2,3,40≤c≤130≤m≤320≤n≤63

[Default] a=0s=0c=0m=0n=0

[Description] ThiscommandsetsWi-Ficommunicationsettings.•adefinestheaccessmodeasfollow:

a Access mode

0 Access Point

1 Ad-hoc

•sdefinesthesecuritymodeasfollow:

s Security mode

0 No security

1 WEP64-bit

2 WEP128-bit

3 WPA-TKIPpersonal

4 WPA2-AESpersonal

•cdefinesthechanneltouse.Usec=0whena=0.•mdefinesthesizeoftheESSID.•ndefinesthesizeofthepassphrase.•e1..emdefinetheESSID.•p1..pndefinethepassphrase.

[Notes] Valid only when wi-fi interface is being used.

Page 106: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

99

MP-4200 TH Programmer’s Manual - Revision 1.0

Appendix I

Tables

Table 1 - Characters Per Line

58 mm

Characters per line Character per inch Command (after ESC@)

32 17 default

42 22 ESCSI or SI

16 8 ESCW 1

21 11 ESCSI orSIplusESCW1

76 or 80 mm

Characters per line Character per inch Command (after ESC@)

48 17 default

64 22 ESCSI or SI

24 8 ESCW 1

32 11 ESCSI orSIplusESCW1

Page 107: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

100

MP-4200 TH Programmer’s Manual - Revision 1.0

Appendix II

Character Tables

ASCII Thecodesfrom00hupto7Fhareshownbelow:

Code Page 437

Page 108: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

101

MP-4200 TH Programmer’s Manual - Revision 1.0

Code Page 850

CodePage850charactersetisfrom00hupto7FhandisthesamecharactersastheASCIItable.Charactersbetween 80h and FFh are available for use for international languages.

Code Page 858

Page 109: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

102

MP-4200 TH Programmer’s Manual - Revision 1.0

Code Page 860

Page 110: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

103

MP-4200 TH Programmer’s Manual - Revision 1.0

Code Page 866

CodePage866charactersetisfrom00hupto7FhandisthesamecharactersastheASCIItable.Charactersbetween 80h and FFh are available for use for cyrillic languages (Russian, Bulgarian, Serbian, etc.).

-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F

0- ☺

263A☻ 263B

♥ 2665

♦ 2666

♣ 2663

♠ 2660

• 2022

◘ 25D8

○ 25CB

◙ 25D9

♂ 2642

♀ 2640

♪ 266A

♫ 266B

☼263C

1- ► 25BA

◄ 25C4

↕ 2195

‼ 203C

¶00B6

§00A7

▬25AC

↨21A8

↑2191

↓2193

→2192

←2190

∟211F

↔2194

▲25B2

▼25BC

2- 0020

! 0021

“ 0022

# 0023

$ 0024

% 0025

& 0026

‘ 0027

( 0028

) 0029

* 002A

+ 002B

,002C

- 002D

. 002E

/ 0021

3- 0 0030

1 0031

2 0032

3 0033

4 0034

5 0035

6 0036

7 0037

8 0038

9 0039

: 003A

; 003B

< 003C

= 003D

> 003E

? 003F

4- @ 0040

A 0041

B 0042

C 0043

D 0044

E 0045

F 0046

G 0047

H 0048

I 0049

J 004A

K 004B

L 004C

M 004D

N 004E

O 004F

5- P 0050

Q 0051

R 0052

S 0053

T 0054

U 0055

V 0056

W 0057

X 0058

Y 0059

Z 005A

[ 005B

\ 005C

] 005D

^ 005E

_ 005F

6- ` 0060

a 0061

b 0062

c 0063

d 0064

e 0065

f 0066

g 0067

h 0068

l 006C

j 006A

k 006B

l 006C

m 006D

n 006E

o 006F

7- p 0070

q 0071

r 0072

s 0073

t 0074

u 0075

v 0076

w 0077

x 0078

y 0079

z 007A

{ 007B

| 007C

} 007D

~

007E

⌂ 2302

8- А 0410

Б 0411

В 0412

Г

0413

Д 0414

Е 0415

Ж 0416

З 0417

И 0418

Й 0419

К 041A

Л 041B

М 041C

Н 041D

О 041E

П 041F

9- Р 0420

С 0421

Т 0422

У 0423

Ф 0424

Х 0425

Ц 0426

Ч 0427

Ш 0428

Щ 0429

Ъ 042A

Ы 042B

Ь 042C

Э

042D

Ю 042E

Я 042F

A- а 0430

б 0431

в 0432

г 0433

д 0434

е 0435

җ 0438

з 0437

и 0438

й 0439

к 043A

л 043B

м 043C

н 043D

о 043E

п 043F

B- ░ 2591

▒ 2592

▓ 2593

│ 2502

┤ 2524

╡ 2581

╢ 2582

╖ 2568

╕ 2555

╣ 2563

║ 2551

╗ 2557

╝ 255D

╜ 255C

╛ 255B

2510

C- └ 2514

┴ 2534

┬ 252C

├ 251C

─ 2500

┼ 253C

╞ 255E

╟ 255F

╚ 255A

╔ 2554

╩ 2569

╦ 2566

╠ 2560

═ 2550

╬ 256C

╧ 2567

D- ╨ 2568

╤ 2564

╥ 2565

╙ 2559

╘ 2558

╒ 2552

╓ 2553

╫ 256B

╪ 256A

┘ 2516

┌ 250C

█ 2588

▄ 2584

258C

▐ 2590

▀ 2580

E- р 0440

с 0441

т 0442

у 0443

ф 0444

х 0445

ц 0446

ч 0447

ш 0448

щ 0449

ъ 044A

ы 044B

ь 044C

э 044D

ю 044E

я 044F

F- Ё 0401

ё 0451

Є 0404

є 0454

Ї 0407

ї 0457

Ў 040E

ў 045E

° 00B0

∙ 2219

· 00B7

√ 221A

№ 2116

¤ 00A4

■25A0

00A0

Page 111: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed

104

MP-4200 TH Programmer’s Manual - Revision 1.0

Appendix III

Transmission Status Identification

BecausethespecifiedstatusbitstransmittedfromtheESC/POScommandsarefixed,theusercanconfirmthe command to which the status belongs, as shown in the following table. WhenusingAutoStatusBack(ASB),however,processtheconsecutivethree-bytecode(exceptforXOFF)asASBdataafterconfirmingthefirstbyteoftheASB.Otherwise,thestatustransmittedbyusingtheGSrandthestatus of the second and following bytes of the ASB cannot be differentiated.

Transmission Status Identification

Command & Function Status Reply

GSI <0**0****>B

GSr <0**0****>B

XON <00010001>B

XOFF <00010011>B

DLEEOT <0**1**10>B

ASB (1st byte) <0**1**00>B

ASB (2nd to 4th bytes) <0**0****>B

Page 112: POS Printer MP-4200 TH Programmer’s Manual · 1 MP-4200 TH Programmer’s Manual - Revision 1.0 Chapter 1 Introduction MP-4200 TH is a Bematech thermal printer designed to speed