Custom Audio Electronics KM216H, KPM216H Command Reference Manual

Page 1
COMMAND REFERENCE
COMMAND REFERENCE
PUSH HERE
TO CLOSE
WARNING!
MOVING PARTS
KPM216H
Page 2
Edit by:
CUSTOM ENGINEERING S.p.A. Str. Berettine 2 - 43010 Fontevivo (PARMA) - Italy http: www.custom.biz
All rights reserved
2 Command Reference
Page 3
$0D
CCCC
[
Print and carriage return
P
[
ASCII
AACR
Hex
H0DDecimal
D
3
[
[
When autofeed
s
otherwise it is disregarded.
o
o
[
This command sets the print position
T
T
AAAA, BBBB
A
A
o
C
]
0
$
$
]
comand fu
tote
gn
n
sito to teb
g
ey exec
t
vrdta s
eq
.
Introduction

1 INTRODUCTION

1.1 Command description

Each command reported in this manual is described as shown in the following picture. In the fi rst heading line (grey colour) is reported the hexadecimal command value. In the second heading line are listed the printers on which it is possible to use the command (for example printer AAAA). The next fi elds give all the information useful to use the command.
[Name] Command title [Format] ASCII, hexadecimal and decimal command value. [Range] Limits of the values the command and its variables can take [Description] Description of command function [Notes] Additional information about command use and settings . [Default] Default value of the command and its variables. [Reference] Pertaining commands related to described command. [Example]
1° HEADING: Command title 2° HEADING: Printers that use the command
Printers: AAAA, BBBB,
Name] Format]
1 Range] Description]
Notes]
This command sets the print p
This command is immediat
Default
Example
is “CR enabled”, thi
ctions in the same way as $0A,
Information valid for printers
ing of the line.
AAAA, BBBB, CCC
Information valid for printers
inning of the line.
AAAA, BBBB
d even when the data buffer
Information valid for printer CCCC
uence is received
XX YY
The information reported in the picture are aligned with line X or line Y:
LINE X Description valid for all the printers listed in the second heading line. LINE Y Description valid for a specifi c printer (written in bold).
LEGEND
$ indicates the representation of the command hexadecimal value (for example $40 means
{ } indicates an ASCII character not performable. n, m, t, x, y
HEX 40).
are optional parameters that can have different values.
Command Reference 3
Page 4
Introduction

1.2 Print direction

The printer has two printing direction which can be selected by means of the control characters: normal e reverse.
1234567890 abcdefghilmnopqrs ABCDEFGHILMNOPQRS
1234567890 abcdefghilmnopqrs ABCDEFGHILMNOPQRS
PAPER OUTFEED DIRECTION
Normal Mode Reverse Mode
4 Command Reference
Page 5
ESC/POS™ Emulation
2 ESC/POS
TM
EMULATION
The following table lists all the commands for function management in ESC/POS Emulation of the printer. The commands can be transmitted to the printer at any moment, but they will only be carried out when the commands ahead of them have been executed. The commands are carried out when the circular buffer is free to do so.
COMMAND DESCRIPTION TABLE
Tab.1
Com. HEX Com. ASCII Description
PRINT COMMANDS
$0A LF Print and line feed
$0C Ff Form feed
$0D CR Print and carriage return
$1B $4A ESC J Print and feed paper
$1B $64 ESC d Print and feed paper n lines
LINE SPACING COMMANDS
$1B $30 ESC 0 Select 1/8-inch (200 dpi) or 1/12-inch (300 Dpi) line spacing
$1B $32 ESC 2 Select 1/6-inch (200 dpi) or 1/9-inch (300 dpi) line spacing
$1B $33 ESC 3 Set line spacing
CHARACTER COMMANDS
$18 CAN Cancel current line trasmitted
$1B $20 ESC SP Set right-side character spacing
$1B $21 ESC ! Set print mode
$1B $25 ESC % Select/cancel user-defi ned character set
$1B $26 ESC & Defi nes user-defi ned characters
$1B $2D ESC - Turn underline mode on/off
$1B $34 ESC 4 Set/reset italic mode
$1B $45 ESC E Select emphasized mode
$1B $56 ESC V Select print mode 90° turned
$1B $C1 ESC { } Set/cancel cpi mode
$1D $21 GS ! Select character size
$1D $42 GS B Turn white/black reverse printing mode on/off
PRINT POSITION COMMANDS
$08 BS Back space
$09 HT Horizontal tab
$1B $24 ESC $ Set absolute print position
$1B $28 $76 ESC ( v Set relative vertical print position
$1B $5C ESC \ Set relative print position
$1B $61 ESC a Select justifi cation
$1D $4C GS L Set left margin
$1D $57 GS W Set printing area width
BIT-IMAGE COMMANDS
$1B $2A ESC * Select image print mode
Command Reference 5
Page 6
ESC/POS™ Emulation
STATUS COMMANDS
$10 $04 DLE EOT Real-time status transmission
$1B $76 ESC v Transmit paper sensor status
$1D $72 GS r Transmit status
$1D $E0 GS { } Enable / disable automatic FULL STATUS back
$1D $E1 GS { } Reading of length paper (cm) available before virtual paper end
$1D $E2 GS { } Reading number of cuts performed from the printer
$1D $E3 GS { } Reading of length (cm) of printed paper
$1D $E4 GS { } Reading number of retracting
$1D $E5 GS { } Reading number of power up
BARCODE COMMANDS
$1D $48 GS H Select printing position of HRI characters
$1D $66 GS f Select font for HRI characters
$1D $68 GS h Select barcode height
$1D $6B GS k Print barcode
$1D $77 GS w Select barcode width
MACRO FUNCTION COMMANDS
$1D $3A GS : Start/end of macro defi nition
$1D $5E GS ^ Execute macro
MECHANISM CONTROL COMMANDS
$1B $69 ESC i Total cut
$1D $56 GS V Select cut mode
MISCELLANEOUS COMMANDS
$1B $40 ESC @ Initialize printer
$1B $FA ESC { } Print graphic
$1B $FB ESC { } Transmit graphic page to communication port
$1B $FC ESC { } Transfer fl ash bank into RAM
$1B $FD ESC { } Receive graphic page from communication port
$1B $FE ESC { } Transfer RAM into fl ash bank
$1D $49 GS I Transmit printer ID
$1D $50 GS P Set horizontal and vertical motion units
$1D $D0 GS { } Set horizontal and vertical motion units
$1D $E6 GS { } Virtual paper end limit
TICKET MANAGEMENT COMMANDS
$1D $7C GS { } Set printing density
$1D $E7 GS { } Set notch distance
$1D $F0 GS { } Set printing speed
$1D $F6 GS { } Align the print head with the notch
$1D $F8 GS { } Align the autocutter with the notch
EJECTOR COMMANDS
$1D $65 GS e Ejector commands
6 Command Reference
Page 7
Given below are more detailed descriptions of each command.
$08
Printers: KM216H, KPM216H
[Name] Back space [Format] ASCII BS Hex 08 Decimal 8 [Range] [Description] Moves print position to previous character. [Notes] Can be used to put two characters at the same position. [Default] [Reference] [Example]
$09
Printers: KM216H, KPM216H
ESC/POS™ Emulation
[Name] Horizontal tab [Format] ASCII HT Hex 09 Decimal 9 [Range] [Description] Moves the print position to the next horizontal tab position. [Notes] • Ignored unless the next horizontal tab position has been set.
• If the command is received when the printing position is at the right margin, the printer executes print buffer full printing and horizontal tab processing from the beginning of the next line.
[Default] [Reference] [Example]
$0A
Printers: KM216H, KPM216H
[Name] Print and line feed [Format] ASCII LF Hex 0A Decimal 10 [Range] [Description] Prints the data in the buffer and feeds one line based on the current line spacing. [Notes] • Sets the print position to the beginning of the line.
• If the buffer is empty, the printing feeds of (character height + spacing gap) dot.
[Default] [Reference] $1B $32, $1B $33, $0D [Example]
Command Reference 7
Page 8
ESC/POS™ Emulation
$0C
Printers: KM216H, KPM216H
[Name] Form Feed [Format] ASCII FF Hex 0C Decimal 12 [Description] Prints the data in the buffer, cuts the paper and presents the ticket. [Notes] [Default] [Reference] [Example]
$0D
Printers: KM216H, KPM216H
[Name] Print and carriage return [Format] ASCII CR Hex 0D Decimal 13 [Range] [Description] When autofeed is “CR enabled”, this command functions in the same way as $0A, oth-
erwise it is disregarded. [Notes] • Sets the print position to the beginning of the line. [Default] See “Autofeed in setup” parameter. [Reference] $0A [Example]

$10 $04

Printers: KM216H, KPM216H (serial interface only)
[Name] Real-time status transmission [Format] ASCII DLE EOT n Hex 10 04 n Decimal 16 4 n [Range] 1 ≤ n ≤ 4; n=17; n=20; n=21 [Description] Transmits the selected printer status specifi ed by n in real time according to the following
parameters: n = 1 transmit printer status n = 2 transmit off-line status n = 3 transmit error status n = 4 transmit paper roll sensor status n = 17 transmit print status n = 20 transmit FULL STATUS
[Notes] • Immediately executed even when the data buffer is full.
• This status is transmitted whenever data sequence $10 $04 n is received. [Default] [Reference] See tables below. [Example]
8 Command Reference
Page 9
n=1: Printer status
BIT OFF/ON HEX Decimal FUNCTION
0 - - - RESERVED
1 - - - RESERVED
2 - - - RESERVED
3
4 - - - RESERVED
5 - - - RESERVED
6 - - - RESERVED
7 - - - RESERVED
Off 00 0 On-line.
On 08 8 Off-line.
n=2: Off-line status
BIT OFF/ON HEX Decimal FUNCTION
0 - - - RESERVED
1 - - - RESERVED
2
3
4 - - - RESERVED
5
6
7 - - - RESERVED
Off 00 0 Cover closed
On 04 4 Cover opened
Off 00 0 Paper isn’t fed by FEED. key
On 08 8 Paper is fed by FEED. key
Off 00 0 Paper present
On 20 32 Printing stop due to paper end
Off 00 0 No error
On 40 64 Error
ESC/POS™ Emulation
n=3: Error status
BIT OFF/ON HEX Decimal FUNCTION
0 - - - RESERVED
1 - - - RESERVED
2 - - - RESERVED
3
4 - - - RESERVED
5
6
7 - - - RESERVED
Off 00 0 Cutter ok
On 08 8 Cutter error
Off 00 0 No unrecoverable error.
On 20 32 Unrecoverable error
Off 00 0 No auto-recoverable error
On 40 64 Auto-recoverable error
n=4: Paper roll sensor status
BIT OFF/ON HEX Decimal FUNCTION
0 - - - RESERVED
1 - - - RESERVED
2,3
Off 00 0 Paper present..
On 0C 12 Near paper end.
Command Reference 9
Page 10
ESC/POS™ Emulation
4 - - - RESERVED
5, 6
7 - - - RESERVED
n=17: Print status
BIT OFF/ON HEX Decimal FUNCTION
0 - - - RESERVED
1 - - - RESERVED
2
3 - - - RESERVED
4 - - - RESERVED
5
6 - - - RESERVED
7 - - - RESERVED
Off 00 0 Paper present
On 60 96 Paper not present
Off 00 0 Paper drag motor off
On 04 4 Paper drag motor on
Off 00 0 Paper present
On 20 32 Paper absent
n=20: FULL status (6 bytes)
1° Byte = $10 (DLE)
2° Byte = $0F
3° Byte = Paper status
BIT OFF/ON HEX Decimal FUNCTION
0
1 - - - RESERVED
2
3 - - - RESERVED
4 - - - RESERVED
5
6
7
(*)
Virtual paper end is set when the paper length available, readed by $1D $E1, is 0.
Off 00 0 Paper present
On 01 1 Paper not present
Off 00 0 Paper present
On 04 4 Near paper end
Off 00 0 Ticket not present in output
On 20 32 Ticket present in output
Off 00 0 Not virtual paper end (*).
On 40 64 Virtual paper end (*).
Off 00 0 Notch found
On 80 128 Notch not found
4° byte = User status
BIT OFF/ON HEX Decimal FUNCTION
0
Off 00 0 Printing head down
On 01 1 Printing head up error
10 Command Reference
Page 11
ESC/POS™ Emulation
1
2
3
4 - - - RESERVED
5
6
7 - - - RESERVED
Off 00 0 Cover closed
On 02 2 Cover opened
Off 00 0 No spooling
On 04 4 Spooling
Off 00 0 Drag paper motor off
On 08 8 Drag paper motor on
Off 00 0 LF key released
On 20 32 LF key pressed
Off 00 0 FF key released
On 40 64 FF key pressed
5° byte = Recoverable error status
BIT OFF/ON HEX Decimal FUNCTION
0
1
2 - - - RESERVED
3
4 - - - RESERVED
5
6
7
Off 00 0 Head temperature ok.
On 01 1 Head temperature error
Off 00 0 No COM error
On 02 2 RS232 COM error
Off 00 0 Power supply voltage ok
On 08 8 Power supply voltage error
Off 00 0 Acknowledge command
On 20 32 Not acknowledge command error
Off 00 0 Free paper path
On 40 64 Paper jam
Off 00 0 Notch search ok
On 80 128 Error in notch search
6° byte = Unrecoverable error status
BIT OFF/ON HEX Decimal
0
1 - - -
2
3
4 - - - RESERVED
5 - - - RESERVED
6
7 - - - RESERVED
Off 00 0 Cutter ok
On 01 1 Cutter error
RESERVED
Off 00 0 RAM ok
On 04 4 RAM error
Off 00 0 EEPROM ok
On 08 8 EEPROM error
Off 00 0 Flash OK
On 40 64 Flash error
FUNCTION
Command Reference 11
Page 12
ESC/POS™ Emulation
$18
Printers: KM216H, KPM216H
[Name] Cancel current line transmitted [Format] ASCII CAN Hex 18 Decimal 24 [Description] Deletes current line transmitted. [Notes] • Sets the print position to the beginning of the line.
• However, this command does not clear the receive buffer. [Default] [Reference] [Example]

$1B $20

Printers: KM216H, KPM216H
[Name] Set right-side character spacing [Format] ASCII ESC SP n Hex 1B 20 n Decimal 27 32 n [Range] 0 ≤ n ≤ 255 [Description] Sets the character spacing for the right side of the character to [n x horizontal or vertical
motion units]. [Notes] • The right character spacing for double-width mode is twice the normal value. When the characters are enlarged, the right side character spacing is m (2 or 4) times
the normal value.
• The horizontal and vertical motion units are specifi ed by $1D $50. Changing the hori-
zontal or vertical motion units does not affect the current right side spacing.
• The $1D $50 command can change the horizontal (and vertical) motion unit. However,
the value cannot be less than the minimum horizontal movement amount.
• In standard mode, the horizontal motion unit is used.
• The maximum right side spacing is
[Default] n = 0 [Reference] $1D $50 [Example]
12 Command Reference
200 Dpi Model 255/205 inch
300 Dpi Model 255/300 inch
Page 13

$1B $21

Printers: KM216H, KPM216H
[Name] Set print mode [Format] ASCII ESC ! n Hex 1B 21 n Decimal 27 33 n [Range] 0 ≤ n ≤ 255 [Description] Selects print modes using n (see table below):
ESC/POS™ Emulation
BIT OFF/ON HEX Decimal
0
1 - - - Undefi ned
2 - - - Undefi ned
3
4
5
6
7
Off 00 0 Character font A selected 18 x 24 14 x 24
On 01 1 Character font B selected 14 x 24 10 x 24
Off 00 0 Expanded mode not selected
On 08 8 Expanded mode selected
Off 00 0 Double-height mode not selected
On 10 16 Double-height mode selected
Off 00 0 Double-width mode not selected
On 20 32 Double-width mode selected
Off 00 0 Italic mode not selected
On 40 64 Italic mode selected
Off 00 0 Underlined mode not selected
On 80 128 Underlined mode selected
FUNCTION 200Dpi: 11/15 cpi
300Dpi: 16/23 cpi
200Dpi: 15/20 cpi 300Dpi: 23/30 cpi
[Notes] • The printer can underline all characters, but cannot underline the spaces set by $09,
$1B $24, $1B $5C and 90°/270° rotated characters.
• This command resets the left and right margin at default value (see $1D $4C, $1D $57).
• $1B $45 can also be used to turn the emphasized mode on/off. However, the last-received setting command is the effective one.
• $1B $2D can also be used to turn the underlining mode on/off. However, the last-received setting command is the effective one.
• $1D $21 can also be used to select character height/width. However, the last-received setting command is the effective one.
[Default] n = 0 [Reference] $1B $2D, $1B $45, $1D $21 [Example]
Command Reference 13
Page 14
ESC/POS™ Emulation

$1B $24

Printers: KM216H, KPM216H
[Name] Set absolute print position [Format] ASCII ESC $ nL nH Hex 1B 24 nL nH Decimal 27 36 nL nH [Range] 0 ≤ nL ≤ 255 0 ≤ nH ≤ 255 [Description] Sets the distance from the beginning of the line to the position at which subsequent
characters are to be printed.
The distance from the beginning of the line to the print position is [(nL + nH × 256) ×
(vertical or horizontal motion unit)] inches.
[Notes] • Settings outside the specifi ed printable area are ignored.
• The horizontal and vertical motion unit are specifi ed by $1D $50.
• $1D $50 can change the horizontal (and vertical) motion unit. However, the value cannot be less than the minimum horizontal movement amount.
• In standard mode, the horizontal motion unit (x) is used.
• If the setting is outside the printing area width, it sets the absolute print position, but the left or right margin is set at default value.
[Default] [Reference] $1B $5C, $1D $50 [Example]

$1B $25

Printers: KM216H, KPM216H
[Name] Select/cancel user-de ned characters set [Format] ASCII ESC % n Hex 1B 25 n Decimal 27 37 n [Range] 0 ≤ n ≤ 255 [Description] Selects or cancels the user-defi ned character set. When the Least Signifi cant Bit (LSB) of n is 0, the user-defi ned character set is can-
celled.
When the LSB of n is 1, the user-defi ned character set is selected. [Notes] • Only the LSB of n is applicable.
• When the user-defi ned character set is cancelled, the internal character set is automati- cally selected.
[Default] n=0 [Reference] $1B $26 [Example]
14 Command Reference
Page 15
ESC/POS™ Emulation

$1B $26

Printers: KM216H, KPM216H
[Name] De nes user-de ned characters [Format] ASCII ESC & y c1 c2 Hex 1B 26 y c1 c2 Decimal 27 37 y c1 c2 [Range] y = 3 32 ≤ c1 ≤ c2 ≤ 126 0 ≤ x ≤ 16 (Font (18 × 24)) 0 ≤ x ≤ 13 (Font (14 × 24)) 0 ≤ x ≤ 10 (Font 10 × 24) 0 ≤ d1 … d (y × xk) ≤ 255 k = c2 – c1 + 1 [Description] Defi nes user-defi ned characters.
Y specifi es the number of bytes in the vertical direction.
• C1 specifi es the beginning character code for the defi nition, and C2 specifi es the fi nal code.
• X specifi es the number of dots in the horizontal direction.
[Notes] • The allowable character code range is from ASCII $20 (32) to $7E (126) (95 charac-
ters).
• It is possible to defi ne multiple characters for consecutive character codes. If only one character is desired, use c1 = c2.
• If c2 < c1, the command is not executed.
• d is the dot data for the characters. The dot pattern is in the horizontal direction starting from the left. Any remaining dots on the right remain blank.
• The data to defi ne a user-defi ned character is (x x y) bytes.
• To print a dot, set the corresponding bit to 1; to not have it print, set to 0.
• This command can defi ne different user-defi ned character patterns for each font. To select the font, use $1B $21.
The user-defi ned character defi nitions are cleared when: $1B $40 or $1D $2A or $1B $3F are executed or the printer is reset or the power shut off.
[Default] Internal character set. [Reference] $1B $25 [Example]
p1
p2
14 dots (32 col) 10 dots (42 col)
MSB
LSB
Command Reference 15
Page 16
ESC/POS™ Emulation

$1B $28 $76

Printers: KM216H, KPM216H
[Name] Set relative vertical print position [Format] ASCII ESC ( v nL nH Hex 1B 28 76 nL nH Decimal 27 10 118 nL nH [Range] 0 ≤ nL ≤ 255 0 ≤ nH ≤ 255 [Description] Sets the print vertical position based on the current position by using the horizontal or
vertical motion unit. This command sets the distance from the current position to [(nL + nH × 256) × (horizontal or vertical motion unit)].
[Notes] • When the starting position is specifi ed by N motion unit to the bottom: nL + nH × 256 = N
• When the starting position is specifi ed by N motion unit to the top (negative direction),
use the complement of 65536: nL + nH × 256 = 65536 - N
• The horizontal and vertical motion unit are specifi ed by $1D $50.
• The $1D $50 command can change the horizontal (and vertical) motion unit. However, the value cannot be less than the minimum horizontal movement amount.
• In standard mode, the vertical motion unit is used.
[Default] [Reference] $1D $50 [Example]

$1B $2A

Printers: KM216H, KPM216H
[Name] Select image print mode [Format] ASCII ESC * m nL nH d1...dk Hex 1B 2A m nL nH d1...dk Decimal 27 42 m nL nH d1...dk [Range] m = 0, 1, 32, 33 0 ≤ nL ≤ 255 0 ≤ nH ≤ 3 0 ≤ d ≤ 255 [Description] Selects a bit image mode using m for the number of dots specifi ed by nL and nH, as fol-
lows:
m MODE
0 8 dot single density 8 67 100 nL + nH × 256
1 8 dot double density 8 67 200 nL + nH × 256
32 24 dot single density 24 200 100 (nL + nH × 256) × 3
33 24 dot double density 24 200 200 (nL + nH × 256) × 3
VERTICAL DIRECTION HORIZONTAL DIRECTION (*1)
N° dots DPI DPI N° of data (k)
[Notes] • The nL and nH commands indicate the number of dots of the bit image in the horizontal
direction. The number of dots is calculated using: nL + nH x 256.
• If the bit image data input exceeds the number of dots to be printed on a line, the excess data is ignored.
• d indicates the bit image data. Set a corresponding bit to 1 to print a dot, or to 0 to not print the dot.
• If the value of m is outside the specifi ed range, nL and data following it are processed as normal data.
16 Command Reference
Page 17
ESC/POS™ Emulation
• If the width of the printing area set by $1D $4C and $1D $57 is less than the width re­quired by the data set using $1B $2A, the excess data are ignored.
• To print the bit image use $1B $4A or $1B $64.
• After printing a bit image, the printer returns to normal data processing mode.
• This command is not affected by the emphasized, double-strike, underline (etc.) print modes, except for the upside-down mode.
• The relationship between the image data and the dots to be printed is as follows:
8-dot bit image 24-dot bit image
d1
d7
MSB
d4
MSB
[Default]
d1
d3d2
Print data
Bit­image data
LSB
d5
d8
d2
d3
d6
d9
Print data
Bit­image data
LSB
[Reference] [Example]

$1B $2D

Printers: KM216H, KPM216H
[Name] Turn underline mode on/off [Format] ASCII ESC - n Hex 1B 2D n Decimal 27 45 n [Range] 0 ≤ n ≤ 2 48 ≤ n ≤ 50 [Description] Turns underline mode on or off, based on the following values of n: n = 0, 48 Turns off underline mode n = 1, 49 Turns on underline mode (1-dot thick) n = 2, 50 Turns on underline mode (2-dot thick) [Notes] • The printer can underline all characters, but cannot underline the space and right-side
character spacing.
• The printer cannot underline 90°/270° rotated characters and white/black inverted char­acters.
• When underline mode is turned off by setting the value of n to 0 or 48, the data which follows is not underlined.
• Underline mode can also be turned on or off by using $1B $21. Note, however, that the last received command is the effective one.
[Default] n=0 [Reference] $1B $21 [Example]
Command Reference 17
Page 18
ESC/POS™ Emulation

$1B $30

Printers: KM216H, KPM216H
[Name] Select 1/8-inch (200 dpi) or 1/12-inch (300 Dpi) line spacing [Format] ASCII ESC 0 Hex 1B 30 Decimal 27 48 [Range] [Description] Selects 1/8-inch (for 200 dpi) or 1/12-inch (for 300 dpi) line spacing. [Notes] [Default] [Reference] $1B $32, $1B $33 [Example]

$1B $32

Printers: KM216H, KPM216H
[Name] Select 1/6-inch (200 dpi) or 1/9-inch (300 dpi) line spacing [Format] ASCII ESC 2 Hex 1B 32 Decimal 27 50 [Range] [Description] Selects 1/8-inch (for 200 dpi) or 1/12-inch (for 300 dpi) line spacing. [Notes] [Default] [Reference] $1B $30, $1B $33 [Example]

$1B $33

Printers: KM216H, KPM216H
[Name] Set line spacing [Format] ASCII ESC 3 n Hex 1B 33 n Decimal 27 51 n [Range] 0 ≤ n ≤ 255 [Description] Sets line spacing to [ n × (vertical or horizontal motion unit)] inches. [Notes] • The horizontal and vertical motion unit are specifi ed by $1D $50. Changing the horizontal
or vertical motion unit does not affect the current line spacing.
• The $1D $50 command can change the horizontal (and vertical) motion unit. However, the value cannot be less than the minimum vertical movement amount.
• In standard mode, the vertical motion unit is used.
• The maximum spacing is 32.5mm.
[Default] n = 64 (1/6 inch) [Reference] $1B $30, $1B $32, $1D $50 [Example]
18 Command Reference
Page 19
ESC/POS™ Emulation

$1B $34

Printers: KM216H, KPM216H
[Name] Set/reset italic mode [Format] ASCII ESC 4 n Hex 1B 34 n Decimal 27 52 n [Range] 0 ≤ n ≤ 1,48 ≤ n ≤ 49 [Description] Turns italic mode on or off, based on the following values of
n FUNCTION
0, 48 Turns off italic mode
1, 49 Turns on italic mode
[Notes] • The printer can print any character in italic mode.
• When italic mode is turned off by setting the value of n to 0 or 48, the data which follows is printed in normal mode.
• Italic mode can also be turned on or off using $1B $21. Note, however, that the last received command is the effective one.
[Default] n = 0 [Reference] $1B $21 [Example]

$1B $40

Printers: KM216H, KPM216H
[Name] Initialize printer [Format] ASCII ESC @ Hex 1B 40 Decimal 27 64 [Range] [Description] Clears the data in the print buffer and resets the printer mode to that in effect when power
was turned on.
[Notes] • The data in the receiver buffer is not cleared.
• The macro defi nitions are not cleared.
[Default] [Reference] [Example]
Command Reference 19
Page 20
ESC/POS™ Emulation

$1B $45

Printers: KM216H, KPM216H
[Name] Select emphasized mode [Format] ASCII ESC E n Hex 1B 45 n Decimal 27 69 n [Range] 0 ≤ n ≤ 255 [Description] Turns emphasized mode on/off.
• When the LSB of n is 0, the emphasized mode is off.
• When the LSB of n is 1, the emphasized mode is on.
[Notes] • Only the LSB of n is effective.
• $1B $21 also turns on and off the emphasized mode. However, the last received com­mand is the effective one.
[Default] n = 0 [Reference] $1B $21 [Example]

$1B $4A

Printers: KM216H, KPM216H
[Name] Print and feed paper [Format] ASCII ESC J n Hex 1B 4A n Decimal 27 74 n [Range] 0 ≤ n ≤ 255 [Description] Prints the data in the print buffer and feeds the paper [ n × (vertical or horizontal motion
unit)] inches.
[Notes] • After printing has been completed, this command sets the print starting position to the
beginning of the line.
• The paper feed amount set by this command does not affect the values set by $1B $32 or $1B $33.
• The horizontal and vertical motion units are specifi ed by $1D $50.
• $1D $50 can change the vertical (and horizontal) motion unit. However, the value cannot be less than the minimum vertical movement amount.
• In standard mode, the vertical motion unit is used.
[Default] [Reference] $1D $50 [Example]
20 Command Reference
Page 21
ESC/POS™ Emulation

$1B $56

Printers: KM216H, KPM216H
[Name] Select print mode 90° turned [Format] ASCII ESC V n Hex 1B 56 n Decimal 27 86 n [Range] 0 ≤ n ≤ 1, 48 ≤ n ≤ 49 [Description] Turns 90° rotation mode on/off. n is used as follows :
n FUNCTION
0, 48 Turns off 90° rotation mode
1, 49 Turns on 90° rotation mode
[Notes] • When underlined mode is turned on, the printer does not underline 90° rotated charac-
ters. All the same it’s possible select the underline mode.
• Double-width and double-height commands in 90° rotation mode enlarge characters in the opposite directions from double-height and double-width commands in normal mode.
• This command is not available in Page mode.
• If this command is entered in Page mode, the printer all the same save the setting.
Default] n = 0 [Reference] $1B $21, $1B $2D [Example]

$1B $5C

Printers: KM216H, KPM216H
[Name] Set relative print position [Format] ASCII ESC \ nL nH Hex 1B 5C nL nH Decimal 27 92 nL nH [Range] 0 ≤ nL ≤ 255 0 ≤ nH ≤ 255 [Description] Sets the print starting position based on the current position by using the horizontal or-
vertical motion unit.
Sets the distance from the current position to [(nL+ nH × 256) × (horizontal or vertical
motion unit)].
[Notes] • It’s possible to print further on the right margin set for every font. In this case the printing
continues up to the maximum border of the printer mechanism and then begins a new row.
• Any setting that exceeds the printable area is ignored.
• When the starting position is specifi ed by n motion units to the right: nL + nH × 256 = n
• When the starting position is specifi ed by n motion units to the left (negative direction), use the complement of 65536: nL + nH × 256 = 65536 – n
• If setting exceeds the printing area width, the left or right margin is set to the default value.
• The horizontal and vertical motion unit are specifi ed by $1D $50.
• $1D $50 can change the horizontal (and vertical) motion units. However, the value can­not be less than the minimum horizontal movement amount.
• In standard mode, the horizontal motion unit is used.
[Default] [Reference] $1B $24, $1D $50 [Example]
Command Reference 21
Page 22
ESC/POS™ Emulation

$1B $61

Printers: KM216H, KPM216H
[Name] Select justi cation [Format] ASCII ESC a n Hex 1B 61 n Decimal 27 97 n [Range] 0 ≤ n ≤ 2 48 ≤ n ≤ 50 [Description] Aligns all data in one line to the specifi ed position. n selects the type of justifi cation as
follows:
n JUSTIFICATION 0, 48 Flush left 1, 49 Centred 2, 50 Flush right
[Notes] • This command is only enabled when inserted at the beginning of a line.
• Lines are justifi ed within the specifi ed printing area.
• Spaces set by $09, $1B $24 and $1B $5C will be justifi ed according to the previously- entered mode.
[Default] n = 0 [Reference] [Example] Flush left Centered Flush right
ABC ABCD ABCDE
ABC
ABCD
ABCDE
ABC
ABCD
ABCDE

$1B $64

Printers: KM216H, KPM216H
[Name] Print and feed paper n lines [Format] ASCII ESC d n Hex 1B 64 n Decimal 27 100 n [Range] 0 ≤ n ≤ 255 [Description] Prints the data in the print buffer and feeds the paper n rows. [Notes] • n rows paper feed is equivalent to (n × char height + line spacing set).
• Sets the print starting position at the beginning of the line.
• The maximum paper feed amount is 254 rows. Even if a paper feed amount of more than 254 rows is set, the printer feeds the paper only 254 rows.
[Default] [Reference] $1B $32, $1B $33 [Example]
22 Command Reference
Page 23
ESC/POS™ Emulation

$1B $69

Printers: KM216H, KPM216H
[Name] Total cut [Format] ASCII ESC i Hex 1B 69 Decimal 27 105 [Range] [Description] This command prints the data in the buffer and enables cutter operation. If there is no
cutter, a disabling fl ag is set and any subsequent cut commands will be ignored.
[Notes] • The printer waits to complete all paper movement commands before it executes a total
cut. [Default] [Reference] [Example]

$1B $76

Printers: KM216H, KPM216H (serial interface only)
[Name] Transmit paper sensor status [Format] ASCII ESC v Hex 1B 76 Decimal 27 118 [Range] [Description] When this command is received, transmit the current status of the paper sensor. [Notes] This command is executed immediately, even when the data buffer is full (Busy ). The
status to be transmitted is shown in the table below:
BIT OFF/ON HEX Decimal FUNCTION
0,1
2,3
4 Off 00 0 Not used. Fixed to Off
5 - - - Undefi ned
6 - - - Undefi ned
7 Off 00 0 Not used. Fixed to Off
Off 00 0 Near paper-end sensor: paper present
On 03 3 Near paper-end sensor: paper not present
Off 00 0 Paper-end sensor: paper present
On (0C) (12) Paper-end sensor: paper not present
[Default] [Reference] [Example]
Command Reference 23
Page 24
ESC/POS™ Emulation

$1B $C1

Printers: KM216H, KPM216H
[Name] Set/cancel cpi mode [Format] ASCII ESC { } n Hex 1B C1 n Decimal 27 193 n [Range] 0 ≤ n ≤ 1, 48 ≤ n ≤ 49 [Description] Sets cpi mode based on the following values of n:
n
0, 48
1, 49
200Dpi 300Dpi
Font A = 11 cpi
Font B = 15 cpi
Font A = 15 cpi Font B = 20 cpi
FUNCTION
Font A = 16 cpi
Font B = 23 cpi
Font A = 23 cpi
Font B = 30 cpi
[Default] n = 0 [Reference] $1B $21 [Example]

$1B $FA

Printers: KM216H, KPM216H
[Name] Print graphic [Format] ASCII ESC { } n xH xL yH yL Hex 1B FA n xH xL yH yL Decimal 27 250 n xH xL yH yL [Range] 0 ≤ n ≤ 1 0 ≤ xH, xL, yH, yL ≤ 255 [Description] Prints graphic logo from fl ash or current graphic page located in ram. n selects the graphic
source as follows:
n FUNCTION
0 Print graphic page from ram (used at the moment)
1 Print logo 1 from fl ash
The maximum printable vertical dimension dhmax is:
Modello 200 Dpi 327 linee
Modello 300 Dpi 221 linee
xL + xH × 256 specifi es the starting dotline (1 ÷ dhmax).
yL + yH × 256 specifi es the number of lines to print.
[Notes] • If (xL + (xH × 256)) > dhmax the printer does not execute the command.
• If ( xL + ( xH × 256 ) + yL +( yH × 256 ))> dhmax the printer prints only dhmax - xL + (
xH × 256 ) +1 dotline.
• After the print of the logo from RAM (n= 0 ), the graphic page is deleted. If the user wants to print again or save the logo into the fl ash, the user must retransmit or reload it with the command $1B $33.
• To print a text string before the logo, send a $0A, because the logo printing buffer and the characters buffer is the same.
• If don’t modify the logo stored into fl ash bank, use this command with n = 1.
24 Command Reference
Page 25
ESC/POS™ Emulation
[Default] [Reference] $1B $32, $1B $33 [Example] To print from ram bank dotline 100 to dotline 299, send:
HEX: $1B $FA $00 $00 $64 $00 C7

$1B $FB

Printers: KM216H, KPM216H (serial interface only)
[Name] Transmit graphic page to communication port [Format] ASCII ESC { } nL nH Hex 1B FB nL nH Decimal 27 251 nL nH [Range] 0 ≤ nL, nH ≤ 255 [Description] Transmits [nL + (nH × 256)] word of graphic page used at the moment to the communica-
tion port. [Notes] [Default] [Reference] $1B $FC, $1B $FD, $1B $FE [Example]

$1B $FC

Printers: KM216H, KPM216H
[Name] Transfer ash bank into RAM [Format] ASCII ESC { } n Hex 1B FC n Decimal 27 252 n [Range] n = 1 [Description] Transfers fl ash bank into RAM used at the moment (65536 bytes). n selects the fl ash
bank as follows:
n FUNCTION
1 Transfers fl ash bank logo 1 into ram
[Notes] • Don’t lose the logo holded into the graphic page don’t send, after this command, other
control characters to the printer which operate on the printing buffer ($0A, $0C) as the
logo printing buffer and the characters is the same.
• To print strings character and logo from ram proceed as follows:
1) send strings character with a $0A ending command;
2) send $1B $FC $01 to transfer logo into ram;
3) send $1B $FA $00 xH xL yH yL to print logo. [Default] [Reference] $1B $FA, $1B $FD, $1B $FE [Example]
Command Reference 25
Page 26
ESC/POS™ Emulation

$1B $FD

Printers: KM216H, KPM216H
[Name] Receive graphic page from communication port [Format] ASCII ESC { } nL nH Hex 1B FD nL nH Decimal 27 253 nL nH [Range] 0 ≤ nL, nH ≤ 255 [Description] Receives [nL + (nH × 256)] words from the port and puts them into the ram bank. [Notes] • The number of data bytes received is [nL + (nH × 256)] × 2.
• Each word is fi rst received as MSByte and then as LSByte.
• If [nL + (nH × 256)] is greater than 32768, the data which follows is processed as normal data.
The fl ash bank dimensions for the graphic print are:
200 Dpi Model
300 Dpi Model
1600 horizontals dots
(200 bytes/dot line)
2368 horizontals dots
(296 bytes/dot line)
327 verticals dots
x
(65400 bytes)
221 verticals dots
x
(65416 bytes)
• If the logo height is smaller than the maximum height of 816 pixel, the area not used is deleted.
[Default] [Reference] $1B $FA, $1B $FC, $1B $FE [Example]

$1B $FE

Printers: KM216H, KPM216H
[Name] Transfer RAM into ash bank [Format] ASCII ESC { } n Hex 1B FE n Decimal 27 254 n [Range] n = 1 [Description] Transfers the RAM used at the moment into the fl ash bank (65536 bytes). n selects the bank as follows:
n FUNCTION
1 Transfers RAM used at the moment into fl ash bank logo 1
[Notes] [Default] [Reference] $1B $FA, $1B $FC, $1B $FD [Example]
26 Command Reference
Page 27

$1D $21

Printers: KM216H, KPM216H
[Name] Select character size [Format] ASCII GS ! n Hex 1D 21 n Decimal 29 33 n [Range] 0 ≤ n ≤ 7, 16 ≤ n ≤ 23, 32 ≤ n ≤ 39, 48 ≤ n ≤ 55, 64 ≤ n ≤ 71, 80 ≤ n ≤ 87, 96 ≤ n ≤ 103, 112 ≤ n ≤ 119 [Description] Selects character height and width, as follows:
• Bits 0 to 3: to select character height (see table 2).
• Bits 4 to 7: to select character width (see table 1).
Table 1 Select character width Table 2 Select character height
HEX Decimal WIDTH HEX Decimal HEIGHT
00 0 1 (normal) 00 0 1 (normal)
10 16 2 (width = 2x) 01 1 2 (height = 2x)
20 32 3 (width = 3x) 02 2 3 (height = 3x)
30 48 4 (width = 4x) 03 3 4 (height = 4x)
40 64 5 (width = 5x) 04 4 5 (height = 5x)
50 80 6 (width = 6x) 05 5 6 (height = 6x)
60 96 7 (width = 7x) 06 6 7 (height = 7x)
70 112 8 (width = 8x) 07 7 8 (height = 8x)
ESC/POS™ Emulation
[Notes] • This command is effective for all characters (except HRI characters).
If n falls outside the defi ned range, this command is ignored.
• Characters enlarged to different heights on the same line are aligned at the baseline or topline.
• $1B $21 can also be used to select character size. However, the setting of the last received command is the effective one.
[Default] n = 0 [Reference] $1B $21 [Example]

$1D $3A

Printers: KM216H, KPM216H
[Name] Start/end macro de nition [Format] ASCII GS : Hex 1D 3A Decimal 29 58 [Description] Starts or ends macro defi nition. [Notes] • Macro defi nition starts when this command is received during normal operation.
• When $1D $5E is received during macro defi nition, the printer ends macro defi nition and clears all defi nitions.
• Macros are not defi ned when power is turned on to the machine.
• Macro content is not cancelled by the $1B $40 command. Therefore, $1B $40 may be included in the content of macro defi nitions.
• If the printer receives $1D $3A a second time after previously receiving $1D $3A, the printer remains in macro undefi ned status.
• The contents of the macro can be defi ned up to 1024 bytes. If the macro defi nition exceeds 1024 bytes, excess data is not stored.
Command Reference 27
Page 28
ESC/POS™ Emulation
[Default] [Reference] $1D $5E [Example]

$1D $42

Printers: KM216H, KPM216H
[Name] Turn white/black reverse printing mode on/off [Format] ASCII GS B n Hex 1D 42 n Decimal 29 66 n [Range] 0 ≤ n ≤ 255 [Description] Turns white/black reverse printing mode on or off.
• When the LSB of n is 0, white/black reverse printing is turned off.
• When the LSB of n is 1, white/black reverse printing is turned on. [Notes] • Only the LSB di n is effective.
• This command is available for both built-in and user-defi ned characters.
• This command does not affect bit image, downloaded bit image, bar code, HRI characters and spacing skipped by $09, $1B $24 and $1B $5C.
• This command does not affect white space between lines.
• White/black reverse mode has a higher priority than underline mode. Even if underline mode is on, it will be disabled (but not cancelled) when white/black reverse mode is se­lected.
[Default] n = 0 [Reference] [Example]

$1D $48

Printers: KM216H, KPM216H
[Name] Select printing position of Human Readable Interpretation ( HRI ) characters [Format] ASCII GS H n Hex 1D 48 n Decimal 29 72 n [Range] 0 ≤ n ≤ 3, 48 ≤ n ≤ 51 [Description] Selects the printing position of HRI characters when printing bar codes. n selects the
printing positions as follows:
n FUNCTION
0, 48 Not printed
1, 49 Above the barcode.
2, 50 Below the barcode.
3, 51 Both above and below the barcode.
[Notes] HRI characters are printed using the font specifi ed by $1D $66. [Default] n = 0 [Reference] $1D $66, $1D $6B [Example]
28 Command Reference
Page 29

$1D $49

Printers: KM216H, KPM216H (serial interface only)
[Name] Transmit printer ID [Format] ASCII GS I n Hex 1D 49 n Decimal 29 73 n [Range] 1 ≤ n ≤ 3, 49 ≤ n ≤ 51 [Description] Transmits the printer ID specifi ed by n follows:
n PRINTER ID SPECIFICATION
1, 49 Printer model ID
2, 50 Type ID See table below
3, 51 ROM version ID Depends on ROM version (4 characters)
n = 2, 50 Type ID
BIT OFF/ON HEX Decimal FUNCTION
0 Off 00 0 2-byte characters codes not supported
1
2
3 - - - Undefi ned
4 Off 00 0 Not used. Fixed to Off
5 - - - Undefi ned
6 - - - Undefi ned
7 Off 00 0 Not used. Fixed to Off
Off 00 0 Autocutter not supplied
On 02 2 Autocutter supplied
Off 00 0 Thermal paper w/o label
On 04 4 Thermal paper label
ESC/POS™ Emulation
$AA (KM216H) $58 (KPM216H 200 dpi) $59 (KPM216H 300 dpi)
[Notes] • This command is executed when the data is processed in the data buffer. Therefore,
there could be a time lag between command reception and data transmission, depending on data buffer status.
• The printer only transmits 1 byte (printer ID) without confi rmation that the host is ready
to receive data. [Default] [Reference] [Example]
Command Reference 29
Page 30
ESC/POS™ Emulation

$1D $4C

Printers: KM216H, KPM216H
[Name] Set left margin [Format] ASCII GS L nL nH Hex 1D 4C nL nH Decimal 29 76 nL nH [Range] 0 ≤ nL, nH ≤ 255 [Description] Sets the left margin.
• The left margin is set to [(nL + nH × 256) × (horizontal motion unit)] inches.
Printable area
Left margin Printing area width
[Notes] • This command is enabled only if set at the beginning of the line.
• If the left margin + printing area width is greater than the printable area, the printing area
• The horizontal and vertical motion unit are specifi ed by $1D $50. Changing the horizontal
• The $1D $50 command can change the horizontal (and vertical) motion unit.
• However, the value cannot be less than the minimum horizontal movement amount and
[Default] [Reference] $1D $50, $1D $57 [Example]
• If the setting exceeds the printable area, the maximum value of the printable area is used.
width is set at maximum value.
or vertical motion unit does not affect the current left margin.
it must be in even units of the minimum horizontal movement amount.

$1D $50

Printers: KM216H, KPM216H
[Name] Set horizontal and vertical motion units [Format] ASCII GS P x y Hex 1D 50 x y Decimal 29 80 x y [Range] 0 ≤ x, y ≤ 255 [Description] Sets the horizontal and vertical motion units to 1/x inch and 1/y inch respectively. When x is set to 0, the default setting value is used. When y is set to 0, the default setting value is used. [Notes] • The horizontal direction is perpendicular to the paper feed direction.
• In standard mode, the following commands use x or y, regardless of character rotation (upside-down or 90° clockwise rotation):
Commands using x : $1B $20, $1B $24, $1B $5C, $1D $4C, $1D $57. Commands using y : $1B $33, $1B $4A.
• This command does not affect the previously specifi ed values.
30 Command Reference
Page 31
ESC/POS™ Emulation
• The calculated result from combining this command with others is truncated to the minimum value of the mechanical pitch or an exact multiple of that value.
[Default]
200 Dpi Model
300 Dpi Model
[Reference] $1B $20, $1B $24, $1B $5C, $1B $33, $1B $4A, $1D $4C, $1D $57 [Example]

$1D $56

Printers: KM216H, KPM216H
[Name] Select cut mode [Format] Mode n ASCII GS V m Hex 1D 56 m Decimal 29 86 m Mode o ASCII GS V m n Hex 1D 56 m n Decimal 29 86 m n [Range] Mode n m = 0, 48 Mode o m = 65, 0 n 255 [Description] Selects cut mode and executes the cut command. m selects cut mode as follows:
x = 204 y = 408
x = 300 y = 600
m FUNCTION
0, 48 Total cut.
65, 66 Form feed (cut position + [ n × vertical motion unit]) and total cut
[Notes] • This command is only enabled if set at the beginning of the line.
• The horizontal and vertical motion units are specifi ed by $1D $50.
[Default] [Reference] $1B $69 [Example]

$1D $57

Printers: KM216H, KPM216H
[Name] Set printing area width [Format] ASCII GS W nL nH Hex 1D 57 nL nH Decimal 29 87 nL nH [Range] 0 ≤ nL, nH ≤ 255 0 ≤ nL + nH × 256) ≤ 832 [Description] Sets the printing area width to the area specifi ed by nL and nH. The nMAX value is:
200 Dpi Model 1600
300 Dpi Model 2368
Command Reference 31
Page 32
ESC/POS™ Emulation
• The left margin is set to [(nL + nH × 256) × (horizontal motion unit)] inches.
Printable area
Left margin Printing area width
[Notes] • This command is only enabled if set at the beginning of the line.
• If the right margin is greater than the printable area, the printing area width is set at maximum value.
• If the printing area width = 0, it is set at the maximum value.
• The horizontal and vertical motion units are specifi ed by $1D $50. Changing the hori- zontal or vertical motion unit does not affect the current left margin.
• The $1D $50 command can change the horizontal (and vertical) motion unit. However, the value cannot be less than the minimum horizontal movement amount and it must be in even units of the minimum horizontal movement amount.
[Default] [Reference] $1D $4C, $1D $50 [Example]

$1D $5E

Printers: KM216H, KPM216H
[Name] Execute macro [Format] ASCII GS ^ r t m Hex 1D 5E r t m Decimal 29 94 r t m [Range] 0 ≤ r, t ≤ 255 0 ≤ m ≤ 1 [Description] Executes a macro.
r specifi es the number of times to execute the macro.
t specifi es the waiting time for executing the macro.
The waiting time is t × 100 msec. for each macro execution.
• m specifi es macro executing mode:
When the LSB of m = 0, the macro is executed r times continuously at the interval speci-
ed by t.
When the LSB of m = 1, after waiting for the period specifi ed by t, the LED indicator blinks
and the printer waits for the LINE FEED button to be pressed. After the button is pressed,
the printer executes the macro once. The printer repeats the operation r times.
[Notes] • This command has an interval of (t × 100 msec.) after a macro is executed by t.
• If this command is received while a macro is being defi ned, the macro defi nition is aborted and the defi nition is cleared.
• If the macro is not defi ned or if r is 0, nothing is executed.
• When the macro is executed by pressing the LINE FEED button (m = 1), the paper
cannot be fed using the LINE FEED button.
[Default] [Reference] $1D $3A [Example]
32 Command Reference
Page 33

$1D $65

Printers: KPM216H
[Name] Ejector commands [Format] ASCII GS e n m Hex 1D 65 n m Decimal 29 101 n m [Range] 1 ≤ n ≤ 6 [Description] This command checks tickets ejector n = 1 n = 2 Ticket retracted (only if Paper retracting is enabled) n = 3 Ticket produced with m steps (1 step = 6.5 mm) n = 4 n = 5 Ticket ejection n = 6 Transmit the status byte of the ejector
BIT OFF / ON HEX Decimal FUNCTION
0
1 - - - RESERVED
2
3
4
5
6
7
Off 00 0 Paper present in abundance
On 01 1 Near paper end
Off 00 0 Paper end sensor (paper not present)
On 04 4 Paper end sensor (paper present)
Off 00 0 Ticket not present on the output
On 08 8 Ticket present on the output
Off 0 Printer’s stepper motor off
On 16 Printer’s stepper motor on
Off 00 0 Emitter motor off
On 20 32 Emitter motor on
Off 00 0 Not error
On 40 64 Error
Off 00 0 Free paper route
On 80 128 Paper jam
ESC/POS™ Emulation
[Notes] m must be sent with n = 3; with n = 3 if the ticket is not yet cut, before to perform the command, the printer made a
total cut. [Default] [Reference] [Example] The correct commands sequence to print a ticket is:
1. Clear dispenser Ejection (Hex : 1D 65 05) or Retraction
2. Prints ticket
3. Cuts paper Total cut (Hex : 1B 69)
4. Dispenser Presents ticket with 80mm (Hex : 1D 65 03 1E)
Command Reference 33
Page 34
ESC/POS™ Emulation

$1D $66

Printers: KM216H, KPM216H
[Name] Select font for HRI characters [Format] ASCII GS f n Hex 1D 66 n Decimal 29 102 n [Range] n = 0, 1, 48, 49 [Description] Selects a font for the HRI characters used when printing a bar code. n selects a font from
the following table:
n FONT
0, 48 Font A
1, 49 Font B
[Notes] HRI characters are printed at the position specifi ed by $1D $48. [Default] n = 0 [Reference] $1D $48, $1D $6B [Example]

$1D $68

Printers: KM216H, KPM216H
[Name] Set bar code height [Format] ASCII GS h n Hex 1D 68 n Decimal 29 104 n [Range] 1 ≤ n ≤ 255 [Description] Sets the height of the bar code. n specifi es the number of vertical dots. [Notes] [Default] n = 162 ( 20.25 mm ) [Reference] $1D $6B [Example]
34 Command Reference
Page 35

$1D $6B

Printers: KM216H, KPM216H
[Name] Print bar code [Format] Mode n ASCII GS k m NUL Hex 1D 6B m 00 Decimal 29 107 m 0 Mode o ASCII GS k m n Hex 1D 6B m n Decimal 29 107 m n [Range] Mode n 0 ≤ m ≤ 20 ‚ Mode o 65 ≤ m ≤ 90
ESC/POS™ Emulation
[Description]
Selects a bar code system and prints the bar code. m selects a bar code system as follows:
m BARCODE SYSTEM No. OF CHARACTERS REMARKS
0 UPC-A 11≤ k ≤12 48≤ d ≤ 57
1 UPC-E 11≤ k ≤12 48≤ d ≤ 57
2 EAN13 ( JAN) 12 k 13 48 d 57
3 EAN8 ( JAN) 7 k 8 48 d 57
4 CODE39 1≤ k
n
5 ITF 1≤ k (even number) 48 ≤ d ≤ 57
6 CODABAR 1≤ k
7 CODE93 1≤ k ≤255 1≤ d ≤ 127
8 CODE128 2≤ k ≤255 1≤ d ≤ 127
20 CODE32 8≤ k ≤9 48≤ d ≤ 57
65 UPC-A 11≤ n ≤12 48≤ d ≤ 57
66 UPC-E 11≤ n ≤12 48≤ d ≤ 57
67 EAN13 ( JAN) 12 n 13 48 d 57
68 EAN8 ( JAN) 7 n 8 48 d 57
69 CODE39 1≤ n ≤ 255
o
70 ITF 1≤ n ≤255 48≤ d ≤ 57
71 CODABAR 1≤ n ≤ 255
72 CODE93 1≤ n ≤255 0≤ d ≤ 127
73 CODE128 2≤ n ≤255 0≤ d ≤ 127
90 CODE32 8≤ n ≤9 48≤ d ≤
48 d 57,65 d 90, 32,
36, 37, 43, 45, 46, 47
48 d 57, 65 d1 68, 36,
43, 45, 46, 47, 58
48 d 57, 65 d 90, 32,
36, 37, 43, 45, 46, 47
48 d 57, 65 d1 68, 36,
43, 45, 46, 47, 58
57
[Notes] • If d is outside of the specifi ed range, the printer prints the following message: “BAR CODE
GENERATOR IS NOT OK!” and processes the data which follows as normal data.
• If the horizontal size exceeds the printing area, the printer only feeds the paper.
• This command feeds as much paper as is required to print the bar code, regardless of
the line spacing specifi ed by $1B $32 or $1B $33.
• After printing the bar code, this command sets the print position to the beginning of the
line.
• This command is not affected by print modes (emphasized, double-strike, underline or
character size), except for upside-down and justifi cation mode.
[Notes per n] • This command ends with a NUL code.
• When the bar code system used is UPC-A or UPC-E, the printer prints the bar code data
after receiving 11 (without check digit) or 12 (with check digit) bytes bar code data.
Command Reference 35
Page 36
ESC/POS™ Emulation
• When the bar code system used is EAN13, the printer prints the bar code data after receiving 12 (without check digit) or 13 (with check digit) bytes bar code data.
• When the bar code system used is EAN8, the printer prints the bar code data after receiving 7 (without check digit) or 8 (with check digit) bytes bar code data.
• The number of data for ITF bar code must be even numbers. When an odd number of data is input, the printer ignores the last received data.
[Notes per o] • If n is outside of the specifi ed range, the printer stops command processing and proc-
esses the following data as normal data.
When CODE93 is used:
• The printer prints an HRI character ( o ) as a start character at the beginning of the HRI character string.
• The printer prints an HRI character ( o ) as a stop character at the end of the HRI char­acter string.
• The printer prints an HRI character ( n ) as a control character ( $00 to $1F and $7F).
When CODE128 is used:
• When using CODE128 in this printer, please note the following regarding data transmis­sion:
• The top part of the bar code data string must be a code set selection character (CODE A, CODE B or CODE C) which selects the fi rst code set.
• Special characters are defi ned by combining two characters “{“ and one character. ASCII character “{” is defi ned by transmitting “{“ twice, consecutively.
SPECIFIC
CHARACTER
SHIFT {S 7B, 53 123, 83 CODE A {A 7B, 41 123, 65 CODE B {B 7B, 42 123, 66 CODE C {C 7B, 43 123, 67
FNC1 {1 7B, 31 123, 49 FNC2 {2 7B, 32 123, 50 FNC3 {3 7B, 33 123, 51 FNC4 {4 7B, 34 123, 52
‘{‘ {{ 7B, 7B 123, 123
ASCII HEX Decimal
DATA TRANSMISSION
When UPC-E is used, introducing the barcode characters, the printer prints:
TRANSMITTED DATA
d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11
0 0-9 0-9 0 0 0 0 0 0-9 0-9 0-9 d2 d3 d9 d10 d11 0
0 0-9 0-9 1 0 0 0 0 0-9 0-9 0-9 d2 d3 d9 d10 d11 1
0 0-9 0-9 2 0 0 0 0 0-9 0-9 0-9 d2 d3 d9 d10 d11 2
0 0-9 0-9 3-9 0 0 0 0 0 0-9 0-9 d2 d3 d4 d10 d11 3
00-90-90-91-9000000-9d2d3d4d5d114
00-90-90-90-91-900005-9d2d3d4d5d6d11
PRINTING DATA
[Default] [Reference] $1D $48, $1D $66, $1D $68, $1D $77 [Example] Mode n Example of print the Bar Code 39 1D 6B 04 54 45 53 54 00 Mode o Example of print the Bar Code 39 1D 6B 45 04 54 45 53 54
36 Command Reference
Page 37

$1D $72

Printers: KM216H, KPM216H (serial interface only)
[Name] Transmit status [Format] ASCII GS r n Hex 1D 72 n Decimal 29 114 n [Range] n = 1, 49 [Description] Transmits the status specifi ed by n as follows:
n FUNCTION
1, 49 Transmits paper sensor status (as for $1B $76).
Paper sensor status (n = 1, 49):
BIT OFF/ON HEX Decimal FUNCTION
0, 1
2,3
4 Off 00 0 Not used. Fixed to Off
5 - - - Undefi ned
6 - - - Undefi ned
7 Off 00 0 Not used. Fixed to Off
Off 00 0 Near paper end sensor: paper present
On 03 3 Near paper end sensor: paper not present
Off 00 0 Paper end sensor: paper present
On (0C) (12) Paper end sensor: paper not present
ESC/POS™ Emulation
[Notes] • This command is executed when the data is processed in the data buffer. Therefore,
there may be a time lag between receiving the command and transmitting the status,
depending on data buffer status. [Default] [Reference] $10 $04, $1B $76 [Example]

$1D $77

Printers: KM216H, KPM216H
[Name] Set bar code width [Format] ASCII GS w n Hex 1D 77 n Decimal 29 119 n [Range] 1 ≤ n ≤ 6 [Description] Sets the horizontal size of the bar code. n specifi es the bar code width as follows:
n MODULE WIDTH (mm)
1 0.125
2 0.25
3 0.375
4 0.5
5 0.625
6 0.75
[Notes]
Command Reference 37
Page 38
ESC/POS™ Emulation
[Default] n = 3 [Reference] $1D $6B [Example]

$1D $7C

Printers: KM216H, KPM216H
[Name] Set printing density [Format] ASCII GS { } n Hex 1D 7C n Decimal 29 124 n [Range] 0 ≤ n ≤ 8, 48 ≤ n ≤ 56 [Description] Sets printing density. n specifi es printing density as follows:
n PRINTING DENSITY
0, 48 - 50%
1, 49 - 37.5%
2, 50 - 25%
3, 51 - 12.5%
4, 52 0%
5, 53 + 12.5%
6, 54 + 25%
7, 55 + 37.5%
8,56 + 50%
[Notes] • Printing density reverts to the default value when the printer is reset or turned off. [Default] n = 4 [Reference] [Example]

$1D $D0

Printers: KM216H, KPM216H
[Name] Set horizontal and vertical motion units [Format] ASCII GS { } xH xL yH yL Hex 1D D0 xH xL yH yL Decimal 29 208 xH xL yH yL [Range] 0 ≤ (xH * 256) + xL) ≤ 2040 0 ≤ (yH * 256) + yL) ≤ 4080 [Description] Sets the horizontal and vertical motion units to 1/((xH * 256) + xL) inch and 1/((yH * 256)
+yL) inch respectively. When x is set to 0, the default setting value is used. When y is set to 0, the default setting value is used. [Notes] • The horizontal direction is perpendicular to the paper feed direction.
• In standard mode, the following commands use x or y, regardless of character rotation
(upside-down or 90° clockwise rotation):
Commands using x: $1D $4C, $1D $57. Commands using y: $1B $4A, $1B $33.
38 Command Reference
Page 39
ESC/POS™ Emulation
• This command does not affect the previously specifi ed values.
• The calculated result from combining this command with others is truncated to the minimum value of the mechanical pitch or an exact multiple of that value.
[Default]
Model 200 Dpi
Model 300 Dpi
[Reference] $1B $4A, $1D $4C, $1D $57, $1D $D0 [Example]

$1D $E0

Printers: KM216H, KPM216H
[Name] Enable / disable automatic FULL STATUS back [Format] ASCII GS { } n Hex 1D E0 n Decimal 29 224 n [Range] 0 ≤ n ≤ 255 [Description] Enable / disable automatic full status back. n specifi es the composition of FULL STATUS
as follows :
x = 204 y = 408
x = 300 y = 600
BIT OFF/ON HEX Decimal FUNCTION
0
1
2
3
4 - - - RESERVED
5 - - - RESERVED
6 - - - RESERVED
7 - - - RESERVED
Off 00 0 Disable paper status
On 01 1 Enable paper status
Off 00 0 Disable user status
On 02 2 Enable user status
Off 00 0 Disable Recoverable Error Status
On 04 4 Enable Recoverable Error Status
Off 00 0 Disable Unrecoverable Error Status
On 08 8 Enable Unrecoverable Error Status
[Notes] • Once enable at least one byte of the FULL STATUS, for each change of at least one of
the bits which compose the required status, the status sent in automatic from the printer will be so composed as follows:
1° Byte = 0x10 (DLE) 2° Byte = n Next byte (depends how many bits are active in in) [Default] [Reference] $10 $04 [Example]
Command Reference 39
Page 40
ESC/POS™ Emulation

$1D $E1

Printers: KM216H, KPM216H
[Name] Reading of length paper (cm) available before virtual paper-end [Format] ASCII GS { } Hex 1D E1 Decimal 29 225 [Range] [Description] Reading of length (cm) paper available before virtual paper-end. The command return a string pointing out how much paper is available, for example if
there are 5.1 m before the paper end, it will be: ‘510cm’
[Notes] • The lenght of residual paper reported is just as an indication because tolerances and
other factors are not taken into consideration (paper thickness, roll core diameter, roll core thickness). The virtual paper-end limit is set by the command $1D $E6.
• To set virtual paper-end limit, measure the length of the paper from near paper end to the end of the roll, using several of them.
[Default] [Reference] $1D $E6 [Example]

$1D $E2

Printers: KM216H, KPM216H
[Name] Reading number of cuts performed from the printer [Format] ASCII GS { } Hex 1D E2 Decimal 29 226 [Range] [Description] Reading the number of cuts performed from the printer. [Notes] The command return a string that points out how many cuts are performed by the printer,
for example if there are performed 2376 cuts, it will be:
‘2376 cuts’ [Default] [Reference] [Example]

$1D $E3

Printers: KM216H, KPM216H
[Name] Reading of length (cm) of printed paper [Format] ASCII GS { } Hex 1D E3 Decimal 29 227 [Range] [Description] Reading of length (cm) of printed paper. [Notes] The command return a string pointing out how much paper is printed, for example if the
printer has print about 2515,5 m, it will be: ‘251550cm’
[Default] [Reference] [Example]
40 Command Reference
Page 41
ESC/POS™ Emulation

$1D $E4

Printers: KPM216H
[Name] Reading number of retracting [Format] ASCII GS { } Hex 1D E4 Decimal 29 228 [Range] [Description] Reading number of retracting of the printer. [Notes] • The command return a string pointing out the number of retracting of the printer, for
example if the printer has retracted the paper 512 times, it will be: ‘512ret’ [Default] [Reference] [Example]

$1D $E5

Printers: KM216H, KPM216H
[Name] Reading number of power up [Format] ASCII GS { } Hex 1D E5 Decimal 29 229 [Range] [Description] Reading number of power up of the printer. [Notes] The command return a string pointing out the number of turning on of the printer, for
example if the printer is turned on 512 times, it will be: ‘512on’ [Default] [Reference] [Example]

$1D $E6

Printers: KM216H, KPM216H
[Name] Virtual paper-end limit [Format] ASCII GS { } nH nL Hex 1D E6 nH nL Decimal 29 230 nH nL [Range] 0 ≤ nH≤ 255 0 ≤ nL ≤ 255 [Description] This command sets the limit after which is pointed out the virtual paper-end. [Notes] • The calculation limit of the near paper-end is in centimetres.
• This value is expressed as [(nH x 256)+nL] [Default] nH = 0×00 nL = 0×F0 [Reference] [Example] To see the virtual paper-end is pointed out after 15 metres from the fi rst detection of near
paper end, it’s necessary convert 15 metres in 1500 centimetres and then, calculate nH
and nL value in the following mode:
nH = 1500 / 256 = 5 nL = 1500 - (nH x 256) = 1500 - (5 x 256) = 220
Command Reference 41
Page 42
ESC/POS™ Emulation
and then send the following command:
HEX: $1D $E6 $05 $DC
DECIMAL: 29 230 5 220

$1D $E7

Printers: KM216H, KPM216H
[Name] Set notch distance [Format] ASCII GS { } nL nH Hex 1D E7 nL nH Decimal 29 231 nL nH [Range] 0 ≤ nH ≤ 255 0 ≤ nL ≤ 255 [Description] Sets notch distance in tenth mm from the beginning of the document. [Notes] • This value is expressed as [(nH x 256)+nL]
• The maximum value is 99,9 mm. [Default] nH = $00 nL = $00 [Reference] [Example]

$1D $F0

Printers: KM216H, KPM216H
[Name] Set printing speed [Format] ASCII GS { } n Hex 1D F0 n Decimal 29 240 n [Range] 0 ≤ n ≤ 2 [Description] Sets printing speed. n specifi es the printing speed as follows:
n PRINTING SPEED
0 High quality
1 Normal
2 High speed
[Notes] • Printing speed reverts to the default value when the printer is reset or turned off. [Default] n = 1 [Reference] [Example]
42 Command Reference
Page 43
ESC/POS™ Emulation

$1D $F6

Printers: KM216H, KPM216H
Name] Align the print head with the notch [Format] ASCII GS { } Hex 1D F6 Decimal 29 246 [Range] [Description] Set the print head notch alignment (as $1D $E7 command setting). [Notes] [Default] [Reference] $1D $E7, $1D $F8 [Example]

$1D $F8

Printers: KM216H, KPM216H
[Name] Align the autocutter with the notch [Format] ASCII GS { } Hex 1D F8 Decimal 29 248 [Range] [Description] Set the autocutter notch alignment (as $1D $E7 command setting). [Notes] [Default] [Reference] $1D $E7, $1D $F6 [Example]
Command Reference 43
Page 44
ESC/POS™ Emulation
44 Command Reference
Page 45

3 COMMANDS INDEX

Commands Index
ESC/POS
$08............................................................................7
$09............................................................................7
$0A ...........................................................................7
$0C ...........................................................................8
$0D ...........................................................................8
$10 $04.....................................................................8
$18..........................................................................12
$1B $20 ..................................................................12
$1B $21 ..................................................................13
$1B $24 ..................................................................14
$1B $25 ..................................................................14
$1B $26 ..................................................................15
$1B $28 $76 ...........................................................16
$1B $2A ..................................................................16
$1B $2D..................................................................17
$1B $30 ..................................................................18
$1B $32 ..................................................................18
$1B $33 ..................................................................18
$1B $34 ..................................................................19
$1B $40 ..................................................................19
$1B $45 ..................................................................20
$1B $4A ..................................................................20
$1B $56 ..................................................................21
$1B $5C..................................................................21
$1B $61 ..................................................................22
$1B $64 ..................................................................22
$1B $69 ..................................................................23
$1B $76 ..................................................................23
$1B $C1..................................................................24
$1B $FA ..................................................................24
$1B $FB..................................................................25
$1B $FC .................................................................25
$1B $FD .................................................................26
$1B $FE..................................................................26
$1D $21 ..................................................................27
$1D $3A ..................................................................27
$1D $42 ..................................................................28
$1D $48 ..................................................................28
$1D $49 ..................................................................29
$1D $4C .................................................................30
$1D $50 ..................................................................30
$1D $56 ..................................................................31
$1D $57 ..................................................................31
$1D $5E..................................................................32
$1D $65 ..................................................................33
$1D $66 ..................................................................34
$1D $68 ..................................................................34
$1D $6B..................................................................35
$1D $72 ..................................................................37
$1D $77 ..................................................................37
$1D $7C .................................................................38
$1D $D0 .................................................................38
$1D $E0..................................................................39
$1D $E1..................................................................40
$1D $E2..................................................................40
TM
EMULATION
$1D $E3..................................................................40
$1D $E4..................................................................41
$1D $E5..................................................................41
$1D $E6..................................................................41
$1D $E7..................................................................42
$1D $F0 ..................................................................42
$1D $F6 ..................................................................43
$1D $F8 ..................................................................43
Command Reference 45
Page 46
Commands Index
46 Command Reference
Page 47
Page 48
Part Number : DOMC-0003E Rev. 1.00
CUSTOM ENGINEERING SPA
World Headquarters
Via Berettine, 2 - 43100 Fontevivo
Tel. +39 0521 680111 - Fax +39 0521 610701 info@custom.biz - www.custom.biz
All rigths reserved
www.custom.biz
Loading...