Thermal Printer Development Kit 3 Inch User Manual

THERMAL PRINTER
DEVELOPMENT KIT 3 INCH
32-BIT MICROCONTROLLER
FM3 Family
USER MANUAL
Publication Number MB9B310_AN706-00093
CONFIDENTIAL
Revision 1.0
Issue Date September 18, 2014
U S E R
2
CONFIDENTIAL
M A N U A L
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Target products
This application note describes the following products.
Series
Product Number
MB9B310
MB9B316N
MB9B510
MB9B516N
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
3
U S E R
M A N U A L
Table of Contents
1
2
3
4
5
4
CONFIDENTIAL
Introduction ..................................................................................................................................... 7
1.1
About Document ................................................................................................................. 7
1.2
About Thermal Printer Development Kit 3 Inch ................................................................... 7
1.3
About MB9B310/MB9B510 Series MCU ............................................................................. 7
System Overview............................................................................................................................ 8
2.1
Development and Work Environment .................................................................................. 9
2.1.1
Development Environment ................................................................................. 9
2.1.2
Work Environment ............................................................................................ 10
Hardware Introduction .................................................................................................................. 11
3.1
Hardware Overview ........................................................................................................... 11
3.1.1
Features ........................................................................................................... 12
3.1.2
System Block Diagram ..................................................................................... 12
3.2
Power Supply .................................................................................................................... 13
3.2.1
24V to 5V.......................................................................................................... 13
3.2.2
5V to 3.3V......................................................................................................... 13
3.3
Connectors ........................................................................................................................ 14
3.3.1
USB Connector ................................................................................................ 14
3.3.2
UART Connector .............................................................................................. 14
3.3.1
Power Connector.............................................................................................. 16
3.3.1
Print Head Connector ....................................................................................... 17
3.3.1
Debug Port and Expand Connector .................................................................. 19
3.4
Configuration ..................................................................................................................... 20
3.5
Printing Control Circuit ...................................................................................................... 21
3.6
External Storage ............................................................................................................... 22
Function........................................................................................................................................ 23
4.1
Command List ................................................................................................................... 23
4.2
Character Printing ............................................................................................................. 25
4.2.1
Character Lib .................................................................................................... 25
1.1.1
User-Define Characters .................................................................................... 27
1.1.2
Character Font Style ........................................................................................ 28
4.3
Bitmap Printing .................................................................................................................. 29
4.4
Barcode Printing ................................................................................................................ 31
4.5
Interface Introduction......................................................................................................... 32
4.5.1
DIP Switch ........................................................................................................ 32
4.5.2
LED and Button ................................................................................................ 33
4.6
Self-Test Introduction ........................................................................................................ 34
4.7
Sensor Check .................................................................................................................... 35
4.7.1
Paper Sensors.................................................................................................. 35
4.7.2
Platen Open Sensor ......................................................................................... 35
4.7.3
Head Temperature Sensor ............................................................................... 35
4.8
Black Mark Function .......................................................................................................... 36
4.9
Error Processing ............................................................................................................... 37
Firmware W Introduction .............................................................................................................. 38
5.1
Firmware Overview ........................................................................................................... 38
5.2
Communication ................................................................................................................. 42
5.2.1
USB Serial Interface ......................................................................................... 42
5.2.2
RS-232 Serial Interface .................................................................................... 46
5.3
ESC/POS Module.............................................................................................................. 47
5.3.1
Status Check .................................................................................................... 47
5.3.2
FIFO ................................................................................................................. 47
5.3.3
Task .................................................................................................................. 51
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.3.4
ESC/POS ......................................................................................................... 54
Data Process ..................................................................................................................... 55
5.4.1
Data analysis .................................................................................................... 55
5.4.2
Page data process ........................................................................................... 56
5.4.3
Create task ....................................................................................................... 57
5.4.4
Other ................................................................................................................ 58
5.5
Print Header ...................................................................................................................... 60
5.5.1
Print Header Driver ........................................................................................... 60
5.5.2
Print Head Pin .................................................................................................. 66
5.5.3
Print Head CSIO............................................................................................... 68
5.6
Character Module .............................................................................................................. 69
5.6.1
Overview .......................................................................................................... 69
5.6.2
Function Module Flow ...................................................................................... 70
5.6.1
Function Description ......................................................................................... 72
5.7
Barcode Module ................................................................................................................ 79
5.7.1
Overview .......................................................................................................... 79
5.7.2
Function Description ......................................................................................... 79
5.8
MISC Module .................................................................................................................... 81
5.8.1
ADC .................................................................................................................. 81
5.8.2
Dual Timer ........................................................................................................ 84
5.8.3
Free Run Timer ................................................................................................ 86
5.8.4
PWM................................................................................................................. 88
5.8.5
Sys_IF .............................................................................................................. 90
Reference Documents .................................................................................................................. 91
Appendix ...................................................................................................................................... 92
7.1
Commands ........................................................................................................................ 92
7.1.1
Command Format Description.......................................................................... 92
7.1.2
Terms Description ............................................................................................. 92
7.1.3
Commands ....................................................................................................... 93
5.4
6
7
Figures
Figure 2-1: System Architecture ................................................................................................................. 8
Figure 2-2: Printer Control Board ............................................................................................................... 9
Figure 3-1: Thermal Printer Development Board ....................................................................................... 11
Figure 3-2: System Block Diagram ........................................................................................................... 12
Figure 3-3: Schematic for 24V to 5V ........................................................................................................ 13
Figure 3-4: Schematic for 5V to 3.3V ....................................................................................................... 13
Figure 3-5: USB Connector ...................................................................................................................... 14
Figure 3-6: USB Connector Schema ........................................................................................................ 14
Figure 3-7: UART Connector .................................................................................................................... 14
Figure 3-8: UART Connector Schema ...................................................................................................... 15
Figure 3-9: CN8 Connector ...................................................................................................................... 16
Figure 3-10: CN7 Connector .................................................................................................................... 16
Figure 3-11: CN4 Connector..................................................................................................................... 17
Figure 3-12: CN2 Connector .................................................................................................................... 18
Figure 3-13: FFC Cable............................................................................................................................ 18
Figure 3-14: CN6 Connector .................................................................................................................... 19
Figure 3-15: CN9 Connector .................................................................................................................... 19
Figure 3-16: CN10 Connector .................................................................................................................. 19
Figure 3-17: DIP Switch ........................................................................................................................... 20
Figure 3-18: MOD0 JMP1 ........................................................................................................................ 20
Figure 3-19: Printing Control Circuit ......................................................................................................... 21
Figure 3-20: Schematic for SRAM ............................................................................................................ 22
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
5
U S E R
M A N U A L
Figure 3-21: Schematic for SPI Flash....................................................................................................... 22
Figure 4-1: ASCII Font A .......................................................................................................................... 25
Figure 4-2: ASCII Font B .......................................................................................................................... 25
Figure 4-3: Simplified Chinese ................................................................................................................. 26
Figure 4-4: ASCII Font A Data .................................................................................................................. 26
Figure 4-5: Simplified Chinese Data ......................................................................................................... 26
Figure 4-6: ASCII Font A User-Define Character ...................................................................................... 27
Figure 4-7: ASCII Font B User-Define Character...................................................................................... 27
Figure 4-8: Simplified Chinese User-Define Character............................................................................. 28
Figure 4-9: Horizontal Get Data................................................................................................................ 29
Figure 4-10: Vertical Get Data .................................................................................................................. 29
Figure 4-11: EAN 8 ................................................................................................................................... 31
Figure 4-12: EAN 13................................................................................................................................. 31
Figure 4-13: Code 128 ............................................................................................................................. 31
Figure 4-14: QR Code .............................................................................................................................. 31
Figure 4-15: DIP Switch Layout ................................................................................................................ 32
Figure 4-16: LED and Button .................................................................................................................... 33
Figure 4-17: Paper Near End Sensor ....................................................................................................... 35
Figure 4-18: Black Mark Paper ................................................................................................................. 36
Figure 4-19: Auto Cutter Resume ............................................................................................................. 37
Figure 5-1: Structure of FW ...................................................................................................................... 38
Figure 5-2: Flow Chart of Main Function .................................................................................................. 41
Figure 5-3: Device Descriptor ................................................................................................................... 42
Figure 5-4: Configure Descriptor .............................................................................................................. 43
Figure 5-5: Character Process Flow ......................................................................................................... 70
Figure 5-6: CHAR_CharacterService Process Flow ................................................................................. 70
Figure 5-7: Write NV Bitmap Flow ............................................................................................................ 71
Figure 5-8: Read NV Bitmap Flow ............................................................................................................ 71
Tables
Table 1-1: FM3 Product List ....................................................................................................................... 7
Table 2-1: HW Development Environment ................................................................................................. 9
Table 2-2: Work Environment ................................................................................................................... 10
Table 3-1: System Electrical Characteristics ............................................................................................ 13
Table 3-2: UART Connection .................................................................................................................... 15
Table 3-3: CN8 Pin Assignments .............................................................................................................. 16
Table 3-4: CN4 Pin Assignments .............................................................................................................. 17
Table 3-5: CN2 Pin Assignments .............................................................................................................. 18
Table 3-6: CN6 Pin Assignments .............................................................................................................. 19
Table 3-7: CN6 Pin Assignments .............................................................................................................. 19
Table 3-8: CN6 Pin Assignments .............................................................................................................. 20
Table 4-1: Command List ......................................................................................................................... 23
Table 4-2: Character Table ....................................................................................................................... 25
Table 4-3: Bitmap Mode ........................................................................................................................... 29
Table 4-4: DIP S1 ..................................................................................................................................... 32
Table 4-5: DIP S1 ..................................................................................................................................... 32
Table 4-6: DIP S1 ..................................................................................................................................... 32
Table 4-7: DIP S1 ..................................................................................................................................... 33
Table 4-8: LED Indication ......................................................................................................................... 33
Table 5-1: Directory Description of Project ............................................................................................... 38
Table 5-2: File Description of Project ........................................................................................................ 39
Table 5-3: Character Module Overview .................................................................................................... 69
Table 5-4: Character Module Overview .................................................................................................... 79
6
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
1 Introduction
1.1 About Document
This application note describes how to operate Thermal Printer Development Kit 3Inc and how to design
thermal printer solution by FW resource and HW reference.
1.2 About Thermal Printer Development Kit 3 Inch
Thermal Printer development Kit 3Inch is about 3 inch thermal printer control solution, this solution
developed based on MB9BF316N and MB9BF516N. This solution support High-speed (150mm/s) printing,
support black mark paper, compatible with ESC/POS command, support multiple barcode, Have
independent character lib, the communication port include USB and UART.
1.3 About MB9B310/MB9B510 Series MCU
MB9B310/MB9B510 series MCU is 32-bit general purpose MCU of FM3 family that features the industry's
leading-edge ARM Cortex-M3TM CPU and integrates Fujitsu's highly reliable and high-speed secure
embedded flash technology. This MCU can operate at up to 140MHz CPU frequency and work at a wide
voltage range (2.7-5.5V), which can be both compatible with 3.3V and 5V system.
It includes a host of robust peripheral features, including motor control timers (MFT), base timer (can be
configured to PWM, PPG, Reload, PWC timer), ADCs, on-chip memory (up to 512K Flash, up to 64K SRAM)
and a wide range of communication interfaces (USB, I2C, SIO, LIN, CAN).
The size of on-chip memory can be configured according to different part number and the package is
available in LQFP and BGA, as shown in Table 1-1.
Table 1-1: FM3 Product List
Product
Flash
Package
512kB+32kB
64kB
NA: LQFP-100/BGA-112
MB9BF516N
512kB+32kB
64kB
NA: LQFP-100/BGA-112
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
SRAM
MB9BF316N
7
U S E R
M A N U A L
2 System Overview
This system adopts Spansion FM3 MCU MB9B316N; the printer is JX-3R-021AP, with the max printing
speed design to 150mm/s. The solution supports USB and UART printing and the printer supports is
ESC/POS command. Corresponding drivers should be installed on the PC. The system architecture is
shown in the following figure:
Figure 2-1: System Architecture
ESC/POS Commands
SW
USB Printer Class Driver
UART
UART I/F
USB I/F
HW
UART Module
UART Process
Printer
LED, Beep, Key
Flash
FW
8
CONFIDENTIAL
USB Module
SPI
GPIO
USB Process
ESC/POS
Character
Interface
Data and Information
Process
Printer Control
Barcode
Printer I/F
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Figure 2-2: Printer Control Board
2.1 Development and Work Environment
2.1.1 Development Environment
Table 2-1: HW Development Environment
Item
OS
Description
Windows 7 Enterprise SP1 64-bit
Cadence
Development Tool
IAR 6.5
Visual Studio 2013
J-link
Development Accessories
USBA-USBB line
USBA-UART line
AC-DC Power supply
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
9
U S E R
M A N U A L
2.1.2 Work Environment
Table 2-2: Work Environment
Item
Supply Voltage
DC 24V ± 2.4V
Current
Max 2A
Temperature
Humidity
10
CONFIDENTIAL
Description
Storage: -40°C ~ 80°C
Working: 0°C ~ 55°C
10% ~ 70%
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
3 Hardware Introduction
3.1 Hardware Overview
The Spansion Thermal printer development is intended to aid the user in the rapid evaluation and
development of thermal printer applications using Spansion MB9BF316N Serial MCU which are embedded
with ARM Cotex-M3 core. This development Board is targeted to control the thermal printer head.
The development board provides USB, SWD, and UART interfaces. It supports JX-3R-021 printer head,
supports ASCII print, Chinese print, Bitmap print and GUI for command input.
Figure 3-1: Thermal Printer Development Board
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
11
U S E R
M A N U A L
3.1.1 Features
The features of the development board include:

Voltage range: 24±10%(DCV);

Provide basic input/output (2 Keys, 6 LEDs, 8-way toggle switch);

Provide multiple interfaces (1 UART, 1 SWD, 1 USB);

Provide status check function, just as black label, rubber roller ready, without paper and over
temperature etc.;

Provide a stepping motor driver for printing and feeding paper;

Provide a DC motor driver for automatic paper cutting function;

Printing precision: 8dots/mm;

Support serial communication interface (TTL);

Maximum print speed is 150mm/s based on the printing voltage;

Support bar code print, picture print, Chinese print (24*24, GB2312), ASCII print (12*24) and
ESC/POS control command;
3.1.2 System Block Diagram
The system block diagram is as follows.
Figure 3-2: System Block Diagram
SWD
DB9
UART
RS232
USB
Beep Output
Drive Output
Driver
DRV8811
Drive Pulse
Drive Output
BD6232
HFP
Drive Pulse
State Display
Key Input
Toggle Switch
MB9BF316N
/LAT
NOR
FLASH
SPI
TM
JX-3R-02
1AP
I/F
/STR1
STR2
EXT
SRAM
BUS
CLK
SI
RST
SW1
Out of Paper
Black Laber
12
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
3.2 Power Supply
There are two power ICs in this system.
24V to 5V DC/DC converter supports the 5V power source for print head logic power.
5V to 3.3V LDO converter supports the 3.3V power source for MCU of MB9BF316N, stepper motor driver IC,
DC motor driver IC, Nor flash, SRAM etc.
Following chapters show these conversions.
3.2.1 24V to 5V
Figure 3-3: Schematic for 24V to 5V
By setting the feedback resistor R1 and R7 to get different output voltage according to the following formula:
Vout = 0.8* (1 + (R1/ R7))
3.2.2 5V to 3.3V
Figure 3-4: Schematic for 5V to 3.3V
As a result of constant voltage output of the power IC, so there is no need to set the feedback resistor.
The system electrical characteristics are as below:
Table 3-1: System Electrical Characteristics
Item
Condition
Supply Power Voltage
Working Current
Min
21.6
Printing ratio of 20%,
printing is 150mm/s
Standby Current
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Rated Value
Type
24
Max
Units
26.4
V
--
2.09
--
A
--
0.3
--
A
13
U S E R
M A N U A L
3.3 Connectors
3.3.1 USB Connector
This board uses the USB type B as the USB interface, the detail as below:

USB Power Supply: 3.3V, 100mA

USB Standard: 2.0

USB Port: Type B

Quantity: 1
Figure 3-5: USB Connector
Figure 3-6: USB Connector Schema
3.3.2 UART Connector
The UART interface is the DB9/M, the UART Handshaking adopts RTS/CTS, and the baud rate is
configurable by DIP, as below:

Connect Port: EIA-RS-232

UART Port: DB9/M

Quantity: 1
Figure 3-7: UART Connector
14
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Figure 3-8: UART Connector Schema
The UART connection with user side as below:
Table 3-2: UART Connection
Board side
Pin No
Signal Name
Signal Name
Pin No
1
NC
DCD
1
2
RxD
RxD
2
3
TxD
TxD
3
4
DTR
DTR
4
5
SG
SG
5
6
DSR
DSR
6
7
RTS
RTS
7
8
CTS
CTS
8
9
NC
RI
9
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
User side
15
U S E R
M A N U A L
3.3.1 Power Connector
Two power interfaces (CN7 and CN8) are provided in this board.
Figure 3-9: CN8 Connector
3.96mm
Table 3-3: CN8 Pin Assignments
Pin Number
Signal Name
1
GND
2
+24V DC
3
+24V DC
4
GND
CN7 Power Port: DC005-F, 5.5mm * 2.1mm
Figure 3-10: CN7 Connector
CN7
16
CONFIDENTIAL
GND
+24V DC
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
3.3.1 Print Head Connector
2 FFC connect cable are required to connect the print head and the control board. One connector connects
the motor drive, and the other connector connects the sensor and controls the signal. The description of the
connectors is as below:
Sensor and control signal connector:
Figure 3-11: CN4 Connector
CN4
Table 3-4: CN4 Pin Assignments
No.
Signal Name
1
COM
Head drive power
2
COM
Head drive power
3
COM
Head drive power
4
NC
Non-contact
5
LAT
Data latch
6
NC
Non-contact
7
GND
Head ground
8
GND
Head ground
9
GND
Head ground
10
TM
Thermistor
11
STR1
Strobe 1
12
VDD
Logic power
13
STR2
Strobe 2
14
GND
Head ground
15
GND
Head ground
16
GND
Head ground
17
CLOCK
Clock
18
SI
Data in
19
COM
Head drive power
20
COM
Head drive power
21
COM
Head drive power
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Description
17
U S E R
M A N U A L
Motor drive connector:
Figure 3-12: CN2 Connector
CN2
Table 3-5: CN2 Pin Assignments
No.
Signal Name
Description
1
Paper feed motor phase /A
Excitation signal /A
2
Paper feed motor phase B
Excitation signal A
3
Paper feed motor phase A
Excitation signal A
4
Paper feed motor phase /B
Excitation signal /B
5
Auto cutter motor (+)
Excitation signal (+)
6
Auto cutter motor (−)
Excitation signal (+)
7
GND
Head ground
8
GND
Head ground
The cutter reset signal is generated by
9
recognizing both edges for rising and falling
Auto cutter reset
edge of the rectified reset signal from the auto
cutter.
10
GND
Head ground
11
Paper-end sensor output
A photosensor is used to detect paper-end.
12
Black mark sensor output
13
VDD(+5V)
14
Platen open SW2
15
Platen open SW1
A photosensor is used to detect a black mark in
the path near the thermal head.
Logic power
A sensor is used to detect whether the platen is
loaded or unloaded.
A sensor is used to detect whether the platen is
loaded or unloaded.
FFC cable connects the print head and control board, the FFC standard as below:
Figure 3-13: FFC Cable
18
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
3.3.1 Debug Port and Expand Connector
CN6 is use to connect the debugger J-Link and board, as below:
Figure 3-14: CN6 Connector
2.54mm
CN6
4
3
2
1
Table 3-6: CN6 Pin Assignments
Pin Number
Signal Name
1
VCC
2
SWD IO
3
SWD CLK
4
GND
CN9 is the expansion front board connector
Figure 3-15: CN9 Connector
2.54mm
CN9
1
2
3
4
5
6
Table 3-7: CN6 Pin Assignments
Pin Number
Signal Name
1
VCC
2
Power LED
3
Paper end LED
4
Error LED
5
Feed KEY
6
GND
CN10 is the paper near-end sensor expands port.
Figure 3-16: CN10 Connector
2.54mm
CN10
1
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
2
3
19
U S E R
M A N U A L
Table 3-8: CN6 Pin Assignments
Pin Number
Signal Name
1
GND
2
Paper near-end Sensor
3
VCC
3.4 Configuration
DIP switch is use to configure the communication mode, enable or disable black mark, select UART baud
rate, select print density and select print speed.
Figure 3-17: DIP Switch
S1
Jumped JMP1 to select the MCU MOD0
Figure 3-18: MOD0 JMP1
JMP1
20
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
3.5 Printing Control Circuit
DRV8811 was used as stepper motor drive. The logic pulse including the MT_A, MT_/A, MT_B, MT_/B
signals, and BD6232HFP was used as DC motor drive, the logic pulse including DC_MT+ and DC_MT-.
This connecter also includes four detective signals: the RST signal of automatic cutter, the out of paper
signal, the black label signal and the rubber roller ready signal.
Figure 3-19: Printing Control Circuit
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
21
U S E R
M A N U A L
3.6 External Storage
As a 32M Bits (2Mx16 / 4Mx8 Switchable) LOW POWER CMOS SRAM, the LY62L205016A is fabricated
using very high performance, high reliability CMOS technology. Its standby current is stable within the range
of operating temperature.
Figure 3-20: Schematic for SRAM
The S25FL032P is a 3.0 Volt (2.7V to 3.6V), single-power-supply Flash memory device. The device consists
of 64 uniform 64 KB sectors with the two (Top or Bottom) 64 KB sectors further split up into thirty-two 4KB
sub sectors. The S25FL032P device is fully backward compatible with the S25FL032A device. The device
accepts data written to SI (Serial Input) and outputs data on SO (Serial Output).
Figure 3-21: Schematic for SPI Flash
22
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4 Function
4.1 Command List
This system control command is compatible with ESC/POS command, and the command list as Table 4-1.
Table 4-1: Command List
Command
Command
Name
Classification
Executing
Horizontal tab
⃝
LF
Print and line feed
⃝
FF
Print and feed label to print starting position (*)
⃝
CR
Print and carriage return
⃝
ESC SP
Set right-side character spacing
ESC !
Select print mode(s)
ESC $
Set absolute print position
ESC %
Select/cancel user-defined character set
ESC &
Define user-defined characters
ESC ∗
Select bit-image mode
ESC -
Turn underline mode on/off
⃝
ESC 2
Select default line spacing
⃝
ESC 3
Set line spacing
⃝
ESC ?
Cancel user-defined characters
ESC @
Initialize printer
ESC D
Set horizontal tab positions
⃝
ESC E
Turn emphasized mode on/off
⃝
ESC G
Turn double-strike mode on/off
⃝
ESC J
Print and feed paper
ESC M
Select character font
ESC S
Select standard mode
ESC V
Turn 90°clockwise rotation mode on/off
ESC \
Set relative print position
ESC a
Select justification
⃝
ESC c 3
Select paper sensor(s) to output paper-end signals
⃝
ESC c 4
Select paper sensor(s) to stop printing
⃝
ESC c 5
Enable/disable panel buttons
ESC d
Print and feed n lines
ESC {
Turn upside-down printing mode on/off
FS p
Print NV bit image
FS q
Define NV bit image
GS FF
Feed marked paper to print starting position
GS !
Select character size
⃝
GS ∗
Define downloaded bit image
⃝
GS ( A
Execute test print
GS ( F
Set adjustment values(s)
⃝
GS ( K
Select print control method(s)
⃝
GS ( M
Customize printer control value(s)
GS ( k
Setup and print QR code
⃝
GS /
Print downloaded bit image
⃝
GS :
Start/end macro definition
⃝
GS B
Turn white/black reverse printing mode on/off
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Setting
HT
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
⃝
23
U S E R
M A N U A L
GS C 0
Select counter print mode
⃝
GS C 1
Select count mode (A)
⃝
GS C 2
Set counter
⃝
GS C ;
Select count mode (B)
⃝
GS E
Select head control method
⃝
GS H
Select printing position of HRI characters
GS I
Transmit printer ID
GS L
Set left margin
GS T
Set print position to the beginning of print line
⃝
GS V
Select cut mode and cut paper
⃝
GS W
Set printing area width
GS ^
Execute macro
⃝
GS c
Print counter
⃝
GS f
Select font for HRI characters
GS h
Set bar code height
GS k
Print bar code
⃝
GS r
Transmit status
⃝
GS v 0
Print raster bit image
⃝
GS w
Set bar code width
⃝
FS !
Set print mode(s) for Chinese characters
⃝
FS &
Select Chinese character mode
⃝
FS -
Turn underline mode on/off for Chinese characters
⃝
FS .
Cancel Chinese character mode
⃝
FS 2
Define user-defined Chinese characters
⃝
FS S
Set left- and right-side Chinese character spacing
⃝
FS W
Turn quadruple-size mode on/off for Chinese
characters
⃝
⃝
⃝
⃝
⃝
⃝
⃝
Notes:
⃝: Enabled.
24
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4.2 Character Printing
4.2.1 Character Lib
This system supports multiple characters, including ASCII and Simplified Chinese as shown in Table 4-2
Table 4-2: Character Table
Support Character
ASCII
Simplified Chinese
Font Style
Remark
Font A, 12 x 24
Rang: 0x20-0x7E
Font B, 9 x 17
Rang: 0x20-0x7E
SimSun, 24 x 24
GB18030-2000
Change and select ASCII character by command ESC ! and ESC M. the ASCII includes font A and font B,
the font A size is 12dots x 24 dots, storing one font A ASCII character to memory need 48 bytes; and the font
B size is 9dots x 17dots, storing one font B ASCII character to memory need 34 bytes.
Figure 4-1: ASCII Font A
Figure 4-2: ASCII Font B
1.125mm (9dots)
2.125mm (17dots)
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
25
U S E R
M A N U A L
Select the simplified Chinese by command FS & and cancel the simplified Chinese by command FS ., the
simplified Chinese font family is SimSun, the size is 24dots x 24dots, storing one simplified Chinese in
memory needs 72 bytes.
Figure 4-3: Simplified Chinese
3.0mm (24dots)
3.0mm (24dots)
ASCII and simplified Chinese bitmap data get is adopts horizontal direction, as Figure 4-4 and Figure 4-5.
Figure 4-4: ASCII Font A Data
Figure 4-5: Simplified Chinese Data
24dots
24lines
26
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
1.1.1 User-Define Characters
In order to extend and modify the character, system support User-define characters, User-define ASCII and
User-define simplified Chinese, define User-define ASCII by command ESC &, use command ESC % to
enable or disable the User-define ASCII, User-define ASCII characters is use for replace existing ASCII
characters. However, the simplified Chinese User-define are expanding the simplified Chinese, the
User-define character code rang are from 0xFEA1 to 0xFEFE, use command FS 2 to define the User-define
simplified Chinese.
The User-define data is different from existing characters; User-Define data get direction is vertical, as
shown in Figure 4-6, Figure 4-7 and Figure 4-8.
Figure 4-6: ASCII Font A User-Define Character
Figure 4-7: ASCII Font B User-Define Character
Compensation
‘0’
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
27
U S E R
M A N U A L
Figure 4-8: Simplified Chinese User-Define Character
1.1.2 Character Font Style
This system supports multiple font styles, these font styles applicable to ASCII, simplified Chinese,
User-define ASCII and User-define simplified Chinese, as below:
Font Style:

Bold, reference command ESC !, ESC E, ESC G

Underline, the underline include 1 dot underline and 2 dots underline, reference command ESC !,
ESC -, FS !, FS -

Rotate 90°Clockwise, reference command ESC V.

Upside-Down, reference command ESC {.

White/Black Reverse, reference command GS B
Font Size:
28
CONFIDENTIAL

Double Width, reference command ESC !, GS !, FS !, FS S.

Double Height, reference command ESC !, GS !, FS !, FS S.
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4.3 Bitmap Printing
This system supports multiple bitmap modes, as shown in Table 4-3
Table 4-3: Bitmap Mode
Bitmap Mode
Bit-image mode
Description
Data Mode
Specify the do density and the bitmap length
and width
NV Bitmap
Store the bitmap to external flash, and print the
bitmap from external flash.
Downloaded Bitmap
Download bitmap to internal RAM, print the
bitmap from internal RAM
Raster Bitmap
Real-time to print bitmap
Commands
Vertical get data
ESC *
Vertical get data
FS p, FS q
Vertical get data
GS *, GS /
Horizontal get data
GS v 0
Figure 4-9: Horizontal Get Data
d1
d2
d3
…………….
dn
dn+1
Figure 4-10: Vertical Get Data
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
29
U S E R
M A N U A L
dn+1
d1
d2
d3
…………….
dn
Bitmap Format:
30
CONFIDENTIAL

Double Width

Double Height

Upside-Down
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4.4 Barcode Printing
This system supports printing 4 barcode, EAN 8, EAN 13, Code 128 and QR code
Print EAN 8 barcode by GS k.
Figure 4-11: EAN 8
Print EAN 13 barcode by GS k.
Figure 4-12: EAN 13
Print Code 128 barcode by GS k.
Figure 4-13: Code 128
The QR code max size is 250dots x 250dots in this system, so the QR code support version lower than
version 20, print EAN 13 barcode by command GS ( k.
Figure 4-14: QR Code
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
31
U S E R
M A N U A L
4.5 Interface Introduction
4.5.1 DIP Switch
Configure system mode and function by DIP switch S1, as shown in Figure 4-15
Figure 4-15: DIP Switch Layout
S1
DIP Switch configuration description:
Table 4-4: DIP S1
S1 No.
Description
ON
OFF
Default
1
Communication Selection
UART
USB
OFF
2
BM Sensor
Enable
Disable
OFF
3
Serial interface baud rate
Refer to Table 4-5
OFF
4
selection
5
Print density selection
Refer to Table 4-6
Printing selection
Refer to Table 4-7
OFF
6
OFF
OFF
7
8
OFF
OFF
Baud rate configuration:
Table 4-5: DIP S1
Baud rate (bps)
Switch Number
3
4
115200
OFF
OFF
38400
OFF
ON
19200
ON
OFF
9600
ON
ON
Print Density configuration:
Table 4-6: DIP S1
Print Density
32
CONFIDENTIAL
Switch Number
5
6
Normal
OFF
OFF
Dark
OFF
ON
Slightly dark
ON
OFF
Slightly Light
ON
ON
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Print Speed configuration:
Table 4-7: DIP S1
Switch Number
Print Speed(mm/s)
7
8
150
OFF
OFF
100
OFF
ON
50
ON
OFF
Reserved
ON
ON
4.5.2 LED and Button
This system has 6 LEDs and 2 buttons. LED description is as shown in Table 4-8
Figure 4-16: LED and Button
LED Indication:
Table 4-8: LED Indication
LED Indicators
Mark
Color
Status
OFF
ON
Power LED
D2, D9
Green
Power OFF
Power ON
Paper End LED
D6, D7
Red
Paper loaded
Paper end or near end
Error LED
D5, D8
Red
Normal
Error status, refer to 0
Buttons Function:

When the BM (black mark) sensor is disabled, the printer feeds paper one line, based on the line
spacing set by ESC 2 and ESC 3. When the BM sensor is enabled, the printer will feed paper by mark
paper unit. Feeding paper using the paper FEED button cannot be performed under the following
conditions:
a)
The panel buttons are disabled by ESC c 5.
b)
The paper roll end sensor detects a paper end.
c)
The platen cover is open.

If you press this button when the printer is in the macro execution standby state, the defined macro is
executed.

During self-test printing, you can stop the self-test temporarily by pressing this button and restart it by
pressing the button again.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
33
U S E R
M A N U A L
4.6 Self-Test Introduction
Self-test include startup mode and command mode, command mode refers to command GS ( A, and the
startup mode is as below:
1.
The printer has a self-test function that checks the following:


2.
Status Printing
1)
Firmware version
2)
USB interface status
3)
UART interface status
4)
Buffer capacity
5)
DIP switch settings
6)
Logo printing
7)
Barcode printing
Character Printing
Starting the self-test
To start the self-test on a paper roll, Power on or reset, and hold down the FEED button then turn on the
printer. Then the current printer status is printed.
3.
Self-test standby state
After printing the current printer status, the printer prints the message "Self-test printing. Please press FEED
button”. Press the FEED button to start the rolling character printing.
4.
Ending the self-test
After a number of lines are printed, the printer indicates the end of the self-test by printing "### completed
###," initializes, and goes into the standard mode.
34
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4.7 Sensor Check
4.7.1 Paper Sensors
The printer has 2 paper sensors as follows:
1.
Paper roll end sensor
The sensor detects whether paper is present or not.
When the sensor detects a paper-end, the printer stops printing.
2.
Paper roll near-end sensor
The sensor detects a near-end of a paper roll.
When the paper roll diameter becomes sufficiently small, the sensor detects a near-end of the paper roll and
the PAPER OUT LED indicator lights. If the sensor is enabled by ESC c 4, the printer stops printing.
NOTES:

After installing new paper roll, close the platen cover; then the printer resumes printing.

The near-end sensor will be provided by user.
Figure 4-17: Paper Near End Sensor
4.7.2 Platen Open Sensor
The platen open sensor monitors the open/close status of the platen cover which covers the paper feeding
rubber rollers. When the sensor detects a platen open while the printer is in the standby status, the printer
goes offline. The printer recovers when the platen is closed.
4.7.3 Head Temperature Sensor
The temperature sensor is a thermistor, whose resistance value increases with the rise of the temperature. It
samples the voltage to calculate the temperature, whose threshold is 65°C. When the temperature is over
the threshold temperature, the printer stops to save the print head and the printer does not resume working
until the temperature decreases to 45°C.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
35
U S E R
M A N U A L
4.8 Black Mark Function
The black mark sensor must be installed in either of the following-back of the paper. The standard position of
the black mark is on the right side on back of the paper, enter to Black Mark mode need setting DIP Switch
before system startup, more detail please refer to 4.5.1. The Black Mark mode operate unit is the Black Mark
Paper Unit, not a line, feed paper and print every operation is a Black Mark Paper Unit.
Figure 4-18: Black Mark Paper
Black Mark
Black Mark
Paper Unit
36
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
4.9 Error Processing
1.
Automatically Recover Errors

2.
Print head high temperature error: When the temperature of the print head exceeds 65°C, the error
occurs and all operations will be stopped. At the same time, the status becomes BUSY and the Error
LED blinks.
Possibility of Recovery Errors

Platen open error: Printing is not performed for the platen is open, when the error occurs, all printer
operations will be stopped. At the same time, the status becomes BUSY and the ERROR LED blinks.

Auto cutter error: The auto cutter does not work properly. When the error occurs, all printer
operations will be stopped. At the same time, the ERROR LED blinks.
Turn down the black gear to repair the auto cutter, and then reset the system to resume. After the
system is reset, if the ERROR LED blinks, please turn down the black gear and reset the system until
auto cutter resumes working.
Figure 4-19: Auto Cutter Resume
Turn Down

3.
BM sensor detection error: No black mark is detected even though the paper roll is marked correctly,
when the error occurs, all printer operations will be stopped. At the same time, the status becomes
BUSY and the ERROR LED blinks.
Impossible to Recover Errors

CPU execution error: The CPU executes an incorrect address or I/F board is not connected, when
the error occurs, all printer operations will be stopped. At the same time, the status becomes BUSY
and the ERROR LED blinks.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
37
U S E R
M A N U A L
5 Firmware W Introduction
5.1 Firmware Overview
There are 6 folders in the FW structure of IAR, which is shown in Figure 5-1 and Table 5-1.
Figure 5-1: Structure of FW
Table 5-1: Directory Description of Project
Folder
app
common
38
CONFIDENTIAL
Description
It includes escpos, fontlib, printhead, communication,
dataprocess and qrcode and barcode module
It includes system file and global macro define, register define
and FM3 system initialization functions
driver
It includes FM3 MCU peripheral driver library
interrupt
It includes interrupt handle and copy back function
tpdk project
It includes IAR project file and system main function
readme.txt
It records the version log and upgrade information of firmware
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
The detailed file description is shown in Table 5-2:
Table 5-2: File Description of Project
Folder
app\Code128
File
Description
Mark
Code128.c
Barcode Code128 encode
N/A
Code128.h
EAN8.c
app\EAN8
EAN8.h
dataprocess.c
dataprocess.h
escpos.c
escpos.h
fifo.c
app\escpos
fifo.h
Include Barcode EAN8 and EAN13 encode
functions and global variables
analysis printer data and page info data process
Include data process functions and global
variables
Analysis the printer data base on ESC/POS
standard
Include ESC/POS analysis functions and global
variables
Definition and operation for buffer
Include buffer control functions and global
variables
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
define logo data for test print
N/A
Include definition for logo data
N/A
statuscheck.c
Definition and operation for printer status
N/A
Include status check functions and global
variables
N/A
task.c
Definition and operation for task FIFO
N/A
task.h
Include task functions and global variables
N/A
ascii1224.c
ASCII font library
N/A
ascii1224.h
Include ASCII font library global variable
N/A
character.c
character and bitmap function
N/A
chinese_songti2424.c
chinese_songti2424.h
csio_int_s25fl127s.c
csio_int_s25fl127s.h
Style_convert.c
Style_convert.h
adc.c
adc.h
dt.c
dt.h
frt.c
frt.h
misc.c
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Barcode EAN8 and EAN13 encode
N/A
logodata.h
character.h
app\misc
global variables
logodata.c
statuscheck.h
app\fontlib
Include Barcode Code128 encode functions and
Include character and bitmap function and global
variables
Definition font of Chinese character for test
Include Chinese character font library global
variable
Provides basic operation APIs to access to
S25FL127S
Include character and bitmap function and global
variables
convert the style for font library
Include convert the style function and global
variables
Initial and operate ADC
Include Initial and operate ADC functions, and
global variable
define and operation timer
Include operation timer functions, and global
variable
define and operation timer
Include operation timer functions, and global
variable
Include LED, beep, key operations and
configuration.
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
39
U S E R
misc.h
pwm.c
pwm.h
and global variable
definition and operation for PWM module
Include operations for PWM functions and global
variable
System interrupt handle functions
N/A
printheaddriver.h
printheadpin.h
Initial and operate CSIO functions, and global
variable.
Include
CSIO
operations
and
configuration
functions and global variable.
Initial and operate print head functions, and
global variable.
Include print head operations and configuration
functions and global variable.
Initial and operate print head pin functions, and
global variable.
Include print head pin operations and
configuration functions and global variable.
N/A
N/A
N/A
N/A
N/A
N/A
GenericGF.h
N/A
Qrcode.c
N/A
uart.c
uart.h
UsbConfig.c
UsbConfig.h
UsbDevicePrinter.c
UsbDevicePrinter.h
CONFIDENTIAL
N/A
GenericGF.c
Qrcode.h
40
N/A
sys_if.h
printheadpin.c
app\usb
N/A
N/A
printheaddriver.c
app\uart
N/A
System interrupt handle
printheadcsio.h
app\QRcode
Include operations and configuration functions
sys_if.c
printheadcsio.c
app\printheader
M A N U A L
common
System_mb9xfxxx.s
driver
Slide over
N/A
Definition and operation for UART module
Include Definition and operation for UART
module functions and global variable
Initial USB module and switch USB status
Include Initial USB module and switch status
functions and global variable
Read and write operation via USB printer device
Include operation via USB printer device
functions and global variable
system initialization functions
Slide over it, please take details in document of
FM3 PDL
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Main routine of the thermal printer development FW is as shown in Figure 5-2:
Figure 5-2: Flow Chart of Main Function
Start
System initial
Buffer initial
Communication initial
Print head Initial
Soft watchdog initial
Test print handle
Initial
Feed dog handle
Printer status handle
Feed key handle
Data process handle
execute task
Kick start task
Kick start task handle
Abnormal status event
Main loop
Interrupt
FM3 Driver Library
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
41
U S E R
M A N U A L
5.2 Communication
5.2.1 USB Serial Interface
Specifications:
General specifications: USB 2.0 Full-speed mode (12Mbps)
Communication method: USB bulk transfer
Power: USB self-powered function device
USB packet size:
USB bulk OUT 64Byte
USB bulk IN 64Byte
USB device class: USB printer class
USB descriptor:
Vendor ID:
Product ID:
Interface description:
The USB device is described as a standard USB Printer device in the TPDK project. The hot plug function is
supported, the enumeration process starts after the USB cable is plugged in or powered on. The printer data
can be sending to printer device when enumeration process is completed correctly.
Figure 5-3: Device Descriptor
const uint8_t au8DeviceDescriptor[18] =
{
///DEVICE DESCRIPTOR
0x12,
///bLength: Length of this descriptor
0x01,
///bDescriptorType: Device Descriptor Type
0x00,
///bcdUSB: USB Version
0x02,
///bcdUSB: USB Version
0x00,
///bDeviceClass: Class Code: MISCELLANEOUS
0x00,
///bDeviceSubClass: Sub Class Code
0x00,
///bDeviceProtocol: Protocol Code
0x40,
///bMaxPacketSize0: Maximum size of endpoint 0
0xb8,//0x6A,
///idVendor: Vendor ID
0x04,//0x1A,
///idVendor: Vendor ID
0x05,
///idProduct: Product ID
0x0e,
///idProduct: Product ID
0x00,
///bcdDevice: Release Number
0x00,
///bcdDevice: Release Number
0x01,
///iManufacture: String-Index of Manufacture
0x02,
///iProduct: String-Index of Product
0x03,
///iSerialNumber: String-Index of Serial Number
0x01
///bNumConfigurations: Number of possible configurations
};
42
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Figure 5-4: Configure Descriptor
const uint8_t au8ConfigDescriptor[84] =
{
///NEW CONFIG DESCRIPTOR(1)
0x09,
///bLength: Length of this descriptor
0x02,
///bDescriptorType: Config Descriptor Type
0x20,0x00,//0x54, 0x00,
0x01,//0x03,
///wTotalLength: Total Length with all interface- and endpoint descriptors
///bNumInterfaces: Number of interfaces
0x01,
///iConfigurationValue: Number of this configuration
0x00,
///iConfiguration: String index of this configuration
0xa0,//0xC0,
///bmAttributes: Bus-Powered, Remote-Wakeup not supported
0x32,//0xFA,
///MaxPower: (in 2mA)
///NEW INTERFACE DESCRIPTOR(0)
0x09,
///bLength: Length of this descriptor
0x04,
///bDescriptorType: Interface Descriptor Type
0x00,
///bInterfaceNumber: Interface Number
0x00,
///bAlternateSetting: Alternate setting for this interface
0x02,
///bNumEndpoints: Number of endpoints in this interface excluding endpoint 0
0x07,
///iInterfaceClass: Class Code: PRINTER
0x01,
///iInterfaceSubClass: SubClass Code
0x02,
///bInterfaceProtocol: Protocol Code
0x00,
///iInterface: String index
///NEW ENDPOINT DESCRIPTOR(1)
0x07,
///bLength: Length of this descriptor
0x05,
///bDescriptorType: Endpoint Descriptor Type
0x81,
///bEndpointAddress: Endpoint address (IN,EP1)
0x02,
///bmAttributes: Transfer Type: BULK_TRANSFER
0x40,
///wMaxPacketSize: Endpoint Size
0x00,
///wMaxPacketSize: Endpoint Size
0x00,
///bIntervall: Polling Intervall
///NEW ENDPOINT DESCRIPTOR(0)
0x07,
///bLength: Length of this descriptor
0x05,
///bDescriptorType: Endpoint Descriptor Type
0x02,
///bEndpointAddress: Endpoint address (OUT,EP2)
0x02,
///bmAttributes: Transfer Type: BULK_TRANSFER
0x40,
///wMaxPacketSize: Endpoint Size
0x00,
///wMaxPacketSize: Endpoint Size
0x00,
///bIntervall: Polling Intervall
};
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
43
U S E R
M A N U A L
API Definition
Name
UsbConfig_UsbInit
Parameter
None
Return
None
Description:
This function Initializes USB functions for USB printer device, which triggers the enumeration process. It
should be called at system initialization after receive buffer is initialized.
Name
Usb_PrinterReceive
pstcEpHandle: Pointer to instance of endpoint
Parameter
pu8Data: Pointer to data buffer
pu16ByteCount: The length of data which should be received
bClearDrq: If need clear DRQ flag.
ok: Receive data successful
Return
ErrorOperationInProgress: Device is in offline mode or receive
buffer full
Description:
This function receives data from USB endpoint FIFO and saves the data to the receive buffer. Need to notice
that, this function is called from interrupt process in the project.
The parameter pstcEpHandle is pointed to the instance of endpoint which should receive data. It must be
endpoint 2 in the TPDK project.
Name
UsbDevice_ReceiveData
pstcUsb: Pointer to USB instance
pstcEndpoint: Pointer to endpoint instance
Parameter
pu8Buffer: Pointer to data buffer
u32DataSize: The Size of data to be received.
enMode: Send data mode
Return
Description:
This function Initiate receiving data (OUT direction).
The Parameter enMode define the data send mode (polled, irq driven or dma driven, the dma mode is not
support in the project).
Name
UsbDevice_SendData
pstcUsb: Pointer to USB instance
pstcEndpoint: Pointer to endpoint instance
Parameter
pu8Buffer: Pointer to data buffer
u32DataSize: The Size of data to be received
enMode: Send data mode
Return
44
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Description:
This function Initiate sending data (IN direction)
The Parameter enMode define the data send mode how to send (polled, irq driven or dma driven, the dma
mode is not support in the project).
Name
SetEPNS_DRQIE
Parameter
None
Return
None
Description:
The function restored the USB communication in the project. It will be called when printer device quits the
offline mode or the receive buffer has enough space to store the data.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
45
U S E R
M A N U A L
5.2.2 RS-232 Serial Interface
Specifications:
Transmission mode: Asynchronous
Handshaking: CTS/RTS
Transmission speed: 9600, 19200, 38400, 115200(bps)
Bit length: 8 bit
Parity Settings: NONE
Stop bit: 1 bit
Interface description:
Name
Parameter
Return
MFS_UartInitial
u8Ch: The channel of UART which should initialed
pstcRecBuf: Pointer to the receive data buffer
None
Description:
This function Initializes UART functions for printer device. It should be called at system initialization after
receive buffer is initialized.
Name
MFS_UartPollTx
u8Ch: The channel of UART which should initialed
Parameter
pu8Data: Pointer to the data buffer with send data
u16Size: Send data size
Return
None
Description:
This function Initializes UART functions for printer device. It should be called at system initialization after
receive buffer is initialized.
Name
Mfs0RxIrqHandler
Parameter
None
Return
None
Description:
This function stores the UART data into the receive buffer. If receive buffer has enough space and the printer
device is not in offline mode, the data will be received successfully. Otherwise the UART interrupt request
will be disabled until the communication module recovers.
46
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.3 ESC/POS Module
5.3.1 Status Check
Name
Sc_PrintHeadStartUp
Parameter
None
Return
None
Description:
Initialize sensor.
Name
Sc_StatusCheck
Parameter
None
Return
None
Description:
Check printer current status and recover printer operation
5.3.2 FIFO
Name
FIFO_Create
Parameter
u16Size :buffer size
Return
None
Description:
Create FIFO buffer.
Name
FIFO_Free
Parameter
pstcFifoBuf :Pointer to FIFO buffer
Return
None
Description:
Free FIFO.
Name
FIFO_Empty
Parameter
pstcFifoBuf :Pointer to FIFO buffer
Return
None
Description:
Empty FIFO
Name
Parameter
Return
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
FIFO_Write
pstcFifoBuf :Pointer to FIFO buffer
u8char:To be written
TRUE: write succeeded
FALSE: fail to write
47
U S E R
M A N U A L
Description:
Write data to FIFO buffer
Name
Parameter
Return
FIFO_Read
pstcFifoBuf : Pointer to FIFO buffer
u8char:To be read
TRUE: Read succeeded
FALSE: fail to read
Description:
Read data to FIFO buffer.
Name
Parameter
Return
FIFO_Read_NByte
pstcFifoBuf : Pointer to FIFO buffer
u16Num : how many data to read
TRUE: Setting succeeded success to set
FALSE: fail to set
Description:
Set FIFO out index.
Name
Parameter
Return
FIFO_ReadOnly
pstcFifoBuf : Pointer to FIFO buffer
u16Offset: position for Read
None
Description:
Read data from FIFO without changing the data index for FIFO.
Name
Parameter
Return
FIFO_WriteOnly
pstcFifoBuf : Pointer to FIFO buffer
u16Offset: position for writing
None
Description:
Write data from FIFO without changing the data index for FIFO.
Name
FIFO_CancelReadByte
Parameter
pstcFifoBuf : Pointer to FIFO buffer
Return
None
Description:
Cancel reading byte
48
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
FIFO_GetFreeSpaceSize
Parameter
pstcFifoBuf : Pointer to FIFO buffer
Return
free space size
Description:
Get free space size of FIFO buffer.
Name
FIFO_GetOutIndex
Parameter
pstcFifoBuf : Pointer to FIFO buffer
Return
Out index
Description:
Get out index of FIFO buffer
Name
FIFO_GetBufferSize
Parameter
pstcFifoBuf : Pointer to FIFO buffer
Return
total space size of FIFO buffer
Description:
Get total space size of FIFO buffer.
Name
Parameter
Return
FIFO_Release
pstcFifoBuf : Pointer to FIFO buffer
uint16_t: release count
TRUE: Releasing succeeded
FALSE: fail to release
Description:
Release FIFO buffer.
Name
Pwm_StartSoft
Parameter
u8Ch:Requested channel
Return
None
Description:
Start PWM
Name
Pwm_Stop
Parameter
u8Ch:Requested channel
Return
None
Description:
Stop PWM.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
49
U S E R
Name
Parameter
Return
M A N U A L
Pwm_WriteCycleVal
u8Ch: requested channel
u16Cycle: cycle value
None
Description:
Write cycle value of PWM
Name
Parameter
Return
Pwm_WriteDutyVal
u8Ch: requested channel
u16Duty: duty value
None
Description:
Write duty value of PWM.
Name
Pwm_ReadCurCnt
Parameter
u8Ch: requested channel
Return
count value
Description:
Read current count value of PWM timer.
50
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.3.3 Task
Name
Task_FifoFull
Parameter
None
Return
1: FIFO is full
0: FIFO is not full
Description:
Verify whether task FIFO status is full.
Name
Task_FifoEmpty
Parameter
None
Return
1: FIFO is EMPTY
0: FIFO is not EMPTY
Description:
Empty task FIFO.
Name
Task_Init
Parameter
None
Return
1: Initializing succeeded
Description:
Initialize task FIFO.
Name
Parameter
Return
Task_Add
unTaskParam : task parameters
pfnTask : Pointer to task function
TRUE: Adding succeeded
FALSE: Fail to add
Description:
Add task to task fifo list.
Name
Task_Start
Parameter
None
Return
RUE: Starting succeeded
FALSE: Fail to start
Description:
Start task.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
51
U S E R
Name
Task_Delete
Parameter
None
Return
M A N U A L
TRUE: Deleting succeeded
FALSE: fail to delete
Description:
Delete current task.
Name
Task_DeleteAll
Parameter
None
Return
None
Description:
Delete all tasks.
Name
Task_GetStatus
Parameter
None
Return
task status
Description:
Get task status.
Name
Task_SetStatus
Parameter
u8Status:task status
Return
None
Description:
Set task status
Name
Task_GetCurrent
Parameter
None
Return
NULL: No task in fifo
other: pointer of current task
Description:
Get current task pointer.
Name
Task_GetCurTaskType
Parameter
None
Return
task number
Description:
Get current task type
52
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Task_SetCurTaskFeedLines
Parameter
u16FeedLine: feed lines
Return
None
Description:
Set current task-- phase or index.
Name
Task_SetCurTaskPrintBuf
Parameter
u16OutIndex: task FIFO out pointer index
Return
None
Description:
Set current task-- print buffer index.
Name
Task_GetNextTaskType
Parameter
None
Return
task number
Description:
Get next task type.
Name
Task_GetNextTaskSpeedMode
Parameter
None
Return
next print or feed task speed mode
Description:
Get next print or feed task speed mode.
Name
KickStartTask
Parameter
None
Return
None
Description:
Kick Start the task if needed
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
53
U S E R
M A N U A L
5.3.4 ESC/POS
ESC/POS module in the TPDK project supports part of ESC/POS standard commands.
Name
EscposAnalysis
Parameter
u8EscCmd: The first data in receive buffer
SUCCEED: Analysis and execute successfully
Return
UNDONE: Data not enough in receive buffer
FAILED: Analysis failed
Description:
This function analyses the data in receive buffer. The function is called when the first data is not in ascii and
character range in data process. It is the main function of ESC POS module in the project.
Name
Parameter
Return
WaitRevBuf
u16Width: The width of bitmap data (in byte)
u16High:
0x00:
The height of bitmap data (in bit)
Receive data successfully
0xFF: Can’t receive enough data in time, failed
Description:
This function wait the data is enough in receive buffer. It must be called before reading some data from
buffer.
Name
Parameter
Return
WaitPrintAndTaskBuf
u16Width: The width of data length(in byte)
u16High: The height of data length(in bit)
0x00: Wait enough space successfully
0xFF: Can’t receive enough data in time
Description:
This function waits for enough space in print buffer and one space in task FIFO. It must be called before
writing a manageable number of data in print buffer or before writing a task in to task FIFO.
54
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.4 Data Process
5.4.1 Data analysis
Name
BufDataProcess
Parameter
None
Return
None
Description:
This function analyses the data in the receive buffer.
Name
BufDataProcessMain
Parameter
None
Return
None
Description:
This function is the main process in data process. It will switch to execute macro command or analyses
received data in receive buffer.
Name
DataProcessIni
Parameter
None
Return
None
Description:
These functions initial the data process and ESC/POS processing.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
55
U S E R
M A N U A L
5.4.2 Page data process
Name
PrintCount
u16Counter: The number printed
Parameter
u16PosX: The position of the number printed in X direction
u16PosY: The position of the number printed in Y direction
Return
None
Description:
This function is for printing a number.
The Parameter u16Counter is the number printed.
The Parameter u16PosY is the position of the number printed in Y direction, now this parameter does not
take effect because the page mode is not supported.
Name
PutFontToBuf
u16CurPos: The position of the font print
Parameter
characteroutput: Store the font information and the font bit map
data
Return
None
Description:
This function should put a font data into print buffer in the relevant position.
Name
Parameter
Return
FillCharLine
u16FillPos: The fill start position(in bit)
u16FillLen: Fill length(in bit)
None
Description:
This function fills the print buffer with data 0 in relevant position.
Name
JustificationPro
Parameter
u16Height: The height of character which should be printed
Return
None
Description:
This function determines the font data that should be printed in the print buffer.
Name
AddUnderLine
u16StartPos: The start position
Parameter
u16Lenth: Underline length(in bit)
u8Thick: The thick of underline
characteroutput: The font information which is least used recently
Return
56
CONFIDENTIAL
None
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Description:
This function adds underline in relevant position.
Name
ReverseData
u16StartPos: The start position
Parameter
u16Lenth: The reverse length(in bit)
characteroutput: The font information which is least used recently
Return
None
Description:
This function reverses the data in the print buffer which will be printed.
Name
PrintString
u8String: pointer to the string
Parameter
u16Len: The length of the string
u16Position: The position of the string printed
Return
None
Description:
This function will print a string.
Name
Parameter
Return
ClrCharLine
u8Height: The height of the character line
u16Width: The width of the character line.
None
Description:
This function will clear the one character line in print buffer.
5.4.3 Create task
Name
CreateIniPrinterTask
Parameter
None
Return
None
Description:
This function creates an initial printer task.
Name
CreateCutTask
Parameter
None
Return
None
Description:
This function creates a cut paper task.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
57
U S E R
Name
M A N U A L
CreatFeedNLineTask
u16LineCnt: The length of the paper feed
u8BMEn: The BM mode enable flag
Parameter
u8BMStopEn: Indicate whether need to stopping feeding paper
when detected black mark
u8Dir: The direction of paper feed
Return
None
Description:
This function creates a feed paper task.
Name
CreatPrintLineTask
u16LineNum: The print length in bit of this task
Parameter
u16leftMargin: The left margin of the print task
u16RightMargin: The right margin of the print task
Return
None
Description:
This function creates a print task.
5.4.4 Other
Name
RecoverCommFunc
Parameter
None
Return
None
Description:
This function recovers the communication function after the communication is disabled when receive buffer
is full or device enter the offline mode.
Name
ClrOfflineMode
Parameter
None
Return
None
Description:
This function clears the offline mode of system status.
Name
ReadDIP
Parameter
None
Return
None
Description:
This function reads the status of DIP and stores it in relevant variable.
58
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
DP_StartTestPrinting
Parameter
None
Return
None
Description:
This function starts the test print.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
59
U S E R
M A N U A L
5.5 Print Header
5.5.1 Print Header Driver
Name
Phd_SetAutoFeedAttribute
Parameter
stcAutoFeedAttribute: auto feed attribute
Return
None
Description:
This function sets auto feed attribute.
Name
Phd_SetSensorConfigure
Parameter
unSensorConfig: sensor configure parameters
Return
None
Description:
This function sets sensor parameters.
Name
Phd_PrintDriverInit
Parameter
None
Return
None
Description:
This function initializes print head.
Name
Phd_StepNextpixel
Parameter
None
Return
0: No phase
Other: step next phase
Description:
This function switches next motor phase.
Name
Phd_GetMotorPhases
Parameter
None
Return
phases number
Description:
This function gets motor phases.
60
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Phd_ResetPrintControlParam
Parameter
None
Return
None
Description:
This function resets control parameters.
Name
Phd_ResetPrintMotorParam
Parameter
None
Return
None
Description:
This function resets motor parameters.
Name
Parameter
Return
Phd_WriteDotLineData
u16LeftMargin: left margin
u16RightMargin: right margin
None
Description:
Write dot line data to head buffer.
Name
Parameter
Return
Phd_WriteDotLineHistoryData
u16LeftMargin: left margin
u16RightMargin: right margin
None
Description:
Write dot line history data to head buffer.
Name
Phd_StartFeed
Parameter
punTaskParam: pointer to task parameter structure
Return
None
Description:
Feeding paper.
Name
Phd_StartPrint
Parameter
punTaskParam: pointer to task parameter structure
Return
None
Description:
Start printing.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
61
U S E R
M A N U A L
Name
Phd_StartAutocut
Parameter
punTaskParam: pointer to task parameter structure
Return
None
Description:
Start auto feed.
Name
Phd_AutoFeed
Parameter
None
Return
None
Description:
Start auto feed.
Name
Phd_AutoCutInit
Parameter
None
Return
None
Description:
Initialize auto cutter.
Name
Phd_AutoCutClearTask
Parameter
None
Return
None
Description:
Clear auto cut task.
Name
Phd_AutoCutStop
Parameter
None
Return
None
Description:
Stop auto cut.
Name
Phd_AutoCutTimeOut200ms
Parameter
None
Return
None
Description:
This function will execute when the auto-cut times out for 200ms.
62
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Phd_AutoCutTimeOut1s
Parameter
None
Return
None
Description:
This function will execute when the auto-cut times out for 1s.
Name
Phd_AutoCutInitTimeOut1s
Parameter
None
Return
None
Description:
This function will execute when the auto-cutter initialization times out for 1s.
Name
Phd_RecoverPaper
Parameter
None
Return
0: No error to recover
1: There is error to recover
Description:
This function will execute after the paper errors are removed.
Name
Phd_TimerForHeat
Parameter
None
Return
None
Description:
This function will execute when heating.
Name
Phd_PWMIsrForMotor
Parameter
None
Return
None
Description:
This function will execute when heating or feeding paper.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
63
U S E R
Name
Phd_PaperEndStop
Parameter
None
Return
None
M A N U A L
Description:
Stop printing and store print head status when errors happen.
Name
Phd_OverHeat
Parameter
None
Return
None
Description:
This function will execute when overheating.
Name
Phd_CutterResetCallback
Parameter
None
Return
None
Description:
This function will execute when cutter reset signal is triggered.
Name
Phd_OutPaperCallback
Parameter
None
Return
None
Description:
This function will execute when paper is end.
Name
Phd_PaperNearEndCallback
Parameter
None
Return
None
Description:
This function will execute when paper is near end.
Name
Phd_BlackMarkCallback
Parameter
None
Return
None
Description:
This function will execute when the black mark is detected if the black mark is enabled.
64
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Phd_PlatenOpenCallback
Parameter
None
Return
None
Description:
This function will execute when platen is open.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
65
U S E R
M A N U A L
5.5.2 Print Head Pin
Name
Php_MsftOn
Parameter
None
Return
None
Description:
Turn on Msft.
Name
Php_MsftOff
Parameter
None
Return
None
Description:
Turn off Msft.
Name
Php_HeatStb1
Parameter
None
Return
None
Description:
Enable Stb1 pin to heat.
Name
Php_HeatStb2
Parameter
None
Return
None
Description:
Enable Stb2 pin to heat.
Name
Php_HeatStb12
Parameter
None
Return
None
Description:
Enable Stb1 2 pin to heat.
Name
Php_StopStb12
Parameter
None
Return
None
Description:
Disable Stb1 2 pin.
66
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Php_SetMicrostepENABLEn
Parameter
u8PinLevel: Pin level
Return
None
Description:
This function sets ENABLEn pin.
Name
Php_SetMicrostepDir
Parameter
enRotationDir: step direction
Return
None
Description:
This function sets micro step direction
Name
Php_SetMicrostepMode
Parameter
enMicrostepMode: step mode
Return
None
Description:
This function sets micro step mode.
Name
Php_SetMicrostepRESETn
Parameter
u8PinLevel: Pin Level
Return
None
Description:
This function sets RESETn pin
Name
Php_GetMicrostepHOMEn
Parameter
None
Return
Pin level
Description:
Get micro step HOMEn pin level.
Name
Php_DcMotorForward
Parameter
None
Return
None
Description:
Forward DC motor.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
67
U S E R
Name
Php_DcMotorReverse
Parameter
None
Return
None
M A N U A L
Description:
Reverse DC motor
Name
Php_DcMotorStandby
Parameter
u8PinLevel: Pin level
Return
None
Description:
Make DC motor standby
Name
Php_DcMotorBrake
Parameter
None
Return
None
Description:
Brake DC motor.
Name
Php_PinInit
Parameter
None
Return
None
Description:
Initiate print head pin.
5.5.3 Print Head CSIO
Name
Phc_CsioInit
Parameter
None
Return
None
Description:
Initialize CSIO for print head.
68
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.6 Character Module
5.6.1 Overview
Character module includes 3 C files; the detail is as shown in Table 5-3.
Table 5-3: Character Module Overview
File
character.c
csio_int_s25fl127s.c
Style_convert.c
Function
CHAR_CharacterRange
Confirm the character belonging to ASCII or Chinese
CHAR_CharacterService
Service function for character
Char_EraseNVBitmapArea
Erase NV bitmap area in flash
Char_WriteNVBitmapTable
Write NV bitmap index table in flash
Char_WriteNVBitmapTotal
Write NV bitmap total number in flash
Char_WriteNVBitmapData
Write NV bitmap data in flash
Char_ReadNVBitmapTotal
Read NV bitmap total number from flash
Char_ReadNVBitmapTable
Read NV bitmap index table from flash
Char_ReadNVBitmapData
Read NV bitmap data from flash
Char_ReadDownLoadBitmapData
Read download bitmap data
Char_ReadSoftDIP
Read soft DIP from flash
Char_WriteSoftDIP
Write soft DIP to flash
Char_WriteAutomaticLoadControlValueSetting
Write automatic load control value setting in flash
Char_ReadAutomaticLoadControlValueSetting
Read automatic load control value setting from flash
Char_WritePrinterControlValue
Write printer control value
Char_ReadPrinterControlValue
Read printer control value
Char_NVInit
Initialize NV bitmap
S25fl127s_Init
Initialize flash process
S25fl127s_ReadId
Read external flash ID
S25fl127s_BulkErase
Flash bulk erase
S25fl127s_4kSectorErase
Flash 4K sector erase
S25fl127s_SectorErase
Flash sector erase
S25fl127s_PageProgram
Write data to external flash
S25fl127s_Read
Read data from external flash
CSC_FontStlyeBold
Set or cancel font bold style
CSC_FontStlyeUnderline
Set or cancel font underline style
CSC_FontStlyeStriketrougth
Set or cancel font strikethrough style
CSC_FontStlyeUpline
Set or cancel font upline style
CSC_FontStlyeRotate90
Rotate font 90°
CSC_FontStlyeRotate180
Rotate font 180°
CSC_FontStlyeRotate270
Rotate font 270°
CSC_FontStlyeDoubleWidth
Zoom out the font by double width
CSC_FontStlyeDoubleHeight
Zoom out the font by double height
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Description
69
U S E R
M A N U A L
5.6.2 Function Module Flow
This module includes 5 function sub-modules, Character process, NV Bitmap process, Download Bitmap
process, Soft DIP process and Printer Control Value process.
1.
Character Process
Main process flow:
Figure 5-5: Character Process Flow
Start
Confirm Character
range
Character Service
Return
CHAR_CharacterService flow:
Figure 5-6: CHAR_CharacterService Process Flow
Start
Confirm Character
Address in flash
Read data from flash
Font Style Setting
Return
70
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
2.
M A N U A L
NV Bitmap Process
Write NV Bitmap Flow:
Figure 5-7: Write NV Bitmap Flow
Start
Erase NV Bitmap
area
Write Index Table
Write Data
Bitmap complete?
N
Y
Write Total Number
Return
Read NV Bitmap Flow:
Figure 5-8: Read NV Bitmap Flow
Start
Read Total
Number
Read Index Table
Read Data
Bitmap complete?
N
Y
Return
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
71
U S E R
M A N U A L
5.6.1 Function Description
Name
Parameter
Return
CHAR_CharacterRange
content: Character content
contentlength: Content length
Character range
Description:
Confirm the character belonging to ASCII or Chinese.
Name
CHAR_CharacterService
content: Character content
Parameter
contentlength: Content length
characteroutput: Processed data
Return
0: Success
Other: Fail
Description:
Character service function, read the character data from external flash and process the font style.
Name
Char_EraseNVBitmapArea
Parameter
None
Return
None
Description:
Erase the flash of NV bitmap area.
Name
Char_WriteNVBitmapTable
u8Index: Current NV bitmap index number
Parameter
u16Width: Current NV bitmap width
u16Height: Current NV bitmap height
Return
1: Success
0: Fail
Description:
Write the NV bitmap index table.
Name
Char_WriteNVBitmapTotal
Parameter
u8total: All NV bitmap quantity
Return
1: Success
0: Fail
Description:
Write the NV bitmap quantity in flash.
72
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
Name
M A N U A L
Char_WriteNVBitmapData
u8index: NV bitmap index
u16height: NV bitmap height
Parameter
u8data: processed data store
u16widthindex: NV bitmap width index
u16length: process sector length
Return
1: Success
0: Fail
Description:
Write the NV bitmap data in flash.
Name
Char_ReadNVBitmapTotal
Parameter
u8total: All NV bitmap quantity
Return
1: Success
0: Fail
Description:
Read the NV bitmap quantity from flash.
Name
Char_ReadNVBitmapTable
u8Index: Current NV bitmap index number
Parameter
u16Width: Current NV bitmap width
u16Height: Current NV bitmap height
Return
1: Success
0: Fail
Description:
Read the NV bitmap index table.
Name
Char_ReadNVBitmapData
u8index: NV bitmap index
u16width: NV bitmap width
u16height: NV bitmap height
Parameter
u8data: processed data store
u16heightindex: NV bitmap height index
u16length: process sector length
u8mode: NV bitmap zoom out mode
Return
1: Success
0: Fail
Description:
Read the NV bitmap data from flash.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
73
U S E R
Name
M A N U A L
Char_ReadDownLoadBitmapData
u16width: Download bitmap width
u16height: Download bitmap height
u8data: processed data store
Parameter
u16heightindex: Download bitmap height index
u16length: process sector length
u8mode: Download bitmap zoom out mode
u8bitmapbuf: Download bitmap store base address
Return
1: Success
0: Fail
Description:
Read the download bitmap data from RAM.
Name
Char_ReadSoftDIP
u8DipNumIndex: DIP number index
Parameter
u8DipNumLength: Read DIP quantity
u8DipData: store DIP data
Return
None
Description:
Read DIP value.
Name
Parameter
Return
Char_WriteSoftDIP
u8DipData: DIP value
u8DipNumLength: Write DIP quantity
None
Description:
Write DIP value.
Name
Char_WriteAutomaticLoadControlValueSetting
Parameter
u8Setting: Setting
Return
None
Description:
Setting of write automatic load control value.
Name
Char_ReadAutomaticLoadControlValueSetting
Parameter
u8Setting: Store setting
Return
None
Description:
Setting of read automatic load control value.
74
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Char_WritePrinterControlValue
Parameter
None
Return
None
Description:
Write printer control value to flash.
Name
Char_ReadPrinterControlValue
Parameter
None
Return
None
Description:
Read printer control value from flash.
Name
Char_NVInit
Parameter
None
Return
None
Description:
Initialize NV bitmap.
Name
S25fl127s_Init
Parameter
None
Return
Generic error codes
Description:
Initialize SPI.
Name
Parameter
Return
S25fl127s_ReadId
pManufactureId: Pointer to manufacture ID
pDeviceId: Pointer to device ID
Generic error codes
Description:
Read external flash ID.
Name
S25fl127s_BulkErase
Parameter
None
Return
Generic error codes
Description:
Chip erases the whole Flash memory.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
75
U S E R
M A N U A L
Name
S25fl127s_4kSectorErase
Parameter
u32Addr: The address within the 4k area
Return
Generic error codes
Description:
Sector Erase 4KB sector.
Name
S25fl127s_SectorErase
Parameter
u32Addr: The address within the 64kB or 256kB area
Return
Generic error codes
Description:
Sector Erase 64kB or 256kB sector.
Name
S25fl127s_PageProgram
u32Addr: Address
Parameter
pu8Data: Pointer to data address
u16Size: Data size
Return
Generic error codes
Description:
Page program S25FL127S.
Name
S25fl127s_Read
u32Addr: Address
Parameter
pu8Data: Pointer to data address
u16Size: Data size
Return
Generic error codes
Description:
Read data from S25FL127S.
Name
CSC_FontStlyeBold
Parameter
characterarray: Character dot data
Return
None
Description:
Bold style process.
Name
CSC_FontStlyeUnderline
Parameter
characterarray: Character dot data
Return
None
Description:
Underline style process.
76
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
CSC_FontStlyeStrikethrough
Parameter
characterarray: Character dot data
Return
None
Description:
Strikethrough style process.
Name
CSC_FontStlyeUpline
Parameter
characterarray: Character dot data
Return
None
Description:
Upline style process.
Name
Parameter
Return
CSC_FontStlyeRotate90
characterarray: Character dot data
targetarray: Processed data
None
Description:
Character rotates 90 degrees.
Name
Parameter
Return
CSC_FontStlyeRotate180
characterarray: Character dot data
targetarray: Processed data
None
Description:
Character rotates 180 degrees.
Name
Parameter
Return
CSC_FontStlyeRotate270
characterarray: Character dot data
targetarray: Processed data
None
Description:
Character rotates 270 degrees.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
77
U S E R
Name
Parameter
Return
M A N U A L
CSC_FontStlyeDoubleWidth
characterarray: Character dot data
targetarray: Processed data
None
Description:
Character double width.
Name
Parameter
Return
CSC_FontStlyeDoubleHeight
characterarray: Character dot data
targetarray: Processed data
None
Description:
Character double height.
78
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
5.7 Barcode Module
5.7.1 Overview
Character module includes 4 C files. The detail is as shown in Table 5-3.
Table 5-4: Character Module Overview
File
Function
EAN8.c
Code128.c
Description
EAN8_BarcodeCheckSum
Calculate EAN 8 and EAN 13 checksum
EAN8_BarcodeEncode
EAN 8 and EAN 13 encode
C128_BitmapHorizontalzoom
Bitmap Horizontal zoom out
C128_Code128Barcode
Code 128 encode
Qrcode.c
Qrcode
QR code encode
GenericGF.c
encode
Error correcting code encode
ArrayCopy
Array copy for word type
ArrayCopyByte
Array copy for byte type
5.7.2 Function Description
Name
Parameter
Return
EAN8_BarcodeCheckSum
au8CheckData: Check data
u8Length: data length
Checksum
Description:
Calculate EAN 8 and EAN 13 checksum.
Name
EAN8_BarcodeEncode
au8BarcodeString: Character content
Parameter
u8codelength: Character length
pu8Target: Store the processed data
u8StandWidth: A stand width
Return
Barcode dot width
Description:
EAN 8 and EAN 13 encode.
Name
C128_BitmapHorizontalzoom
au8SourceData: Source data
Parameter
u16CodeLength: Data length
u8ZoomSize: Zoom out size
pu8Target: Store process data
Return
None
Description:
Bitmap Horizontal zooms out.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
79
U S E R
Name
M A N U A L
C128_Code128Barcode
pu8Barcode: Character content
Parameter
pu8BarcodeLength: Content length
pu8TempArray: Store processed data
u8StandWidth: Stand width
Return
Barcode width
Description:
Code 128 encode.
Name
Qrcode
content: Character content
Parameter
contentlength: Content length
cellsize: Cell size
level: Error correcting level
Return
1: Success
0: Fail
Description:
QR code encode.
Name
encode
sourcedata: Source data
Parameter
toEncode: Store processed data
sourcedatalen: Source data length
ecBytes: Error correcting length
Return
None
Description:
Error correcting code encode.
Name
ArrayCopy
SourceArray: Source array
SourceArrayIndex: Source array index
Parameter
DestinationArrary: Destination array
DestinationArraryindex: Destination array index
CopyLength: Copy length
Return
None
Description:
Array copy for word type.
80
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
Name
M A N U A L
ArrayCopyByte
SourceArray: Source array
SourceArrayIndex: Source array index
Parameter
DestinationArrary: Destination array
DestinationArraryindex: Destination array index
CopyLength: Copy length
Return
None
Description:
Array copy for byte type.
5.8 MISC Module
5.8.1 ADC
Name
Adc_TempScanIntCb
Parameter
None
Return
None
Description:
This function will execute when scan interrupt for temperature happens.
Name
Adc_SetScanIntCb
Parameter
pfnScanIntCb: pointer to scan interrupt callback
Return
None
Description:
Set Scan interrupt callback function.
Name
Adc_ScanIntCb
Parameter
None
Return
None
Description:
This function will execute when scan interrupt happens.
Name
Adc_SetCompIntCb
Parameter
pfnCompIntCb: pointer to compare interrupt callback function
Return
None
Description:
Set compare interrupt callback function.
Name
Adc_CompIntCb
Parameter
None
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
81
U S E R
Return
M A N U A L
None
Description:
This function will execute when compare interrupt happens.
Name
Adc_DisableTempCompInt
Parameter
None
Return
None
Description:
Disable compare interrupt.
82
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Adc_EnableTempCompInt
Parameter
None
Return
None
Description:
Enable compare interrupt.
Name
Adc_Init
Parameter
None
Return
None
Description:
Initialize ADC for print head.
Name
Adc_StartScan
Parameter
u8AdcUnit:adc unit
Return
None
Description:
Start ADC scan.
Name
Adc_StopScan
Parameter
u8AdcUnit:adc unit
Return
None
Description:
Stop ADC scan.
Name
Adc_TmpSampleVal
Parameter
None
Return
Sample value
Description:
Sample the voltage of thermistor resistance.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
83
U S E R
M A N U A L
5.8.2 Dual Timer
Name
Dt_SetHeatCount
Parameter
u32HeatCount: heat time
Return
None
Description:
Set timer count.
Name
Dt_Start
Parameter
pstcUnitCh: Pointer to structure of timer channel and unit
Return
None
Description:
Start DT.
Name
Dt_Stop
Parameter
pstcUnitCh: Pointer to structure of timer channel and unit
Return
None
Description:
Stop DT.
Name
Dt_StartHeatTimer
Parameter
None
Return
None
Description:
Start DT for heating.
Name
Dt_StopHeatTimer
Parameter
None
Return
None
Description:
Stop DT for heating.
Name
Dt_Configure
pstcTimerConfig: Pointer to timer parameter structure
Parameter
TimerCallBack: timer interrupt call back function
u8DtChCnt: Pointer to dual timer channel and unit
Return
None
Description:
Configure DT.
84
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Dt_GetTimerValue
Parameter
u8Ch: timer channel
Return
Dual timer current count value
Description:
Get DT value.
Name
Dt_GetTimerValueHeat
Parameter
None
Return
None
Description:
Initialize ADC for print head.
Name
Adc_StartScan
Parameter
u8Ch: timer channel
Return
Dual timer current count value
Description:
Get DT value for heat.
Name
Dt_DisableTimerHeat
Parameter
None
Return
None
Description:
Disable DT for heat.
Name
Dt_SetIntCbHeat
Parameter
pfnDtCb: pointer to DT interrupt callback function
Return
None
Description:
Set DT interrupt callback for heat.
Name
Dt_Init
Parameter
None
Return
None
Description:
Initialize DT.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
85
U S E R
M A N U A L
5.8.3 Free Run Timer
Name
Frt_Start
Parameter
pstcUnitCh: Pointer to structure of timer channel and unit
Return
None
Description:
Start FRT.
Name
Frt_Stop
Parameter
pstcUnitCh: Pointer to structure of timer channel and unit
Return
None
Description:
Stop FRT.
Name
Frt_StartAutoFeedCount
Parameter
None
Return
None
Description:
Start auto feed count.
Name
Frt_StopAutoFeedCount
Parameter
None
Return
None
Description:
Stop auto feed count
Name
Frt_SetAutoFeedCb
Parameter
pfnAutoFeedCb: Pointer to auto feed callback function
Return
None
Description:
Set auto feed callback.
Name
Frt_SetAutoFeedCount
Parameter
u16CntCycle: timer cycle
Return
None
Description:
Set FRT cycle for auto feed.
86
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Frt_StartTimeOutCount
Parameter
None
Return
None
Description:
Start FRT for timeout.
Name
Frt_StopTimeOutCount
Parameter
None
Return
None
Description:
Stop FRT for timeout.
Name
Frt_SetTimeOutCount
Parameter
u16CntCycle: time out cycle
Return
None
Description:
Set FRT cycle for timeout
Name
Frt_SetTimeOutCb
Parameter
pfnTimeOutCb: pointer to FRT interrupt callback
Return
None
Description:
Set FRT callback for timeout
Name
Frt_Config
Parameter
pstcFrtParam:Pointer to frt parameter structure
Return
None
Description:
Configure FRT.
Name
Frt_Init
Parameter
None
Return
None
Description:
Initialize FRT.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
87
U S E R
M A N U A L
5.8.4 PWM
Name
Pwm_Init
pstcIoBtTioa: pointer to PWM IO structure
Parameter
pstcBtPwmInitReg: pointer to PWM timer initialization data
structure
pstcPwmIntCb: pointer to PWM interrupt callback structure
Return
None
Description:
Initialize PWM.
Name
Pwm_OutputHighLevel
Parameter
None
Return
None
Description:
Output high.
Name
Pwm_OutputLowLevel
Parameter
None
Return
None
Description:
Output low.
Name
Pwm_Configure
Parameter
None
Return
None
Description:
Configure PWM
Name
Pwm_SetTrigIntCb
Parameter
pfnPwmTrigIntCb: Trigger Trig interrupt callback function
Return
None
Description:
Set trigger interrupt callback.
88
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
Name
Pwm_SetDutyMatchIntCb
Parameter
pfnPwmDutyMatchIntCb: Pointer to duty match interrupt callback
Return
None
Description:
Set duty match interrupt callback.
Name
Parameter
Return
Pwm_SetUnderflowIntCb
pfnPwmUnderflowIntCb: Pointer to underflow interrupt callback
function
None
Description:
Set underflows interrupt callback.
Name
Pwm_StartSoft
Parameter
u8Ch:Requested channel
Return
None
Description:
Start PWM
Name
Pwm_Stop
Parameter
u8Ch:Requested channel
Return
None
Description:
Stop PWM.
Name
Parameter
Return
Pwm_WriteCycleVal
u8Ch: requested channel
u16Cycle: cycle value
None
Description:
Write cycle value of PWM
Name
Parameter
Return
Pwm_WriteDutyVal
u8Ch: requested channel
u16Duty: duty value
None
Description:
Write duty value of PWM.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
89
U S E R
M A N U A L
Name
Pwm_ReadCurCnt
Parameter
u8Ch: requested channel
Return
count value
Description:
Read current count value of PWM timer.
5.8.5 Sys_IF
Name
System_SystemIntInit
Parameter
None
Return
None
Description:
Initialize system interrupt callback.
90
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
6 Reference Documents
[1].厦门精芯-打印指令集
[2]. DRV8811_datasheet
[3]. Thermal line printer M-T530A/T540A Specification
[4]. MB9BF516R-MN706-00016-1v0-E (MB9B500 Data Sheet)
[5]. MN706-00002-7v0-E (MB9Axxx/MB9Bxxx Series Peripheral Manual)
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
91
U S E R
M A N U A L
7 Appendix
7.1 Commands
7.1.1 Command Format Description
[Name]
The name of the command
[Format]
The code sequence
[ ]k
indicates the contents of [ ] should be repeated k times
[Range]
Gives the allowable ranges for the arguments
[Description]
Describes the functions of the command
[Details]
Describes the usage of the command in detail
[Notes]
Provides important information on setting and using the printer command, if necessary
[Default]
Gives the default values, if any, for the command parameters
[Reference]
Lists related commands
The numbers denoted by < >H are hexadecimal
The numbers denoted by < >B are binary
7.1.2 Terms Description
1) Receive buffer
The receive buffer is a buffer that stores, as is, the data received from the host computer (the reception
data). The receive data is stored in the receive buffer temporarily, and is then processed sequentially.
2) Print buffer
The print buffer is a buffer that stores the image data to be printed.
3) Print buffer full
This is the state where there is no more room in the print buffer. If new print data is input while the print
buffer is full, the data in the print buffer is printed out and a line feed is executed. This is the same
operation as the LF operation.
4) Start of line
The start of line state satisfies the following conditions:
(1) There is no print data (including spaces and portions of data skipped due to HT currently in the print
buffer.
(2) The print position is not specified by the ESC $ or ESC \ command.
5) Printable area
The maximum range within which printing is possible under the printer specifications. The printable area
for this printer is as follows:
(1) The length of the horizontal direction in standard mode:
For 82.5 mm paper-width model: approximately 80 mm {640/203.2"}
6) Printing area
Printing range is set by the command. The printing area must be ≤ the printable area.
7) Ignore
The state in which all codes including parameters, are read in and discarded, and nothing happens.
8) Inch
One inch is 25.4 mm.
92
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
9) MSB
Most Significant Bit
10) LSB
Least Significant Bit
7.1.3 Commands
HT
[Name]
Horizontal tab
[Format]
ASCII
HT
Hex
09
Decimal
9
[Description]
Moves the print position to the next horizontal tab position.
[Notes]
 This command is ignored unless the next horizontal tab position has been set.
 If the next horizontal tab position exceeds the printing area, the printer sets the
printing position to [printing area width + 1].
 Horizontal tab positions are set with ESC D.
 If this command is received when the printing position is at [printing area width + 1],
the printer executes print buffer-full printing of the current line and horizontal tab
processing from the beginning of the next line.
[Reference]
ESC D
[Name]
Print and line feed
[Format]
ASCII
LF
Hex
0A
Decimal
10
LF
[Description]
Prints the data in the print buffer and feeds one line, based on the current line spacing.
[Note]
This command sets the print position to the beginning of the line.
[Reference]
ESC 2, ESC 3, APPENDIX A.1
[Name]
(1) Print and return to standard mode in page mode
FF
(2) Print and feed marked paper to print starting position
[Format]
ASCII
FF
Hex
0C
Decimal
12
(1) When page mode is selected:
[Description]
Prints the data in the print buffer collectively and returns to standard mode.
[Notes]
 This command is enabled only in page mode.
 The buffer data is deleted after being printed.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
93
U S E R
M A N U A L
 The printing area set by ESC W is reset to the default setting.
 This command sets the print position to the beginning of the line.
[Reference]
ESC FF, ESC L, ESC S
(2) When BM sensor is effective:
[Description]
Prints the data in the print buffer and feeds marked paper to the print starting position.
[Notes]
 This command is enabled only when the BM sensor is set to be effective using with
DIP SW1-1.
 This command sets the print position to the beginning of the line.
 If this command is executed at the print starting position of the marked paper, the
printer feeds the marked paper to the next print starting position.
[Reference]
GS ( F, GS FF, 3.3.2.1, DIP Switch 1
CR
[Name]
Print and carriage return
[Format]
ASCII
CR
Hex
0D
Decimal
13
[Description]
When automatic line feed is enabled, this command functions the same as LF; when
automatic line feed is disabled, this command is ignored.
[Details]
 Auto line feed is enabled / disabled by the setting of memory switch 1-5.
 Sets the print starting position to the beginning of the line.
[Reference]
LF
ESC SP n
[Name]
Set right-side character spacing
[Format]
ASCII
ESC SP
n
Hex
1B
20
n
Decimal
27
32
n
[Range]
0 ≤ n ≤ 255
[Description]
Set the character spacing for the right side of the character to [n × 0.125 mm].
[Details]
 When characters are enlarged, the right-side character spacing is as n times as
normal value.
 This command sets values independently in each mode (standard and page modes).
[Default]
n=0
ESC ! n
94
CONFIDENTIAL
[Name]
Select print mode(s)
[Format]
ASCII
ESC !
n
Hex
1B
n
21
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
Decimal
M A N U A L
27
33
n
[Range]
0 ≤ n ≤ 255
[Description]
Selects print mode(s) using n as follows:
Bit
0
1
2
3
4
5
6
7
Off/On
Off
Hex
0
Decimal
0
Function
Character Font A (12 × 24) selected.
On
―
1
―
1
―
Character Font B (9 × 17) selected..
Undefined
―
Off
―
0
―
0
Undefined
Emphasized mode is turned off.
On
Off
8
0
8
0
Emphasized mode is turned on.
Double-height canceled.
On
Off
10
0
16
0
Double-height selected.
Double-width canceled.
On
―
20
―
32
―
Double-width selected.
Undefined.th
Off
On
0
80
0
128
Underline mode is turned off.
Underline mode is turned on.
[Details]
 When both double-height and double-width modes are selected, quadruple-size
characters are printed.
 The printer can underline all characters, but cannot underline the space set by HT or
90° clockwise rotated characters.
 The thickness of the underline is that selected by ESC −, regardless of the character
size.
 When some characters in different height magnification are in a line, all the
characters in the line are aligned at the baseline.
 ESC M can also select the character font type. However, the setting of the last
received command becomes effective.
 ESC E can also turn on or off emphasized mode. However, the setting of the last
received command becomes effective.
 ESC − can also turn on or off underline mode. However, the setting of the last
received command becomes effective.
 GS ! can also select character size. However, the setting of the last received
command becomes effective.
 Turning emphasized mode on/off is effective only with alphanumeric and Kanji
characters. Other print modes are effective only with alphanumeric and Kanji
characters.
[Default]
n=0
[Reference]
ESC -, ESC E, GS !
ESC $ nL nH
[Name]
Set absolute print position
[Format]
ASCII
ESC $
nL
nH
Hex
1B
24
nL
nH
Decimal
27
36
nL
nH
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
95
U S E R
[Range]
M A N U A L
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) × 0.125 mm].
[Details]
 Settings outside the specified printable area are ignored.
 In standard mode, the horizontal motion unit (x) is used.
 In page mode, horizontal or vertical motion units differ depending on the starting
position of the printable area, as follows:
[Reference]
(1)
When the starting position is set to the upper left or lower right of the printable
area using ESC T, the horizontal motion unit (x) is used.
(2)
When the starting position is set to the upper right or lower left of the printable
area using ESC T, the vertical motion unit (y) is used.
ESC \, GS $, GS \
ESC % n
[Name]
Select/cancel user-defined character set
[Format]
ASCII
ESC %
n
Hex
1B
25
n
Decimal
27
37
n
[Range]
0 ≤ n ≤ 255
[Description]
Selects or cancels the user-defined character set.
 When the LSB of n is 0, cancels the user-defined character set.
 When the LSB of n is 1, selects the user-defined character set.
[Details]
 n is available only for the least significant bit.
 When the user-defined character set is canceled, the built-in character set is
automatically selected.
[Default]
n=0
[Reference]
ESC &, ESC ?
ESC & y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]
[Name]
Define user-defined characters
[Format]
ASCII
ESC &
y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]
Hex
1B
26
y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]
Decimal
27
38
y c1 c2 [x1 d1...d(y × x1)]...[xk d1...d(y × xk)]
[Range]
y=3
32 ≤ c1 ≤ c2 ≤ 126
0 ≤ x ≤ 12 (when Font A (12 × 24) is selected)
0 ≤ x ≤ 9 (when Font B (9 × 17) is selected)
96
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
0 ≤ d1 ... d(y × xk) ≤ 255
[Description]
Defines user-defined characters.
 y specifies the number of bytes in the vertical direction.
 c1 specifies the character code that starts the definition, and c2 specifies the
character code that ends the definition.
 x specifies the number of dots in the horizontal direction.
[Details]
 The allowable character code range is from ASCII code <20>H to <7E>H.
 It is possible to define multiple characters for consecutive character codes. To define
only one character, use c1 = c2.
 d is the dot data for the characters. The dot pattern is in the horizontal direction from
the left side. If value of x is less than the dot number to configure the character, any
remaining dots on the right side become space (white).
 The data to define a user-defined character is (y × x) bytes.
 Set a corresponding bit to 1 to print a dot or 0 not to print a dot.
 This command can define different user-defined character patterns for each font. To
select a font, use ESC ! or ESC M.
 User-defined characters and a downloaded bit image cannot be defined
simultaneously. When this command is executed, the downloaded bit image is
cleared.
 The user-defined character definition is cleared when:
(1) ESC @ is executed.
(2) GS ∗ is executed.
(3) ESC ? is executed.
(4) The printer is reset or the power is turned off.
 When user-defined characters are defined in Font B (9 × 17), only the most
significant bit of the 3rd byte of data in vertical direction is effective.
[Default]
The embedded character set
[Reference]
ESC %, ESC ?
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
97
U S E R
M A N U A L
[Example]
 When Font A (12 × 24) is selected.
98
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
 When font B (9 × 17) is selected.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
99
U S E R
M A N U A L
ESC ∗ m nL nH d1...dk
[Name]
Select bit-image 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 specified by nL and nH, as
follows:
Vertical Direction
Horizontal Direction
m
Mode
Number
of dots
Dot
density
Dot
density
Number of data (k)
0
8-dot single-density
8
67.7 dpi
101.6 dpi
nL + nH × 256
1
8-dot double-density
8
67.7 dpi
203.2 dpi
nL + nH × 256
32
24-dot single-density
24
203.2 dpi
101.6 dpi
(nL + nH × 256) ×3
33
24-dot double-density
24
203.2 dpi
203.2 dpi
(nL + nH × 256) ×3
[dpi: dots per 25.4 mm {1"}]
[Notes]
 If the value of m is out of the specified range, nL and the data following are processed
as normal data.
 The nL and nH indicate the number of dots in the bit image in the horizontal direction.
The number of dots is calculated by nL + nH × 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 not to
print a dot.
 If the width of the printing area set by GS L and GS W less than the width required by
the data sent with the ESC ∗ command, the following will be performed on the line in
question (but the printing cannot exceed the maximum printable area):
(1) The width of the printing area is extended to the right to accommodate the
amount of data.
(2) If step (1) does not provide sufficient width for the data, the left margin is
reduced to accommodate the data.
For each bit of data in single-density mode (m = 0, 32), the printer prints two dots: for
each bit of data in double-density mode (m = 1, 33), the printer prints one dot. This
must be considered in calculating the amount of data that can be printed in one line.
 After printing a bit image, the printer returns to normal data processing mode.
 This command is not affected by print modes (emphasized, double-strike, underline,
character size, or white/black reverse printing), except upside-down printing mode.
 The relationship between the image data and the dots to be printed is described in
Figure below.
100
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
(When 8-dot bit image is selected)
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
101
U S E R
M A N U A L
ESC - n
[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
Function
0, 48
Turns off underline mode
1, 49
Turns on underline mode (1-dot thick)
2, 50
[Notes]
Turns on underline mode (2-dots thick)
 The printer can underline all characters (including right-side character spacing), but
cannot underline the space set by HT.
 The printer cannot underline 90° clockwise rotated characters and white/black
inverted characters.
 When underline mode is turned off by setting the value of n to 0 or 48, the following
data is not underlined, and the underline thickness set before the mode is turned off
does not change. The default underline thickness is 1 dot.
 Changing the character size does not affect the current underline thickness.
 Underline mode can also be turned on or off by using ESC !. Note, however, that the
last received command is effective.
[Default]
n=0
[Reference]
ESC !
ESC 2
[Name]
Select default line spacing
[Format]
ASCII
ESC
2
Hex
1B
32
Decimal
27
50
[Description]
Selects 3.75 mm (30 × 0.125 mm) line spacing.
[Notes]
 The line spacing can be set independently in standard mode and in page mode.
[Reference]
ESC 3
ESC 3 n
[Name]
Set line spacing
[Format]
ASCII ESC 3 n
Hex 1B 33 n
Decimal 27 51 n
102
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
[Range]
0 ≤ n ≤ 255
[Description]
Sets the line spacing to [n × 0.125 mm].
[Notes]
 The line spacing can be set independently in standard mode and in page mode.
 In standard mode, the vertical motion unit (y) is used.
 In page mode, this command functions as follows, depending on the starting position
of the printable area:
(1) When the starting position is set to the upper left or lower right of the printable
area using ESC T, the vertical motion unit (y) is used.
(2) When the starting position is set to the upper right or lower left of the print able
area using ESC T, the horizontal motion unit (x) is used.
[Default]
n = 30
[Reference]
ESC 2
ESC ? n
[Name]
Cancel user-defined characters
[Format]
ASCII
ESC ?
n
Hex
1B
3F
n
Decimal
27
63
n
[Range]
32 ≤ n ≤ 126
[Description]
Cancels user-defined characters.
[Notes]
 This command cancels the patterns defined for the character codes specified by n.
After the user-defined characters are canceled, the corresponding patterns for the
embedded characters are printed.
 This command deletes the pattern defined for the specified code in the font selected
by ESC !.
 If a user-defined characters have not been defined, the printer ignores this command.
[Reference]
ESC &, ESC %
ESC @
[Name]
Initialize printer
[Format]
ASCII
ESC @
Hex
1B
40
Decimal
27
64
[Description]
Clears the data in the print buffer and resets the printer mode to the mode that was in
effect when the power was turned on.
[Notes]
 The DIP switch and memory switch settings are not checked again.
 The data in the receive buffer is not cleared.
 The macro definition is not cleared.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
103
U S E R
M A N U A L
ESC D n1...nk NUL
[Name]
Set horizontal tab positions
[Format]
ASCII
ESC D
n1...nk
NUL
Hex
1B
44
n1...nk
00
Decimal
27
68
n1...nk
0
[Range]
1 ≤ n ≤ 255
0 ≤ k ≤ 32
[Description]
Sets horizontal tab positions.
 n specifies the column number for setting a horizontal tab position from the beginning
of the line.
 k indicates the total number of horizontal tab positions to be set.
[Notes]
 The horizontal tab position is stored as a value of [character width × n] measured
from the 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.
 This command cancels the previous horizontal tab settings.
 When setting n = 8, the print position is moved to column 9 by sending HT.
 Up to 32 tab positions (k = 32) can be set. Data exceeding 32 tab positions is
processed as normal data.
 Transmit [n]k in ascending order and place a NUL code 0 at the end. 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.
 ESC D NUL cancels all horizontal tab positions.
 The previously specified horizontal tab positions do not change, even if the character
width changes.
 The character width is memorized for each standard and page mode.
[Default]
The default tab positions are at intervals of 8 characters (columns 9, 17, 25,...)
for Font A (12 × 24).
[Reference]
HT
ESC E n
[Name]
Turn emphasized mode on/off
[Format]
ASCII
ESC E
n
Hex
1B
45
n
Decimal
27
69
n
[Range]
0 ≤ n ≤ 255
[Description]
Turns emphasized mode on or off.
 When the LSB of n is 0, turns emphasized mode off.
 When the LSB of n is 1, turns emphasized mode on.
104
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
[Notes]
M A N U A L
 Only the least significant bit of n is enabled.
 ESC ! also turns on and off emphasized mode. However, the setting of the last
received command is effective.
[Default]
n=0
[Reference]
ESC !
ESC G n
[Name]
Turn on/off double-strike mode
[Format]
ASCII
ESC G
n
Hex
1B
47
n
Decimal
27
71
n
[Range]
0 ≤ n ≤ 255
[Description]
Turns double-strike mode on or off.
 When the LSB of n is 0, turns double-strike mode off.
 When the LSB of n is 1, turns double-strike mode on.
[Notes]
 Only the lowest bit of n is enabled.
 Since this printer does not support double-strike mode, printer output is the same in
double-strike mode and in emphasized mode.
[Default]
n=0
[Reference]
ESC E
ESC J n
[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 × 0.125 mm].
[Notes]
 After printing is 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 ESC 2
or ESC 3.
 In standard mode, the printer uses the vertical motion unit (y).
 In page mode, this command functions as follows, depending on the starting position
of the printable area:
(1) When the starting position is set to the upper left or lower right of the printable
area using ESC T, the vertical motion unit (y) is used.
(2) When the starting position is set to the upper right or lower left of the print able
area using ESC T, the horizontal motion unit (x) is used.
 When the BM sensor is enabled and in standard mode, this command is effective.
(BM =black mark.)
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
105
U S E R
M A N U A L
ESC M n
[Name]
Select character font
[Format]
ASCII
ESC M
n
Hex
1B
4D
n
Decimal
27
77
n
[Range]
n = 0, 1, 48, 49
[Description]
Selects the character font.
n
Function
0, 48
Selects character Font A (12 × 24).
1, 49
Selects character Font B (9 × 17).
[Details]
 ESC ! can also select character font types. However, the setting of the last received
command is effective.
[Reference]
ESC !
ESC S
[Name]
Select standard mode
[Format]
ASCII
ESC
S
Hex
1B
53
Decimal
27
83
[Description]
Switches from page mode to standard mode.
[Notes]
 This command is effective only in page mode.
 Data buffered in page mode is cleared.
 This command sets the print position to the beginning of the line.
 The printing area set by ESC W is initialized.
 This command switches the settings for the following commands (in which the values
can be set independently in standard mode and page mode) to those for standard
mode:
[Reference]
(1) Set right-side character spacing: ESC SP
(2) Select default line spacing: ESC 2, ESC 3
FF, ESC FF, ESC L
ESC V n
106
CONFIDENTIAL
[Name]
Turn 90° clockwise rotation mode on/off
[Format]
ASCII
ESC V
n
Hex
1B
56
n
Decimal
27
86
n
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
[Range]
0 ≤ n ≤ 1, 48 ≤ n ≤ 49
[Description]
Turns 90° clockwise rotation mode on/off
n is used as follows:
n
Function
0, 48
Turns off 90°clockwise rotation mode
1, 49
Turns on 90°clockwise rotation mode
[Notes]
 This command affects printing in standard mode. However, the setting is always
effective.
 When underline mode is turned on, the printer does not underline 90°
clockwise-rotated characters.
 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.
 If this command is input in page mode, the printer performs only internal flag
operations.
[Default]
n=0
[Reference]
ESC !, ESC −
ESC \ nL nH
[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 using horizontal or vertical
motion units.
 This command sets the next print starting position away from the current position by
[(nL + nH × 256) × 0.125 mm]
[Notes]
 Any setting that exceeds the printable area is ignored.
 When pitch N is specified to the right:
nL+ nH × 256 = N
When pitch N is specified to the left (the negative direction), use the complement of
65536.
When pitch N is specified to the left:
nL+ nH × 256 = 65536 - N
 In standard mode, the horizontal motion unit is used.
 In page mode, the horizontal or vertical motion unit differs as follows, depending on
the starting point of the printing area:
(1) When the starting position is set to the upper left or lower right of the printable
area using ESC T, the horizontal motion unit (x) is used.
(2) When the starting position is set to the upper right or lower left of the printable
area using ESC T, the vertical motion unit (y) is used.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
107
U S E R
[Reference]
M A N U A L
ESC $
ESC a n
[Name]
Select justification
[Format]
ASCII
ESC
a
n
Hex
1B
61
n
Decimal
27
97
n
[Range]
0 ≤ n ≤ 2, 48 ≤ n ≤ 50
[Description]
Aligns all the data in one line to the specified position. n selects the justification as
follows:
n
Justification
0, 48
Left justification
1, 49
Centering
2, 50
Right justification
 The command is enabled only when processed at the beginning of the line in
standard mode.
[Notes]
 If this command is input in page mode, the printer performs only internal flag
operations.
 This command has no effect in page mode.
 This command executes justification in the set print area.
 This command justifies the space area according to HT, ESC $, or ESC \.
[Default]
n=0
[Example]
Left justification
Centering
ASC
Right justification
ASC
ABCD
ASC
ABCD
ABCDE
ABCD
ABCDE
ABCDE
ESC c 3 n
108
CONFIDENTIAL
[Name]
Select paper-end sensor(s) to output paper-end signals
[Format]
ASCII
ESC c
3
n
Hex
1B
63
33
n
Decimal
27
99
51
n
[Range]
0 ≤ n ≤ 255
[Description]
Selects whether the specified paper sensor(s) to output paper end signals when a
paper end is detected.
Bit
Off/On
Hex
Decimal
Function
0
Off
―
―
Undefineddo
1
Off
0
0
Disables roll paper near-end sensor.
On
2
2
Enables roll paper near-end sensor.
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
2
Off
―
―
Undefinedl
3
Off
0
0
Disables roll paper end sensor.
On
8
8
Enables roll paper end sensor.
Off
―
―
Undefinedol
4-7
[Notes]
M A N U A L
 Multiple paper sensors can be selected. If multiple paper sensors are made valid, a
paper-end signal is output when one of them detects a paper-out.
 This command is enabled only with the parallel interface type.
[Default]
n=0
ESC c 4 n
[Name]
Select paper sensor(s) to stop printing
[Format]
ASCII
ESC c
4
n
Hex
1B
63
34
n
Decimal
27
99
52
n
[Range]
0 ≤ n ≤ 255
[Description]
Selects the paper sensor(s) used to stop printing when a paper-end is detected, using n
as follows:
Bit
Off/On
Hex
Decimal
Function
0
Off
―
―
Undefineddo
1
Off
00
0
Roll paper near-end sensor disabled.
On
02
2
Roll paper near-end sensor enabled.
―
―
―
Undefinedl
2-7
[Notes]
 When a paper sensor is enabled with this command, printing stops after printing of
the current line and paper feeding has finished.
 When a paper-end is detected by the roll paper sensor, the printer goes offline after
printing stops.
 When either bit 1 is on, the printer selects the roll paper near-end sensor for the
paper sensor to stop printing.
[Default]
n=0
ESC c 5 n
[Name]
Enable/disable panel button
[Format]
ASCII
ESC c
5
n
Hex
1B
63
35
n
Decimal
27
99
53
n
[Range]
0 ≤ n ≤ 255
[Description]
Enables or disables the panel button.
 When the LSB of n is 0, enables the panel button.
 When the LSB of n is 1, disables the panel button.
[Notes]
 Only the lowest bit of n is valid.
 When the panel buttons are disabled, none of them are usable.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
109
U S E R
M A N U A L
 With this printer, the panel buttons means the paper FEED button.
 When in macro execution standby, the FEED button is enabled regardless of the
setting of this command. However, the paper cannot be fed.
[Default]
n=0
ESC d n
[Name]
Print and feed 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 n lines.
[Notes]
 This command sets the print starting position to the beginning of the line.
 This command does not affect the line spacing set by ESC 2 or ESC 3.
 The maximum paper feed amount is 1016 mm {40"}. If the paper feed amount (n ×
line spacing) of more than 1016 mm {40"} is specified, the printer feeds the paper only
1016 mm {40"}.
 Even when the set value exceeds the maximum with the BM sensor enabled in
standard mode, this command is effective. (BM = black mark.)
[Reference]
ESC 2, ESC 3
ESC { n
[Name]
Turns on/off upside-down printing mode
[Format]
ASCII
ESC {
n
Hex
1B
7B
n
Decimal
27
123 n
[Range]
0 ≤ n ≤ 255
[Description]
Turns upside-down printing mode on or off.
When the LSB of n is 0, turns upside-down printing mode off.
When the LSB of n is 1, turns upside-down printing mode on.
[Notes]
 Only the lowest bit of n is valid.
 This command is enabled only when processed at the beginning of a line in standard
mode.
 This command does not affect printing in page mode.
 In upside-down printing mode, the printer rotates the line to be printed by 180° and
then prints it.
110
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
[Default]
n=0
[Example]
When upside-down printing mode is off.
When upside-down printing mode is on
FS p n m
[Name]
Print NV bit image
[Format]
ASCII
FS
p
n
m
Hex
1C
70
n
m
Decimal
28
112 n
m
[Range]
1 ≤ n ≤ 255
0 ≤ m ≤ 3 , 48 ≤ m ≤ 51
[Description]
Prints NV bit image n using the mode specified by m.
m
Mode
Vertical Dot Density
Horizontal Dot Density
0, 48
Normal
203.2 dpi
203.2 dpi
1, 49
Double-width
203.2 dpi
101.6 dpi
2, 50
Double-height
101.6 dpi
203.2 dpi
3, 51
Quadruple
101.6 dpi
101.6 dpi
 n is the number of the NV bit image (defined using the FS q command).
 m specifies the bit image mode.
[Detail]
 NV bit image is a bit image defined in non-volatile memory by
FS q and printed by FS p.
 This command is not effective when the specified NV bit image has not been defined.
 In standard mode, this command is effective only when there is no data in the print
buffer.
 In page mode, this command is not effective.
 This command is not affected by print modes (emphasized, double-strike, underline,
character size, white/black reverse printing, or 90°rotated characters, etc.), except
upside-down printing mode.
 If the printing area width set by GS L and GS W for the NV bit image is less than one
vertical line, the following processing is performed only on the line in question.
However, in NV bit image mode, one vertical line means 1 dot in normal mode (m = 0,
48) and in double-height mode (m = 2, 50), and it means 2 dots in double-width mode
(m = 1, 49) and in quadruple mode (m = 3, 51).
(1) 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.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
111
U S E R
M A N U A L
(2) If the printing area width cannot be extended by one line vertically, the left margin
is reduced to accommodate one line vertically.
 If the downloaded bit-image to be printed exceeds one line, the excess data is not
printed.
 This command feeds dots (for the height n of the NV bit image) in normal and
double-width modes, and (for the height n X 2 of the NV bit image) in double-height
and quadruple modes, regardless of the line spacing specified by ESC 2 or ESC 3.
 After printing the bit image, this command sets the print position to the beginning of
the line and processes the data that follows as normal data.
[References]
ESC *, FS q, GS /, GS v 0
FS q n [xL xH yL yH d1...dk]1...[xL xH yL yH d1...dk]n
[Name]
Define NV bit image
[Format]
ASCII
FS
q
n
[xL xH yL yH d1...dk]1...[ xL xH yL yH d1...dk]n
Hex
1C
71
n
[xL xH yL yH d1...dk]1...[ xL xH yL yH d1...dk]n
Decimal
28
113 n
[xL xH yL yH d1...dk]1...[ xL xH yL yH d1...dk]n
[Range]
1 ≤ n ≤ 255
0 ≤ xL ≤ 255
0 ≤ xH ≤ 3 (when 1 ≤ (xL + xH x 256) ≤ 1023
0 ≤ yL ≤ 255
0 ≤ yL ≤1 (when 1 ≤ (yL + yH x 256) ≤ 288
0 ≤ d ≤ 255
k = (xL + xH x 256) x (yL + yH x 256) x 8
Total defined data area = 192K bytes
[Description]
 Define the NV bit image specified by n.
 n specifies the number of the defined NV bit image.
 xL, xH specifies (xL + xH x 256) x 8 dots in the horizontal direction for the NV bit
image you are defining.
 yL, yH specifies (yL + yH x 256) x 8 dots in the vertical direction for the NV bit image
you are defining.
[Notes]
 Frequent write command executions may damage the NV memory. Therefore, it is
recommended to write the NV memory 10 times or less a day.
 The printer performs a hardware reset after the procedure to place the image into the
NV memory. Therefore, user-defined characters, downloaded bit images, and macros
should be defined only after completing this command. The printer clears the receive
and print buffers and resets the mode to the mode that was in effect at power on. At
this time, DIP switch settings are checked again.
 This command cancels all NV bit images that have already been defined by this
command. The printer cannot redefine only one of several data definitions previously
defined. In this case, all data needs to be sent again.
 From the beginning of the processing of this command till the finish of hardware reset,
mechanical operations (including initializing the position of the print head when the
cover is open, paper feeding using the FEED button, etc.) cannot be performed.
112
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
 During processing of this command, the printer is BUSY when writing data to the user
NV memory and stops receiving data. Therefore it is prohibited to transmit the data,
including real-time commands, during the execution of this command.
 NV bit image is a bit image defined in non-volatile memory by FS q and printed by FS
p.
GS FF
[Name]
Feed marked paper to print starting position
[Format]
ASCII
GS
FF
Hex
1D
0C
Decimal
29
12
[Description]
Feeds the marked paper to the print starting position.
[Notes:]
 This command is enabled only when the BM sensor is set to be effective using with
DIP switch.
 This command sets the next print starting position to the beginning of the line.
 Even if this command is executed at the print starting position of the marked paper,
the printer does not feed the marked paper to the next print starting position.
[Reference]
GS ( F, FF
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
113
U S E R
M A N U A L
GS ! n
[Name]
Select character size
[Format]
ASCII
GS
!
n
Hex
1D
21
n
Decimal
29
33
n
0 ≤ n ≤ 255
[Range]
(1 ≤ vertical number of times ≤ 8, 1 ≤ horizontal number of times ≤ 8)
[Description]
Bit
Selects the character height using bits 0 to 2 and selects the character width using bits
4 to 7, as follows:
Off/On
Hex
Decimal
Function
0
1
2
See Table 2 [Height magnification]
Specification of height magnification.
See Table 1 [width magnification]
Specification of width magnification
3
4
5
6
7
Table 1 Width magnification
Table 2 Width magnification
Hex
Decimal
Width magnification
Hex
Decimal
Height magnification
00
0
1 (normal)
00
0
1 (normal)
10
16
2 (double-width)
01
1
2 (double-height)
20
32
3
02
2
3
30
48
4
03
3
4
40
64
5
04
4
5
50
80
6
05
5
6
60
96
7
06
6
7
70
112
8
07
7
8
[Notes]
 This command is effective for all characters (alphanumeric and Kanji), except for HRI
characters.
 If n is outside the defined range, this command is ignored.
 In standard mode, the vertical direction is the paper feed direction, and the horizontal
direction is perpendicular to the paper feed direction. However, when character
orientation changes in 90° clockwise-rotation mode, the relationship between
vertical and horizontal directions is reversed.
 In page mode, vertical and horizontal directions are based on the character
orientation.
 When characters are enlarged with different sizes on one line, all the characters on
the line are aligned at the baseline.
 The ESC ! command can also turn double-width and double-height modes on or off.
However, the setting of the last received command is effective.
114
CONFIDENTIAL
[Default]
n=0
[Reference]
ESC !
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS ∗ x y d1...d(x × y × 8)
[Name]
Define downloaded bit image
[Format]
ASCII
GS
∗
x
y
d1...d(x × y × 8)
Hex
1D
2A
x
y
d1...d(x × y × 8)
Decimal
29
42
x
y
d1 ...d(x × y × 8)
[Range]
1 ≤ x ≤ 255
1 ≤ y ≤ 48 (where x × y ≤ 1536)
0 ≤ d ≤ 255
[Description]
Defines a downloaded bit image using the number of dots specified by x and y.
 x specifies the number of dots in the horizontal direction.
 y specifies the number of dots in the vertical direction.
[Notes]
 The number of dots in the horizontal direction is x × 8; in the vertical direction it is
y × 8.
 If x × y is out of the specified range, this command is disabled.
 The d indicates bit-image data. Data (d) specifies a bit printed as 1 and not printed as
0.
 The downloaded bit image definition is cleared when:
(1) ESC @ is executed.
(2) ESC & is executed.
(3) Printer is reset or the power is turned off.
 The following figure shows the relationship between the downloaded bit image and
the printed data.
[Reference]
GS /
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
115
U S E R
M A N U A L
GS ( A pL pH n m
[Name]
Execute test print
[Format]
ASCII
GS
(
A
pL
pH
n
m
Hex
1D
28
41
pL
pH
n
m
Decimal
29
40
65
pL
pH
n
m
[Range]
(pL + pH × 256)=2 (where pL=2, pH=0)
0 ≤ n ≤ 2, 48 ≤ n ≤ 50
1 ≤ m ≤ 3, 49 ≤ m ≤ 51
[Description]
 Executes a test print with a specified test pattern on a specified paper.
 pL and pH set the number of parameters so that (pL + pH × 256) bytes. n specifies
the paper to be tested.
n specifies the paper to be tested.
n
Paper type
0, 48
Basic sheet (roll paper)
1, 49
Roll paper
2, 50
m specifies a test pattern
[Details]
n
Test pattern
1, 49
Hexadecimal dump
2, 50
Printer status print
3, 51
Rolling pattern print
 This command has enabled only when processed at the beginning of a line in
standard mode.
 This command is no effect in page mode.
 When this command is received during macro definition, the printer ends macro
definition and begins performing this command.
 After the test print is finished, the printer resets itself automatically. Therefore, data
already defined 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 the default value. The printer also
re-reads the DIP switch settings.
 The printer cuts the paper at the end of the test print.
 The printer goes BUSY while this command is executed.
116
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS ( F pL pH a m nL nH
[Name]
Set adjustment value(s)
[Format]
ASCII
GS
(
F
pL
pH
a
m
nL
Nh
Hex
1D
28
46
pL
pH
a
m
nL
nH
Decimal
29
40
70
pL
pH
a
m
nL
nH
[Range]
(pL + pH × 256) = 4 (where pL = 4, pH = 0)
1 ≤ a ≤ 2
m = 0, 48 or 1, 49
0 ≤ ( nL + nH × 256) ≤ 65535 (where 0 ≤ nL ≤ 255, 0 ≤ nH ≤ 255)
[Description]
This command is effective only when the BM sensor is enabled.
Sets adjustment values(s) for the printer operations specified by a.
 pL and pH specifies the number of the parameter such as a to (pL + pH × 256)
bytes.
 a specifies setting values for the positions to start printing and cutting.
a
Function
1
Sets value for the positions to start the printing.
2
Sets value for the positions to start the cutting.
 m specifies the direction of the adjustment
m
Function
0, 48
Specifies a forward paper feeding direction
1, 49
Specifies a backward paper feeding direction.
 nL and nH specifies the setting value to [(nL + nH × 256) × 0.125 mm].
[Details]
 If this command (three bytes for GS ( F) is executed during a macro definition, the
printer stops a macro definition and starts the execution process of this command.
 The adjustment value for the print starting position (a = 1) is affected with the
following commands: FF, GS FF
 The adjustment value for the paper cutting position (a = 2) is affected with the
following commands:GS V m n
 This command is stored in the receive buffer first from the host, then executed in the
execution process of other normal commands. Therefore, there may occur time delay
for the execution of this command after the printer receives this command. The delay
time depends on the status of the receive buffer.
[Default]
All adjustment values are set to “0”.
(At the factory setting, the print starting position and the cutting position are set to the
head position and the cutter position respectively when the BM sensor detects the BM.)
[Reference]
FF, GS FF, GS V
[Notes]
 Frequent write command executions by a NV memory write command (FS q, GS ( C,
GS ( E, GS ( F, or GS ( M) may damage the NV memory. Therefore, it is
recommended to limit writing data with the write command into the NV memory to 10
times or fewer a day.
 The printer may go BUSY during processing of this command. However, be sure not
to transmit data from the host computer while the printer is BUSY.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
117
U S E R
M A N U A L
GS ( K pL pH n m
[Name]
Select print control method(s)
[Format]
ASCII
GS
(
K
pL
pH
n
m
Hex
1D
28
4B
pL
pH
n
m
Decimal
29
40
75
pL
pH
n
m
[Parameters]
pL, pH specifies the number of bytes after n to (pL + pH × 256).
n specifies the function code.
m depends on the function code (n) See functional descriptions of this command.
[Range]
(pL + pH × 256) = 2 (where pL = 2, pH = 0)
1 ≤ n ≤ 255
For m, see each functional descriptions of this command.
[Description]
[Details]
 Specifies various settings for print control or operations of print mechanism.
n
Function no.
Function
48
Function 48
Selects the print control mode.
49
Function 49.
Sets the print density.
 If a not-supported parameter’s value is processed under the following conditions, this
command is ignored:
(1) In case of (pL + pH × 256) < 2
(2) In case that n is specified if n does not correspond to any functions of the printer.
(3) In case that m is out of range in each functions.
 The printer starts to process the specified function if all specified parameters are
satisfied.
 If the printer is in an offline state, this command is not executed because the printer
does not read the data.
 This command is stored in the receive buffer first from the host computer, then
executed in the execution process of other normal commands. Therefore, there may
be a time delay for the execution of this command after the Printer receives this
command. The delay time depends on the status of the receive buffer.
118
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS ( M pL pH a n m
[Name]
Customize printer control value(s)
[Format]
ASCII
GS
(
M
pL
pH
n
m
Hex
1D
28
4D
pL
pH
n
m
Decimal
29
40
77
pL
pH
n
m
[Range]
(pL + pH × 256) = 2 (pL = 2, pH = 0)
1 ≤ n ≤ 3, 49 ≤ n ≤ 51
0 ≤ m ≤ 1, 48 ≤ m ≤ 49
[Description]
Saves or loads the data which are defined with the commands.
n
1, 49
2, 50
3, 51
Function
Saves the data which are set by GS ( F to the user NV
memory
Loads the data which are set by GS ( F from the user
NV memory
Specifies to disable or enable the
automatic-data-loading process at the initial setting.
 m specifies the data as follows:
[Default]
m = 0, 48: The same with the initial setting value of GS ( F command described in this
specification.
m = 1, 49: Memory area to be stored.
Memory area to be stored (at the initial setting):
[Reference]
The same with the initial setting value of GS ( F command described in this
specification.
ESC @
[Notes]
 Frequent write command (FS q, GS ( C, GS ( E, GS ( F, or GS ( M) executions may
damage the NV memory. Therefore, it is recommended to limit writing data with the
write command into the NV memory to 10 times or fewer a day.
 If the printer becomes BUSY while processing this command, be sure not to transmit
data from the host computer when the printer is BUSY.
 If the power is turned off or the printer is reset via an interface while this command is
being executed, the printer may go into an abnormal condition. Be sure not to turn the
power off or let the printer be reset via an interface while this command is being
executed.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
119
U S E R
M A N U A L
<Function1> GS ( M pL pH n m ((n) = 1, 49)
[Format]
[Range]
ASCII
GS
(
M
pL
pH
n
m
Hex
1D
28
4D
pL
pH
n
m
Decimal
29
40
77
pL
pH
n
m
(pL + pH × 256) = 2 (pL = 2, pH = 0)
n = 1, 49
m = 1, 49
[Description]
 Saves the data which are set by GS ( F command to the user NV memory. If the data
will be written in the user NV memory which are already written with the same data,
the data saving process is not executed.
 If an error will occur in writing the data, the printer executes the memory error
process.
[Details]
 The Printer executes the following process:
[Default]
 Before saving the data to the NV memory, the printer sets BUSY for the interface.
In this case, the printer becomes BUSY regardless of the memory switch settings.
 Even if the ASB function is enabled, the printer does not transmit the ASB status.
However, if the status change occurs during the data transmission, the printer
transmits the ASB status after transmitting the data.
None
[Reference]
<Function 2> and <Function 3> of this command
<Function 2> GS ( M pL pH n m ((n) = 2, 50)
[Format]
[Range]
ASCII
GS
(
M
pL
pH
n
m
Hex
1D
28
4D
pL
pH
n
m
Decimal
29
40
77
pL
pH
n
m
(pL + pH × 256) = 2 (pL = 2, pH = 0)
n = 2, 50
0 ≤ m ≤ 1, 48 ≤ m ≤ 49
[Description]
 When m = 0 or 48, the setting value of GS ( F command is set to the default value
which is described in this specification.
 When m ≠ 0 or 48, the setting values are stored in area m of the memory.
[Details]
 This command is enabled only when processed at the beginning of a line in standard
mode.
 This command has no effect in page mode.
 If this command is received during macro definition, the printer ends the macro
definition, and begins performing this command.
 See <Function 1> of this command for the setting values for this function.
120
CONFIDENTIAL
[Default]
None
[Reference]
<Function 1>
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
<Function 3> GS ( M pL pH n m ((n) = 3, 51)
[Format]
[Range]
ASCII
GS
(
M
pL
pH
n
m
Hex
1D
28
4D
pL
pH
n
m
Decimal
29
40
77
pL
pH
n
m
(pL + pH × 256) = 2 (pL = 2, pH = 0)
n = 3, 51
0 ≤ m ≤ 1, 48 ≤ m ≤ 49
[Description]
 When m = 0 or 48, the printer does not load the data from the user NV memory at the
initialization. After the initialization, the setting value of GS ( F becomes the initial
value which is described in this specification.
 When m ≠ 0 or 48, the printer loads the data from the user NV memory at the
initialization. After the initialization, the setting value of GS ( F becomes the setting
values which are stored in area m of the memory.
 The specified data by this command are stored in the NV memory. If the data will be
written in the NV memory which are already written with the same data, the data
saving process is not executed.
 If an error will occur in writing the data, the printer executes the memory error
process.
[Details]
 When the data is automatically loaded, the initialization process is executed when
any of the following process is executed.
[Default]
 Power-on process by the power switch
 Power-on process when the hardware reset is executed by the interface reset
 Execution of ESC @
m=0
[Reference]
ESC @, <Function 1> of this command.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
121
U S E R
M A N U A L
GS ( k pL pH cn fn [parameters]
[Name]
Setup and print symbol
[Format]
ASCII
GS
(
k
pL
pH
cn
fn
[parameter]
Hex
1D
28
6B
pL
pH
cn
fn
[parameter]
Decimal
29
40
107 pL
pH
cn
fn
[parameter]
[Description]
 Various processes are performed to the symbol specified with cn.
cn
Type of symbol
48
PDF417 (two-dimensional codes)
49
QR Code (two-dimensional symbols)
50
MaxiCode (two-dimensional symbols)
Two-dimensional GS1 DataBar
(GS1 DataBar Stacked, GS1 DataBar Stacked Omnidirectional,
GS1 DataBar Expanded Stacked)
Composite Symbology (two-dimensional symbols)
51
52
cn
48
fn
65
Code
GS ( k pL pH
cn fn n
Function
Function
65
Description
Sets the number of columns for
PDF417.
66
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn m n
GS ( k pL pH
cn fn m
GS ( k pL pH
cn fn m
d1...dk
GS ( k pL pH
cn fn m
GS ( k pL pH
cn fn m
Function
66
Function
67
Function
68
Function
69
Function
70
Function
80
Sets the number of rows for
PDF417.
Sets the module width for
PDF417.
Sets the module height for
PDF417.
Sets the error correction level for
PDF417.
Specifies the options for PDF417.
Function
81
Function
82
Prints symbol data in the symbol
storage area.
Transmits the size of information
for the symbol data in the symbol
storage area.
67
68
69
70
80
81
82
122
CONFIDENTIAL
Stores received data in the symbol
storage area.
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
49
65
67
69
80
81
82
50
65
80
81
82
51
67
71
80
81
82
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
M A N U A L
GS ( k pL pH
cn fn n1 n2
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn m
d1...dk
GS ( k pL pH
cn fn m
GS ( k pL pH
cn fn m
Function
165
Function
167
Function
169
Function
180
QR Code: Selects the model.
Function
181
Function
182
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn m
d1...dk
GS ( k pL pH
cn fn m
GS ( k pL pH
cn fn m
Function
265
Function
280
QR Code: Prints the symbol data in
the symbol storage area.
QR Code: Transmits the size
information of the symbol data in
the symbol storage area.
MaxiCode: Selects the print mode.
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn nL nH
Function
367
Function
371
GS ( k pL pH
cn fn m n
d1...dk
GS ( k pL pH
cn fn m
Function
380
GS ( k pL pH
cn fn m
Function
382
Function
281
Function
282
Function
381
QR Code: Sets the size of module.
QR Code: Selects the error
correction level.
QR Code: Stores the data into the
symbol storage area.
MaxiCode: Stores data in the
symbol storage area.
MaxiCode: Prints symbol data in
the symbol storage area.
MaxiCode: Transmits size
information of the symbol data in
the symbol storage area.
Two-dimensional GS1 DataBar:
Sets the module width.
Two-dimensional GS1 DataBar:
Sets the maximum width of GS1
DataBar Expanded Stacked.
Two-dimensional GS1 DataBar:
Stores data in the symbol storage
area.
Two-dimensional GS1 DataBar:
Prints symbol data in the symbol
storage area.
Two-dimensional GS1 DataBar:
Transmits size information of the
symbol data in the symbol storage
area.
123
52
67
71
72
80
81
82
U S E R
M A N U A L
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn nL nH
Function
467
Function
471
GS ( k pL pH
cn fn n
GS ( k pL pH
cn fn m a b
d1...dk
GS ( k pL pH
cn fn m
Function
472
Function
480
GS ( k pL pH
cn fn m
Function
482
Function
481
Composite Symbology: Sets the
module width.
Composite Symbology: Sets the
maximum width of GS1 DataBar
Expanded Stacked.
Composite Symbology: Selects an
HRI font.
Composite Symbology: Stores
data in the symbol storage area.
Composite Symbology: Prints
symbol data in the symbol storage
area.
Composite Symbology: Transmits
size information of symbol data in
the symbol storage area.
 "Symbol data" refers to the data (d1…dk) received with <Function 080, 180, 280, 380,
480>.
 "Symbol storage area" refers to the range for storing data received with <Function
080,180, 280, 380, 480> before encoding.
[Notes]
 After transmitting <Function 082, 182, 282, 382, or 482>, do not transmit the other
data until its corresponding data is received.
 Only the ANK model has PDF417 (cn = 48).
[Reference]
124
CONFIDENTIAL
APPENDIX F
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS / m
[Name]
Print downloaded bit image
[Format]
ASCII
Hex
GS
1D
/
2F
m
m
Decimal
29
47
m
[Range]
0 ≤ m ≤ 3, 48 ≤ m ≤ 51
[Description]
Prints a downloaded bit image using the mode specified by m.
m selects a mode from the table below:
m
Mode
Vertical density
Horizontal density
0, 48
Normal
203.2 dpi
203.2 dpi
1, 49
Double-width
203.2 dpi
101.6 dpi
2, 50
Double-height
101.6 dpi
203.2 dpi
3, 51
Quadruple
101.6 dpi
[dpi: dots per 25.4 mm {1"}]
101.6 dpi
[Notes]
 This command is ignored if a downloaded bit image has not been defined.
 In standard mode, this command is effective only when there is no data in the print
buffer.
 This command has no effect in the print modes (emphasized, double-strike, underline,
character size, or white/black reverse printing), except for upside-down printing
mode.
 If the downloaded bit-image to be printed exceeds the printable area, the excess data
is not printed.
 See Figure 3.10.4 for the downloaded bit image development position in page mode.
 If the width of the printing area set by GS L and GS W is less than the width required
by the data sent with the GS / command; the following will be performed on the line in
question (but the printing cannot exceed the maximum printable area)
[Reference]
(1)
The width of the printing area is extended to the right to accommodate the
amount of data.
(2)
If step (1) does not provide sufficient width for the data, the left margin is
reduced to accommodate the data.
For each bit of data in normal mode (m = 0, 48) and double-height mode (m = 2, 50),
the printer prints one dot: for each bit of data in double-width mode (m = 1, 49) and
quadruple mode (m = 3, 51), the printer prints two dots.
GS ∗
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
125
U S E R
M A N U A L
GS :
[Name]
Start/end macro definition
[Format]
ASCII
GS
:
Hex
1D
3A
Decimal
29
58
[Description]
Starts or ends macro definition.
[Notes]
 Macro definition starts when this command is received during normal operation.
Macro definition ends when this command is received during macro definition.
 When GS ^ is received during macro definition, the printer ends macro definition and
clears the definition.
 Macro is not defined when the power is turned on.
 The defined contents of the macro are not cleared by ESC @. Therefore, ESC @ can
be included in the contents of the macro definition.
 If the printer receives GS : again immediately after previously receiving GS : the
printer remains in the macro undefined state.
 The contents of the macro can be defined up to 2048 bytes. If the macro definition
exceeds 2048 bytes, excess data is not stored.
[Reference]
GS ^
GS B n
[Name]
Turn white/black reverse printing mode
[Format]
ASCII
GS
B
n
Hex
1D
42
n
Decimal
29
66
n
[Range]
0 ≤ n ≤ 255
[Description]
Turns on or off white/black reverse printing mode.
 When the LSB of n is 0, white/black reverse mode is turned off.
 When the LSB of n is 1, white/black reverse mode is turned on.
[Notes]
 Only the lowest bit of n is valid.
 This command is available for built-in characters and user-defined characters.
 When white/black reverse printing mode is on, it also applies to character spacing set
by ESC SP.
 This command does not affect bit images, user-defined bit images, bar codes, HRI
characters, and spacing skipped by HT, ESC $, and ESC ¥.
 This command does not affect the space between lines.
 White/black reverse mode has a higher priority than underline mode. Even if
underline mode is on, it is disabled (but not canceled) when white/black reverse mode
is selected.
[Default]
126
CONFIDENTIAL
n=0
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS C 0 n m [obsolete command]
[Name]
Select counter print mode
[Format]
ASCII
GS
C
0
n
m
Hex
1D
43
30
n
m
Decimal
29
67
48
n
m
0 ≤ n ≤ 5
[Range]
0 ≤ m ≤ 2, 48 ≤ m ≤ 50
[Description]
Selects a print mode for the serial number counter.
 n specifies the number of digits to be printed as follows:
•
When n = 0, the printer prints the actual digits indicated by the number value.
•
When n ≠ 0, this command sets the number of digits to be printed to n.
 m specifies the printing position within the entire range of printed digits, as follows:
m
Printing position
Processing of digits less than those specified
0, 48
Align right
Adds spaces to the left.
1, 49
Align right
Adds 0 to the left.
2, 50
Align left
Adds spaces to the right.
 When the digits of the actual counter exceeds the set digits for n, prints the last n
digits of the counter.
[Notes]
 When n=0, the value of m has no meaning.
[Default]
n = 0, m = 0
[Reference]
GS C 1, GS C 2, GS C ;, GS c
[Example]
n = 3, m = 0
n = 3, m = 1
n = 3, m = 2
1
001
1
Δ indicates a space.
GS C 1 aL aH bL bH n r
[Name]
Select count mode (A)
[Format]
ASCII
GS
C
1
aL
aH
bL
bH
n
r
Hex
1D
43
31
aL
aH
bL
bH
n
r
Decimal
29
67
49
aL
aH
bL
bH
n
r
[Range]
0 ≤ aL ≤ 255
0 ≤ aH ≤ 255
0 ≤ bL ≤ 255
0 ≤ bH ≤ 255
0 ≤ n ≤ 255
0 ≤ r ≤ 255
[Description]
Selects a count mode for the serial number counter.
•
aL, aH or bL, bH specify the counter range.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
127
U S E R
[Notes]
M A N U A L
•
n indicates the stepping amount for counting up or down.
•
r indicates the repetition number with the counter value fixed.
 When [aL + aH × 256 < bL + bH × 256 and n ≠ 0 and r ≠ 0], sets count up
mode.
 When [aL + aH × 256 > bL + bH × 256 and n ≠ 0 and r ≠ 0], sets count down
mode.
 [aL + aH × 256 > bL + bH × 256 or n = 0 or r = 0], sets count stop.
 When in count up mode,[aL + aH × 256] is the minimum counter value, and [bL +
bH × 256] is the maximum counter value. When the counter value exceeds the
maximum value, restarts count up from the minimum count value.
 When in count down mode, [aL + aH × 256] is the maximum counter value, and [bL
+ bH × 256] is the minimum counter value. When the counter value is less than the
minimum value, restarts count down from the maximum value.
 When this command is executed, the internal counter that indicates the number of
times of repeated printing is cleared.
[Default]
aL = 1, aH = 0, bL = 255, bH = 255, n = 1, r = 1
[Reference]
GS C 0, GS C 2, GS C ;, GS c
GS C 2 nL nH
[Name]
Set counter
[Format]
ASCII
GS
C
2
nL
nH
Hex
1D
43
32
nL
nH
Decimal
29
67
50
nL
nH
[Range]
0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
[Description]
Sets the serial number counter value to (nL + nH × 256).
[Notes]
 When in count up mode, if the counter value set with this command is outside the
counter range set with GS C 1or GS C ;,the next execution of GS c forcedly changes
the counter value to the minimum value.
 When in count down mode, if the counter value set with this command is outside the
counter range set with GS C 1or GS C ;, the next execution of GS c forcedly changes
the counter value to the maximum value.
128
CONFIDENTIAL
[Default]
nL = 1, nH = 0
[Reference]
GS C 0, GS C 1, GS C ; , GS c
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS C ; sa ; sb ; sn; sr; sc;
[Name]
Select count mode (B)
[Format]
ASCII
GS
C
;
sa
;
sb
;
sn
;
sr
;
sc
;
Hex
1D
43
3B
sa
3B
sb
3B
sn
3B
sr
3B
sc
3B
Decimal
29
67
59
sa
59
sb
59
sn
59
sr
59
sc
59
[Range]
“0” ≤ sa ≤ “65535”
“0” ≤ sb ≤ “65535”
“0” ≤ sn ≤ “255”
“0” ≤ sr ≤ “255”
“0” ≤ sc ≤ “65535”
[Description]
Selects a count mode for the serial number counter and specifies the value of the
counter.
 sa, sb, sn, sr, and sc are all displayed in ASCII characters, using the codes for “0” to
“9.”
 sa and sb specify the counter range.
 sn indicates the stepping amount for counting up or down.
 sr indicates the repetition number with the counter value fixed.
 sc indicates the counter value.
[Notes]
 Count-up mode is specified when: sa < sb and sn ≠ “0” and sr ≠ “0”
 Count-down mode is specified when: sa > sb and sn ≠ “0” and sr ≠ “0”
 Counting stops when: sa = sb or sn = “0” or sr = “0”
 When count-up mode is specified, sa is the minimum counter value and sb is the
maximum counter value. If counting up reaches a value exceeding the maximum, it is
resumed with the minimum value. If the counter value set by sc is outside the counter
operation range, the counter value is forced to convert to the minimum value by
executing GS c.
 When count-down mode is specified, sa is the maximum counter value and sb is the
minimum counter value. If counting down reaches a value less than the minimum, it is
resumed with the maximum value. If the counter value set by sc is outside the counter
operation range, the counter value is forced to convert to the maximum value by
executing GS c.
 Parameters sa to sc can be omitted. If omitted, these argument values are
unchanged.
 Parameters sa to sc must not contain characters, except 0 to 9.
 If an incorrect syntax is used, the corresponding parameter setting has no effect, and
the data after that is processed as normal data.
[Default]
sa = “1,” sb = “65535,” sn = “1,” sr = “1,” sc = “1”
[Reference]
GS C 0, GS C 1, GS C 2, GS c
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
129
U S E R
M A N U A L
GS E n
[Name]
Select head control method
[Format]
ASCII
GS
E
n
Hex
1D
45
n
Decimal
29
69
n
[Range]
0 ≤ n ≤ 255
[Description]
Selects the head control method.
Bit
Off/On
Hex
Decimal
Function
0-3
Off
00
0
Undefined
4
5
6-7
(See Table [Print speed].)
Specifies the print speed.
Off
Undefined
00
0
Table [Print speed]
[Notes]
Speed level
Bit 5
Bit 4
Speed 1 (250 mm/s max.)
0
0
Speed 2 (200 mm/s max.)
0
1
Speed 3 (150 mm/s max.)
1
0
Speed 4 (100 mm/s max.)
1
1
High speed
Low speed
 In standard mode, this command is effective only at the starting position of the line.
 In two-part energization at speed level 1 is 126 mm/s maximum.
 In four-part energization, the print speed is always 59 mm/s maximum.
[Default]
Speed level 1.
GS H n
[Name]
Select print position of HRI characters
[Format]
ASCII
GS
H
n
Hex
1D
48
n
Decimal
29
72
n
[Range]
0 ≤ n ≤ 3, 48 ≤ n ≤ 51
[Default]
n=0
[Description]
 Selects the print position of HRI characters when printing a bar code.
[Notes]
n
Print position
0, 48
Not printed.
1, 49
Above the bar code.
2, 50
Below the bar code.
3, 51
Both above and below the bar code.
 HRI stands for Human Readable Interpretation.
 HRI characters are printed using the font specified by GS f.
130
CONFIDENTIAL
[Default]
n=0
[Reference]
GS f, GS k
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS I n
[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 ID of the printer specified.
 The printer IDs that can be specified are as follows
n
Type of printer ID
Value (Hex)
1, 49
Printer model ID
07
2, 50
Type ID
See Table [Type ID].
3, 51
ROM version ID
Depends on the ROM version
[Type ID]
Bit
Off/On
Hex
Decimal
Contents
Off
0
0
Multi-byte code characters not supported.
On
1
1
Multi-byte code characters supported.
On
0
0
Autocutter not installed.
On
2
2
Autocutter Installed.
Off
0
0
BM sensor disabled.
On
4
4
BM sensor enabled.
3
Off
0
0
Not used.
4
Off
0
0
Not used.
5
―
―
―
Not defined.abl
6
―
―
―
Not defined.abl
7
Off
0
0
Not used.
0
1
2
[Details]
 When ASB is enabled by GS a, it is necessary to identify the printer ID set by GS a
and the primer status obtained by ASB. See APPENDIX C for how to identify them.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
131
U S E R
M A N U A L
GS L nL nH
[Name]
Set left margin
[Format]
ASCII
GS
L
nL
nH
Hex
1D
4C
nL
nH
Decimal
29
76
nL
nH
[Range]
0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
[Description]
 Sets the left margin using nL and nH.
 The left margin is set to [(nL + nH × 256) × 0.125 mm].
[Notes]
 This command is effective only when processed at the beginning of the line in
standard mode.
 If this command is input in page mode, the printer performs only internal flag
operations.
 This command does not affect printing in page mode.
 The maximum left margin equals the printable area in the horizontal direction. If the
setting exceeds the printable area, the maximum value of the printable area is used.
 The left margin can be set only with each 8 bits by this command when the raster bit
image com and (GS v 0) is executed. If the left margin to set cannot be divided by
eight, the remainder is omitted.
Example)
When (nL + nH × 256) = 20, the setting value is 16.
132
CONFIDENTIAL
[Default]
nL = 0, nH = 0
[Reference]
GS W
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
GS T n
[Name]
Set print position to the beginning of print line
[Format]
ASCII
GS
T
n
Hex
1D
54
n
Decimal
29
84
n
[Range]
n = 0, 1, 48, 49
[Description]
Sets the print position to the beginning of print line.
 n specifies the data processing method in the print buffer.
n
Printing position
0, 48
Sets the print position to the beginning of print line after deleting
all data in the print buffer.
1, 49
Set the print position to the beginning of print line after printing
all data in the print buffer
(1) GS V m (2) GS V m n
[Name]
Select cut mode and cut paper
[Format]
(1)
(2)
[Range]
ASCII
GS
V
m
Hex
1D
56
m
Decimal
29
86
m
ASCII
GS
V
m
n
Hex
1D
56
m
n
Decimal
29
86
m
n
(1) m = 1, 49
(2) m = 66, 0 ≤ n ≤ 255
[Description]
[Details]
Selects a mode for cutting paper and executes paper cutting. The value of m selects the
mode as follows:
m
Print mode
1, 49
Cuts paper
66
Feeds paper (cutting position + [n × 0.125 mm]), and cuts the
paper.
 The cutting depends on the autocutter unit installed.
 In standard mode, cutting is enabled only when cutting at the beginning of the line is
enabled.
[Details of (1) and (2)]
 Cuts paper.
[Details of (2)]
 When n = 0, the printer feeds the paper to the cutting position and cuts it.
 When n ≠ 0, the printer feeds the paper to (cutting position + [n × 0.125 mm
{0.0049”}]) and cuts it.
 When the BM sensor is set to be effective with DIP switch 1-1, [(Value which is set by
GS ( F) + 0.125 mm] is applied.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
133
U S E R
M A N U A L
GS W nL nH
[Name]
Set printing area width
[Format]
ASCII
GS W
nL
nH
Hex
1D 57
nL
nH
Decimal
29
nL
nH
[Range]
87
0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
[Description]
Sets the printing area width to the area specified by nL and nH.
 The printing area width is set to [(nL + nH × 256) × 0.125 mm].
[Notes]
 This command is effective only when processed at the beginning of the line.
 If this command is input in page mode, the printer performs only internal flag
operations.
 This command does not affect printing in page mode.
 If the setting exceeds the printable area, the maximum value of the printable area is
used.
 The setting by GS L takes precedence over the setting by GS W. If the [left margin +
printing area width] exceeds the printable area, the printer uses [Printable area width
- left margin]. However, the setting by GS W is still reserved, even when it is not used
in the current printing.
 If the width set for the printing area is less than the width of one character, when the
character data is developed, the following processing is performed:
[Reference]
GS L
GS ^ r t m
[Name]
Execute macro
[Format]
ASCII
GS
^
r
t
m
Hex
1D
5E
r
t
m
Decimal
29
94
r
t
m
[Range]
0 ≤ r ≤ 255
0 ≤ t ≤ 255
0 ≤ m ≤ 1
[Description]
Executes a macro.
 r specifies the number of times to execute the macro.
134
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
 t specifies the waiting time for executing the macro.
 m specifies macro executing mode.
When the LSB of m = 0:
The macro executes r times continuously at the interval specified by t.
When the LSB of m = 1:
After waiting for the period specified by t, the PAPER OUT LED indicators
flash and the printer waits for the FEED button to be pressed. After the
button is pressed, the printer executes the macro once. The printer repeats
the operation r times.
[Notes]
 The waiting time is approximately (t × 100 ms) for every macro execution.
 If this command is received while a macro is being defined, the macro definition is
aborted and the definition is cleared.
 If the macro is not defined or if r is 0, this command is ignored.
 When the macro is executed (m = 1), paper cannot be fed by using the FEED button.
[Reference]
GS :
GS c
[Name]
Print counter
[Format]
ASCII
GS
c
Hex
1D
63
Decimal
29
99
[Description]
Sets the serial counter value in the print buffer and increments or decrements the
counter value.
[Notes]
 After setting the current counter value in the print buffer as print data (a character
string), the printer counts up or down based on the count mode set. The counter
value in the print buffer is printed when the printer receives a print command or is in
the buffer-full state.
 The counter print mode is set by GS C 0.
 The counter mode is set by GS C 1 or GS C.
 In count-up mode, if the counter value set by this command goes out of the counter
operation range set by GS C 1 or GS C, it is forced to convert to the minimum value.
 In count-down mode, if the counter value set by this command goes out of the
counter operation range set by GS C 1 or GS C, it is forced to convert to the
maximum value.
[Reference]
GS C 0, GS C 1, GS C 2, GS C;
GS f n
[Name]
Select font for Human Readable Interpretation (HRI) characters
[Format]
ASCII
GS
f
n
Hex
1D
66
n
Decimal
29
102 n
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
135
U S E R
M A N U A L
[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 (12 × 24)
1, 49
Font B (9 × 17)
 HRI stands for Human Readable Interpretation.
[Notes]
 HRI characters are printed on the position specified by GS H.
[Default]
n=0
[Reference]
GS H, GS k
GS h n
[Name]
Select bar code height
[Format]
ASCII
GS
h
n
Hex
1D
68
n
Decimal
29
104 n
[Range]
1 ≤ n ≤ 255
[Description]
Selects the height of the bar code.
n specifies the number of dots in the vertical direction.
[Default]
n = 162
[Reference]
GS k
<A> GS k m d1...dk NUL
<B> GS k m n d1...dn
[Name]
Print bar code
[Format]
<A> ASCII
GS
k
m
d1
dk
NUL
Hex
1D
6B
m
d1
dk
00
Decimal
29
107 m
d1
dk
0
GS
k
m
n
d1...dn
Hex
1D
6B
m
n
d1...dn
Decimal
29
107 m
n
d1...dn
<B> ASCII
[Range]
<A> 0 ≤ m ≤ 6 (k and d depend on the bar code system used)
<B> 65 ≤ m ≤ 73 (n and d depend on the bar code system used)
[Description]
Selects a bar code system and prints the bar code.
m selects a bar code system as follows:
<Function A>
m
136
CONFIDENTIAL
Bar code system
Range of k
Range of d
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
0
UPC-A
k =11, 12
48 ≤ d ≤ 57
1
UPC-E
6 ≤ k ≤ 8, k =11, 12
48 ≤ d ≤ 57[Where k=7,8,11,12, d1=48]
2
JAN13 / EAN13
k = 12, 13
48 ≤ d ≤ 57
3
JAN 8 / EAN8
k = 7, 8
48 ≤ d ≤ 57
4
CODE39
1 ≤ k
5
ITF
48 ≤ d ≤ 57, 65 ≤ d ≤ 90, d = 32, 36, 37,
42,43, 45, 46, 47
48 ≤ d ≤ 57
6
CODABAR (NW-7)
2 ≤ k (even number)
2 ≤ k
48 ≤ d ≤ 57, 65 ≤ d ≤ 68, 97 ≤ d ≤
100,d=36, 43, 45, 46, 47, 58[Where 65 ≤ d1 ≤
68, 65≤ dk ≤68,97 ≤ d1 ≤100, 97≤ dk ≤ 100]
 k of <Function A> indicates the number of bar code data.
 d specifies bar code data.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
137
U S E R
m
Bar code system
M A N U A L
Range of n
Range of d
65
UPC-A
n = 11, 12
48 ≤ d ≤ 57
66
UPC-E
6 ≤ n ≤ 8,
48 ≤ d ≤ 57 [Where n=7,8,11,12, d1=48]
n =11, 12
67
JAN13 (EAN13)
n = 12, 13
48 ≤ d ≤ 57
68
JAN 8 (EAN8)
n = 7, 8
48 ≤ d ≤ 57
69
CODE39
1 ≤ n ≤ 255
70
ITF
71
CODABAR (NW-7)
2 ≤ n ≤ 254
(even number)
2 ≤ n ≤ 255
48 ≤ d ≤ 57, 65 ≤ d ≤ 90, d=32, 36, 37,
42, 45,46, 47
48≤ d ≤ 57
72
CODE93
1 ≤ n ≤ 255
73
CODE128
2 ≤ n ≤ 255
0 ≤ d ≤ 127 [Where d1=123, 65 ≤ d2 ≤
67]
74
GS1-128
2 ≤ n ≤ 255
0 ≤
75
GS1 DataBar
Omnidirectional
GS1 DataBar
n=13
48 ≤ d ≤ 57
n=13
48 ≤ d ≤ 57
n=13
48 ≤ d ≤ 57 [Where 48 ≤ d1 ≤ 49]
2 ≤ n ≤255
32 ≤ d ≤ 34, 37 ≤ d ≤ 63, 65 ≤ d ≤ 90,
d=95,97 ≤ d ≤ 122, d=123[Where d1=40,
48 ≤ d2 ≤ 57, 48 ≤ d3 ≤ 57, or 48 or d1
≤ 57, 48 ≤ d2 ≤ 57]
76
48 ≤ d ≤ 57, 65 ≤ d ≤ 68, 97 ≤ d ≤
100,d=36, 43, 45, 46, 47, 58 [Where 65 ≤
d1 ≤ 68, 65 ≤ dn ≤ 68,97 ≤ d1 ≤ 100,
97 ≤ dn ≤ 100]
0 ≤ d ≤ 127
d ≤
127
Truncated
77
GS1 DataBar
Limited
78
GS1 DataBar
Expanded
 n of <Function B> specifies the number of bytes of bar code data.
 d specifies bar code data.
[Notes]
Users must secure the quiet zone (left or right side space area defined by the bar code
standard) for bar code printing.
<Notes on Function A>
 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 12 bytes of bar code data and processes the following data as
normal data.
 When the bar code system used is JAN13 (EAN13), the printer prints the bar code
after receiving 13 bytes of bar code data and processes the following data as normal
data.
 When the bar code system used is JAN8 (EAN8), the printer prints the bar code after
receiving 8 bytes of bar code data and processes the following data as normal data.
 The number of data for the ITF bar code must be even numbers. When an odd
number of bytes of data is input, the printer ignores the last received data.
<Notes on Function B>
138
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
 n indicates the number of bar code data bytes, and the printer processes n bytes from
the next character data as bar code data.
 If n is outside the specified range, the printer stops command processing and
processes the following data as normal data.
[Notes on standard mode]
 If d is outside the specified range, the printer only feeds paper and processes the
following data as normal data.
 If the horizontal size exceeds 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 specified by ESC 2 or ESC 3.
 This command is enabled only when no data exists in the print buffer. When data
exists in the print buffer, the printer processes the data following m as normal data.
 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,
character size, white/black reverse printing, or 90° rotated character, etc.), except
for upside-down printing mode.
[Notes on page mode]
 This command develops bar code data in the print buffer, but does not print it. After
processing bar code data, this command moves the print position to the right side dot
of the bar code.
 If d is out of the specified range, the printer stops command processing and
processes the following data as normal data. In this case the data buffer position
does not change.
 If bar code width exceeds the printing area, the printer does not print the bar code,
but moves the data buffer position to the left side out of the printing area.
 See Section 3.10, Page Mode.
[When CODE93 (m = 72) is used]
 The printer prints an HRI character ( ) as the start character at the beginning of the
HRI character string.
 The printer prints an HRI character ( ) as a stop character at the end of the HRI
character string.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
139
U S E R
M A N U A L
 The printer prints HRI characters (■+ an alphabetic character) as a control
character(<00>H to <1F>H and <7F>H):
Control character
ASCII
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
Control character
Hex
Decimal
HRI
character
ASCII
Hex
Decimal
HRI
character
0
0
■U
DLE
10
16
■P
1
1
■A
DC1
11
17
■Q
2
2
■B
DC2
12
18
■R
3
3
■C
DC3
13
19
■S
4
4
■D
DC4
14
20
■T
5
5
■E
NAK
15
21
■U
6
6
■F
SYN
16
22
■V
7
7
■G
ETB
17
23
■W
8
8
■H
CAN
18
24
■X
9
9
■I
EM
19
25
■Y
0A
10
■J
SUB
1A
26
■Z
0B
11
■K
ESC
1B
27
■A
0C
12
■L
FS
1C
28
■B
0D
13
■M
GS
1D
29
■C
0E
14
■N
RS
1E
30
■D
0F
15
■O
31
127
■E
■T
US
1F
DEL
7F
<Example> Printing GS k 72 7 67 111 100 101 13 57 51
When CODE128 (m = 73) is used:
 See APPENDIX E for the information for the CODE128 bar code and its code table.
 When using CODE128 in this printer, take the following points into account for data
transmission:
(1) The top of the bar code data string must be the code set selection character
CODE A, CODE B, or CODE C), which selects the first code set.
140
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
(2) Special characters are defined by combining two characters "{" and one
character. The ASCII character "{" is defined by transmitting "{" twice
consecutively.
Specific character
Transmit data
ASCII
Hex
Decimal
SHIFT
CODE A
{S
{A
7B, 53
7B, 41
123, 83
123, 65
CODE B
CODE C
{B
{C
7B, 42
7B, 43
123, 66
123, 67
FNC1
FNC2
{1
{2
7B, 31
7B, 32
123, 49
123, 50
FNC3
FNC4
{3
{4
7B, 33
7B, 34
123, 51
123, 52
"{"
{{
7B, 7B
<Example> Example data for printing "No. 123456"
123, 123
This example, the printer first prints "No." using CODE B, then prints the following
numbers using CODE C.
GS k 73 10 123 66 78 111 46 123 67 12 34 56
 If the top of the bar code data is not the code set selection character, the printer stops
command processing and processes the following data as normal data.
 If the combination of "{" and the following character does not apply any special
character, the printer stops command processing and processes the following data as
normal data.
 If the printer receives characters that cannot be used in the special code set, the
printer stops command processing and processes the following data as normal data.
 The printer does not print HRI characters that correspond to the shift characters or
code set selection characters.
 HRI character for the function character is space.
 HRI characters for the control character (<00>H to <1F>H and <7F>H) are space.
 <Others>Be sure to keep spaces on both right and left sides of a bar code.(Spaces
are different depending on the types of the bar code.)
[Reference]
GS H, GS f, GS h, GS w
GS r n
[Name]
Transmit status
[Format]
ASCII
GS
r
n
Hex
1D
72
n
Decimal
29
114 n
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
141
U S E R
M A N U A L
[Range]
n = 1, 49
[Description]
Transmits the status specified by n as follows:
n
Function
1, 49
Transmits paper sensor status
 When using a serial interface
[Notes]
 When DTR/DSR control is selected, the printer transmits only 1 byte after confirming
the host is ready to receive data (DSR signal is SPACE). If the host computer is not
ready to receive data (DSR signal is MARK), the printer waits until the host is ready.
 When XON/XOFF control is selected, the printer transmits only 1 byte without
confirming the condition of the DSR signal.
 This command is executed when the data in the receive buffer is developed.
 Therefore, there may be a time lag between receiving this command and transmitting
the status, depending on the receive buffer status.
 When Auto Status Back (ASB) is enabled using GS a, the status transmitted by GS r
and the ASB status must be differentiated using the table in APPENDIX C.
 The status types to be transmitted are shown below:
Paper sensor status (n = 1, 49):
Bit
Off/On
Hex
Decimal
Status for ASB
Off
00
0
Roll paper near-end sensor: paper adequate.
On
03
3
Roll paper near-end sensor: paper near end.
Off
00
0
Roll paper end sensor: paper present.
On
(0C)
(12)
Roll paper end sensor: paper not present.
4
Off
00
0
Not used.
5,6
-
-
-
Undefined.
7
Off
00
0
Not used.
0, 1
2, 3
Bits 2 and 3: When the paper end sensor detects a paper end, the printer goes offline and does not
execute this command. Therefore, bits 2 and 3 do not transmit the status of paper end.
[Reference]
DLE EOT, GS a
GS v 0 m xL xH yL yH d1...dk
[obsolete command]
GS ( L <Function 112 and 50>, which is the upward-compatible command replacing GS v 0, is
recommended to use, since GS v 0 is an obsolete command in the ESC/POS command system.
[Name]
Print raster bit image
[Format]
ASCII
GS
v
0
m
xL
xH
yL
yH
d1...dk
Hex
1D
76
30
m
xL
xH
yL
yH
d1...dk
Decimal
29
118 48
m
xL
xH
yL
yH
d1...dk
[Range]
0 ≤ m ≤ 3, 48 ≤ m ≤ 51
1 ≤ xL ≤ 255
1 ≤ xH ≤ 255 [where 1 ≤ (xL+xH × 256) ≤ 128]
0 ≤ yL ≤ 255
0 ≤ yH ≤ 15 [where 1 ≤ (yL+yH × 256) ≤ 4095]
142
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
0 ≤ d ≤ 255
k = (xL+xH × 256) × (yL+yH × 256) [where k ≠ 0]
[Description]
 Prints a raster bit image using the mode specified by m.
m
Mode
Vertical direction
Horizontal direction
0, 48
Normal
203.2 dpi
203.2 dpi
1, 49
Double-width
203.2 dpi
101.6 dpi
2, 50
Double-height
101.6 dpi
203.2 dpi
3, 51
Quadruple
101.6 dpi
101.6 dpi
[dpi: dots per inch (25.4 mm)]
 xL, xH specify the number of bytes in the horizontal direction as (xL + xH × 256).
 yL, yH specify the number of dots in the vertical direction as (yL + yH × 256).
GS w n
[Name]
Set bar code width
[Format]
ASCII
GS
w
n
Hex
1D
77
n
Decimal
29
119 n
[Range]
2 ≤ n ≤ 6
[Description]
Sets the horizontal size of the bar code.
n specifies the bar code width as follows:
Binary-level bar code
n
Module width (mm) for
Multi-level bar code
2
Thin element width
(mm)
Thick element width
(mm)
0.250
0.250
0.625
3
0.375
0.375
1.000
4
0.560
0.500
1.250
5
0.625
0.625
1.625
6
0.750
0.750
2.000
 Multi-level bar codes are as follows:
UPC-A, UPC-E, JAN13, JAN8, CODE93, CODE128
 Binary-level bar codes are as follows:
CODE39, ITF, CODABAR
[Default]
n=3
[Reference]
GS k
Multi-byte Code Character Control Commands
(Supported by Japanese/Simplified Chinese/Traditional Chinese/Korean models)
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
143
U S E R
M A N U A L
FS ! n
[Name]
Set print mode(s) for Kanji characters
[Format]
ASCII
FS
!
n
Hex
1C
21
n
Decimal
28
33
n
[Range]
0 ≤ n ≤ 255
[Description]
Sets the print mode (Double-height, double-width, Kanji underline) for multi-byte code
characters, using n as follows:
Bit
Off/On
Hex
Decimal
0, 1
-
00
0
Reserved
Off
00
0
Double-width mode is OFF.
On
04
4
Double-width mode is ON.
Off
00
0
Double-height mode is OFF.
On
08
8
Double-height mode is ON.
-
00
0
Reserved
Off
00
0
Underline mode for Kanji characters is OFF.
On
08
128
Underline mode for Kanji characters is ON.
2
3
4-6
7
Function
FS &
[Name]
Select Kanji character mode
[Format]
ASCII
FS
&
Hex
1C
26
Decimal
28
38
[Description]
Selects Kanji character mode.
FS - n
144
CONFIDENTIAL
[Name]
Turn underline mode on/off for Kanji characters
[Format]
ASCII
FS
-
n
Hex
1C
2D
n
Decimal
28
45
n
[Range]
0 ≤ n ≤ 2, 48 ≤ n ≤ 50
[Default]
n=0
[Description]
Turns underline mode for Kanji characters on or off, based on the following values of n
for both receipt and slip.
n
Function
0, 48
1, 49
Turns off underline mode for Kanji characters
Turns on underline mode for Kanji characters (1-dot thick)
2, 50
Turns on underline mode for Kanji characters (2-dot thick)
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
FS .
[Name]
Cancel Kanji character mode
[Format]
ASCII
FS
.
Hex
1C
2E
Decimal
28
46
[Description]
Cancels Kanji character mode.
FS 2 c1 c2 d1...dk
[Name]
Define user-defined Kanji characters
[Format]
ASCII
FS
2
c1
c2
d1...dk
Hex
1C
32
c1
c2
d1...dk
Decimal
28
50
c1
c2
d1...dk
[Range]
c1 and c2 indicate character codes for the defined characters. The range of values for
c1 and c2 differs depending on the character code system used.
Model type
Japanese model (JIS code system)
Japanese model (SHIFT-JIS code system)
Simplified Chinese model (GB18030)
Traditional Chinese model
0 ≤ d ≤ 255
c1
c1 = 77
c1 = EC
c1 = FE
c2
21
40
80
A1
≤
≤
≤
≤
c2
c2
c2
c2
≤
≤
≤
≤
7E
7E
9E
FE
k = 72
[Description]
Defines user-defined Kanji characters (di…dk) for the character codes specified by c1
and c2.
FS S n1 n2
[Name]
Set left- and right Kanji character spacing
[Format]
ASCII
FS
S
n1
n2
Hex
1C
53
n1
n2
Decimal
28
83
n1
n2
[Range]
0 ≤ n1 ≤ 255
0 ≤ n2 ≤ 255
[Default]
n1 = 0, n2 = 0
[Description]
Sets left and right Kanji character spacing to n1 and n2, respectively.
 The left-side character spacing is [n1 × 0.125 mm], and the right-side character
spacing is [n2 × 0.125 mm].
[Note]
 Settable maximum left and right space is both 31.91 mm {255/203"}.
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
145
U S E R
M A N U A L
FS W n
[Name]
Turn on/off quadruple-size mode for Kanji characters
[Format]
ASCII
FS
W
n
Hex
1C
57
n
Decimal
28
87
n
[Range]
0 ≤ n ≤ 255
[Default]
n=0
[Description]
 Turn on or off quadruple-size mode for Kanji characters.
 When the LSB of n is 0, quadruple-size mode for Kanji characters is turned off.
 When the LSB of n is 1, quadruple-size mode for Kanji characters is turned on.
146
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014
U S E R
M A N U A L
MB9B310_AN706-00093-1v0-E
Spansion  Controller Manual
FM3 Family
32-BIT MICROCONTROLLER
MB9B310N Application Note
September 2014 Rev. 1.0
Published:
Edited:
September 18, 2014, MB9B310_AN706-00093-1v0-E
CONFIDENTIAL
Span
Marketing Communicatio
147
U S E R
M A N U A L
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control,
mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
148
CONFIDENTIAL
MB9B310_AN706-00093-1v0-E, September 18, 2014