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 website:
www.bematech.com
Notwithstanding 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. 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 Quick Start. 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.
The objective of this manual is to give to programmers all necessary information to properly
program and integrate the MP-4000 TH printer into a system. The MP-4000 TH printer is able
to interpret ESC/Bema commands and ESC/POS
For further information refer to the documentation below available in our website:
® 1
commands.
www.bematech.com
User’s Manual – Contains information referring to operation, features and specifications of
the MP-4000 TH printer.
Service Manual – Contains information necessary to identify and resolve MP-4000 TH printer
problems.
Developers advice
Beside this manual, the drivers and API (and all their documentation) listed below are available
from our website (http://www.bematech.com
•Windows 2000/XP/Vista-32 – API dynamic-link library driver (mp2032.dll); recent
spooler drivers (BemaSetupXXxX.exe); parallel port driver and USB port driver;
software for testing purposes.
•Windows 9x/ME/NT4 - API dynamic-link library driver (mp2032.dll); old and
unsupported spooler drivers (BemaSetupXXxX.exe);
•Linux (x86) - CUPS
implementantion of mp2320 library as a shared object (mp2032.so);
1 ESC/POS® is registered trademark of Seiko Epson Corporation.
TM
spooler drivers compatible with Redhat 8.0; partial
The MP-4000 TH printer has a series of programming commands that may be used in the
remote mode. Two types of commands can be sent:
1.1 Direct command
In this mode, a simple ASCII code is enough to command the printer. For example:
ASCII CODE : LF
DECIMAL : 10
HEXADECIMAL : 0A
This command causes the printer to perform a line feed.
1.2 Control sequence
In this mode, more than one code may be sent to command or program the printer.
This “control sequence” always starts with the ASCII code “ESC”, “FS” or “GS”. For example:
The following section lists and describes all resident commands including command
parameters. The command syntax is as follows:
•ESC P is a command without parameters;
•ESC Q n is a command with one parameter only;
•ESC K n1 n2 is a command with two parameters;
•ESC D n1...nk is a command with a variable number of parameters.
A character ‘h’ following an alphanumeric string represents an hexadecimal number. A
number with no ‘h’ following it is in decimal mode. An italic item is a parameter to the escape
function.
Note: MP-4000 TH printer is capable of interpreting ESC/Bema commands and
ESC/POS commands.
2.1 ESC/Bema Command Table
Operation
Code Function Format hexadecimal Page
GS F9h 5 00hSelect ESC/Bema operation mode. Writes on flash.
GS F9h 1Fh 31h Return to previous set of commands configured
before temporary setting.
ESC @ Initializes the MP-4000 TH printer 1B 40 14
ESC b n n = 1 => PE signal reflects drawer sensor
n = 0 => PE signal reflects paper sensor
ESC v nActivate drawer for n milliseconds (-50ms < n <
200ms)
ESC w Performs a full paper cut 1B 77 15
ESC m Performs a partial paper cut 1B 6D 15
ESC y nEnable / disable panel keys 1B 79 n 15
ESC x Enable Dump Mode 1B 78 16
ESC z n Enable (n = 1) / disable (n = 0) automatic line feed 1B 7A n 16
ESC ( A pL pH fn n1 n2vol
GS F9h – nSet printer priority (high quality or high speed) 1D F9 2D n 17
GS F9h ! n Set paper width 1D F9 21 n 17
GS F9h , nEnable/Disable paper near end sensor 1D F9 2C n 18
GS F9h + nSet and save printing intensity 1D F9 2B n 18
GS FAh nSet printer language 1D FA n 18
ESC C nSet page size in lines 1B 43 n21
ESC c n1 n2Set page size in millimeters 1B 63 n1 n2 21
ESC J nPerforms a fine line feed 1B 4A n 21
FF Feeds one page 0C 21
LF Feeds one line 0A 22
ESC 2 Line feed of 1/6 inch 1B 32 22
ESC 3 nLine feed of n/144 inch 1B 33 n 23
ESC f 1 nVertical skipping 1B 66 31 n 23
ESC A nFeeding paper (n * 0,375mm) 1B 41 n 23
Horizontal positioning
Code Function Format hexadecimal Page
ESC f 0 nHorizontal skipping 1B 66 30 n 24
ESC Q nSet right margin 1B 51 n 24
ESC l nSet left margin 1B 6C n 24
ESC a n Centralize (n = 1) or left align (n = 0) characters 1B 61 n 25
ESC d nEnable / Disable double height print mode 1B 64 n 30
ESC H Set default column per line 1B 48 31
ESC P Set default column per line 1B 50 31
ESC SI Set condensed mode 1B 0F 31
ESC SO Set on-line expanded mode 1B 0E 32
ESC V Set on-line double height mode 1B 56 32
ESC W nEnable / Disable expanded mode 1B 57 n 32
SI Enable condensed mode 0F 33
SO Enable on-line expanded mode 0E 33
GS h nSets the height n of the barcode generated 1D 68 n 46
GS w nDetermines the width of the barcode 1D 77 n 46
GS H n Choose the position of the human readable
1D 48 n 46
information (HRI) of the barcode
GS f nSets the font used to print the human readable
1D 66 n 47
information (HRI)
GS k 0 d1…d11 NUL Prints an UPC-A barcode 1D 6B 00 d1…d
GS k 65 11 d1...d11 Prints an UPC-A barcode 1D 6B 41 0B d1…d
GS k 1 d1…d6 NUL Prints an UPC-E barcode 1D 6B 01 d1…d
GS k 66 6 d1…d6 Prints an UPC-E barcode 1D 6B 42 06 d1…d
GS k 2 d1…d12 NUL Prints an EAN-13 barcode 1D 6B 02 d1…d
GS k 67 12 d1…d12 Prints an EAN-13 barcode 1D 6B 43 0C d1…d
GS k 3 d1…d7 NUL Prints an EAN-8 barcode 1D 6B 03 d1…d
GS k 68 7 d1…d7 Prints an EAN-8 barcode 1D 6B 44 07 d1…d
GS k 4 d1…dn NUL Prints a CODE 39 barcode 1D 6B 04 d1…d
GS k 69 n d1…dn Prints a CODE 39 barcode 1D 6B 45 n d1…d
GS k 5 d1…dn NUL Prints an ITF barcode 1D 6B 05 d1…d
GS k 70 n d1...dn Prints an ITF barcode 1D 6B 46 n d1…d
GS k 6 d1…dn NUL Prints a CODABAR barcode 1D 6B 06 d1…d
GS k 71 n d1…dn Prints a CODABAR barcode 1D 6B 47 n d1…d
GS k 72 d1…dn Prints a CODE 93 barcode 1D 6B 48 n d1…d
GS k 73 n d1…dn Prints a CODE 128 barcode 1D 6B 49 n d1…d
GS k 128 n1 n2 n3 n4
n
5 n6
d1…d
n
Prints a PDF-417 barcode 1D 6B 80 n
n
d1…d
6
n
GS k 21 d1…d9 NUL Prints an ISBN barcode 1D 6B 15 d1…d
GS k 22 d1…dn NUL Prints a MSI barcode 1D 6B 16 d1…d
GS k 130 n d1…dn Prints a MSI barcode 1D 6B 82 n d1…d
GS k 23 d1…dn NUL Prints a PLESSEY barcode 1D 6B 17 d1…d
GS k 131 n d1…dn Prints a PLESSEY barcode 1D 6B 83 n d1…d
GS k 132 n1 n2 Programs barcode’s left margin 1D 6B 84 n1 n
GS F9h 5 01hSelect ESC/POS operation mode. Writes on flash.
Use with caution.
GS F9h 20h 31h Select ESC/POS temporary operation mode.
Doesn’t alters flash.
GS F9h 1Fh 31h Return to previous set of commands configured
before temporary setting.
ESC = n Select peripheral device 1B 3D n 57
ESC @ Initialize printer 1B 40 57
ESC c 3 n Select paper sensor(s) to output paper-end signals 1B 63 33 n 58
ESC c 4 n Select paper sensor(s) to stop printing 1B 63 34 n 58
ESC c 5 n Enable/disable panel buttons 1B 63 35 n 59
ESC p m t1 t2 General pulse 1B 70 m t1 t2 59
GS ( A pL pH n m Execute test print 1D 28 41 pL pH n m 60
DLE DC4 n m t Generate pulse at real-time 10 14 n m t 60
GS V m (n) Select cut mode and cut paper 1D 56 m (n) 61
ESC ( A pL pH fn n c t1 t2
Activate buzzer 1B 28 41 pL pH fn n c
Vertical positioning
Code Function Format hexadecimal Page
LF Print and line feed 0A 62
FF Print and return to standard mode 0C 62
CR Print and carriage return 0D 62
ESC $ nL nH Set absolute print position 1B 24 nL n
ESC 2 Select default line spacing 1B 32 63
ESC 3 n Set line spacing 1B 33 n 63
ESC \ nL nH Set relative print position 1B 5C nL n
ESC d n Print and feed n lines 1B 64 n 64
Horizontal positioning
Code Function Format hexadecimal Page
HT Horizontal tab 09 65
ESC SP n Set right-side character spacing 1B 20 n 65
ESC D n1…nK NUL Set horizontal tab positions 1B 44 n1…nk 00 65
ESC a n Select justification 1B 61 n 66
GS L nL nH Set left margin 1D 4C nL nH 66
Character types
Code Function Format hexadecimal Page
ESC – n Turn underline mode on/off 1B 2D n 67
ESC E n Turn emphasized mode on/off 1B 45 n 67
ESC M n Select character font 1B 4D n 67
GS B Activate/deactivate black/white reverse printing 1D 42 n 68
ESC R nSelect an international character set 1B 52 n 68
ESC t n Select character code table 1B 74 n 68
DLE EOT nReal-time status transmission 10 04 n 69
DLE ENQ n Real-time request to printer 10 05 n 70
GS I n Transmit printer ID 1D 49 n 71
GS a n Enable/disable Automatic Status Back (ASB) 1D 61 n 72
GS r n Transmit status 1D 72 n 73
Data Control
Code Function Format hexadecimal Page
CAN Cancel print data 18 75
Barcodes
Code Function Format hexadecimal Page
GS h n Set bar code height 1D 68 n 46
GS w n Set bar code width 1D 77 n 46
GS H n Select printing position of HRI characters 1D 48 n 46
GS f n Select font for HRI characters 1D 66 n 47
GS k 0 d1…d11 NUL Prints an UPC-A barcode 1D 6B 00 d1…d1
GS k 65 11 d1...d11 Prints an UPC-A barcode 1D 6B 41 0B d1…d1
GS k 1 d1…d6 NUL Prints an UPC-E barcode 1D 6B 01 d1…d
GS k 66 6 d1…d6 Prints an UPC-E barcode 1D 6B 42 06 d1…d
GS k 2 d1…d12 NUL Prints an EAN-13 barcode 1D 6B 02 d1…d1
GS k 67 12 d1…d12 Prints an EAN-13 barcode 1D 6B 43 0C d1…d1
GS k 3 d1…d7 NUL Prints an EAN-8 barcode 1D 6B 03 d1…d
GS k 68 7 d1…d7 Prints an EAN-8 barcode 1D 6B 44 07 d1…d
GS k 4 d1…dn NUL Prints a CODE 39 barcode 1D 6B 04 d1…d
GS k 69 n d1…dn Prints a CODE 39 barcode 1D 6B 45 n d1…d
GS k 5 d1…dn NUL Prints an ITF barcode 1D 6B 05 d1…d
GS k 70 n d1...dn Prints an ITF barcode 1D 6B 46 n d1…d
GS k 6 d1…dn NUL Prints a CODABAR barcode 1D 6B 06 d1…dn 00 51
GS k 71 n d1…dn Prints a CODABAR barcode 1D 6B 47 n d1…d
GS k 72 d1…dn Prints a CODE 93 barcode 1D 6B 48 n d1…d
GS k 73 n d1…dn Prints a CODE 128 barcode 1D 6B 49 n d1…d
GS k 128 n1 n2 n3 n4
n
5 n6
d1…d
n
Prints a PDF-417 barcode 1D 6B 80 n1 n2 n
d1…d
n
6
n
GS k 21 d1…d9 NUL Prints an ISBN barcode 1D 6B 15 d1…d9 00 53
GS k 22 d1…dn NUL Prints a MSI barcode 1D 6B 16 d1…d
GS k 130 n d1…dn Prints a MSI barcode 1D 6B 82 n d1…d
GS k 23 d1…dn NUL Prints a PLESSEY barcode 1D 6B 17 d1…dn 00 54
GS k 131 n d1…dn Prints a PLESSEY barcode 1D 6B 83 n d1…d
GS k 132 n1 n2Programs barcode’s left margin 1D 6B 84 n1 n2 55
[Format] ASCII ESC w
Hexadecimal 1B 77
Decimal 27 119
[Description] This command operates the auto cutter, performing a full cut in the
paper.
[Notes] When presenter is activated there is a minimum receipt size (roughly 3.3
inches) to avoid paper jam inside the presenter. If the receipt size is less
than the minimum, the full cut command will automatically add line feeds
to perform the cut.
ESC m
[Function] Performs a partial paper cut.
[Format] ASCII ESC m
Hexadecimal 1B 6D
Decimal 27 109
[Description] This command operates the auto cutter, performing a partial cut in the
paper.
[Notes] This command is available only if presenter is not activated.
ESC y n
[Function] Enable / disable panel keys.
[Format] ASCII ESC y n
Hexadecimal 1B 79 n
Decimal 27 121 n
[Range] n = 0,1
[Default] n = 1
[Description] Enables or disables the panel key.
9 When n is 0 (00h or 30h), the panel key is disabled.
9 When n is 1 (01h or 31h), the panel key is enabled.
9
[Notes] When the panel key is disabled, no button on the panel is usable.
[Note] This command doesn’t work with parallel port in SPP mode.
GS F9h ‘ n
[Function] Get printer information.
[Format] ASCII GS F9h ‘ n
Hexadecimal 1D F9 27 n
Decimal 29 249 39 n
[Description] Get printer information as shown on following table:
n Information
0, 30h Product code
1, 31h Serial number
2, 32h Manufacturing date
3, 33h Firmware version
4, 34h Reserved
5, 35h Manufacturing timestamp (dd/mm/yyyy hh:mm:ss format)
[Description] Set IP address and subnet mask on hexadecimal format without
points.
[Example] IP 10.1.1.250 and SUBNET 255.0.0.0 must be sent as 0Ah 01h 01h
FAh FFh 00h 00h 00h
GS F9h * n
[Function] Set USB address.
[Format] ASCII GS F9h * n
Hexadecimal 1D F9 2A n
Decimal 29 249 42 n
[Description] Set USB address to allow the use of more than one printer on same
[Function] Line feed of n/144 inch.
[Format] ASCII ESC 3 n
Hexadecimal 1B 33 n
Decimal 27 51 n
[Range] 16 ≤ n ≤ 255
[Description] The line feed rate per line is specified by n/144 inch.
[Notes] This command takes effect immediately.
ESC f 1 n
[Function] Vertical skipping
[Format] ASCII ESC f 1 n
Hexadecimal 1B 66 31 n
Decimal 27 102 49 n
[Range] 0 ≤ n ≤ 255
[Description] Performs a vertical skipping of n characters.
[Notes] The command 1Bh 66h 01h n has the same effect.
ESC A n
[Function] Feeding paper n * 0,375mm.
[Format] ASCII ESC A n
Hexadecimal 1B 41 n
Decimal 27 65 n
[Range] 0 < n < 256
[Description] Performs the feeding of n * 0,375mm.
[Notes] If n < 17, the line feed will be equal to zero. For n > 100, the line feed
will be equal to 32mm. For other values, the line feed is equal to
Decimal 27 102 48 n
[Range] 0 ≤ n ≤ 255
[Description] Performs a horizontal skipping of n characters.
[Notes] The command 1B 66 00 n has the same effect.
ESC Q n
[Function] Set right margin.
[Format] ASCII ESC Q n
Hexadecimal 1B 51 n
Decimal 27 81 n
[Range] 0 < n < 256
[Description] Sets right margin in characters from the default left margin.
[Notes] If the right margin is set to the left of the current horizontal position, the
new margin becomes valid in the next line.
ESC I n
[Function] Set left margin.
[Format] ASCII ESC I n
Hexadecimal 1B 6C n
Decimal 27 108 n
[Range] 0 < n < 256
[Description] Sets left margin in characters from the default left margin.
[Notes] If the left margin is set to the right of the current horizontal position, the