Printer

Last modified by Hunter on 2023/08/24 18:14

Printer

TSPL Label Printer

Introduction

TSPL label printer protocol supports following models.

Setting Step

Select the protocol

  • Create a new project, select the TSPL label printer protocol as shown below.

12.PLC Protocol_html_a2bec264816230db.png

Set parameters

  • The connection between the TSPL label printer and the HMI is via the USB-A interface, no need to configure serial port parameters.

Printer register

RegisterSystemRangeFunction
TSPL_SPdecimal0 - 1Set the paper size
TSPL_PTdecimal0 - 1999Print text
TSPL_PQdecimal0 - 999Print QR code
TSPL_PBdecimal0 - 999Print barcode
TSPL_PRdecimal0 - 1Print offset
TSPL_PNdecimal0 - 0Trigger printing
TSPL_PSdecimal0 - 0Print status
  • Set paper size:
    • TSPL_SP0: width of paper, unit: mm.
    •  TSPL_SP1: height of paper, unit: mm.
  • Print text:
    • TSPL_PT can print up to 20 texts. TSPL_PT0-TSPL_PT99 is the first text; TSPL_PT100-TSPL_PT199 is the second text; … TSPL_PT1000-TSPL_PT1999 is the 20th text.
    • Detailed parameter settings of each text is shown as below table. For example, first text,TSPL_PT0-TSPL_PT99.
RegisterFunctionDescription
TSPL_PT0X coordinateUnit: dot
TSPL_PT1YcoordinateUnit: dot
TSPL_PT2Rotation angle

0: 0 degrees

1: 90 degrees

2: 180 degrees

3: 270 degrees

TSPL_PT3SizeRange: 0-3
TSPL_PT4 - TSPL_PT99QR code content(text content)Use character input device to configure

By analogy, we can know the text information configuration of the 2nd to 20th QR codes

Print QR code:

  • TSPL_PQ can print up to 10 QR codes. TSPL_PQ0-TSPL_PQ99 is the first QR code; TSPL_PQ100-TSPL_PQ199 is the second QR code; ...., TSPL_PQ900-TSPL_PQ999 is the tenth QR code.
  • Specific parameter description of each item: for example, the first QR code, TSPL_PQ0-TSPL_PQ99:
RegisterFunctionDescription
TSPL_PQ0X coordinateUnit: dot
TSPL_PQ1YcoordinateUnit: dot
TSPL_PQ2Rotation angle

0: 0 degrees

1: 90 degrees

2: 180 degrees

3: 270 degrees

TSPL_PQ3SizeRange: 0-5
TSPL_PQ4 - TSPL_PQ99QR code contentUse character input device to configure
  • By analogy, we can know the text information configuration of the 2nd to 20th QR codes.

Print bar code:

  • TSPL_PB can print up to 10 barcodes. TSPL_PB0-TSPL_PB99 is the first bar code; TSPL_PB100-TSPL_PB199 is the second bar code; ..., TSPL_PB900-TSPL_PB999 is the tenth bar code.
  • Specific parameter description of each item: for example, the first barcode, TSPL_PB0-TSPL_PB99:
RegisterFunctionDescription
TSPL_PB0X coordinateUnit: dot
TSPL_PB1YcoordinateUnit: dot
TSPL_PB2Rotation angle

0: 0 degrees

1: 90 degrees

2: 180 degrees

3: 270 degrees

TSPL_PB3heightUnit: dot
TSPL_PB4widthRange:0-2
TSPL_PB5- TSPL_PB99Bar code contentUse character input device to configure

By analogy, we can know the text information configuration of the 2nd to 20th bar codes.

Print offset:

  • TSPL_PR0: X coordinate offset, unit: mm;
  • TSPL_PR1: Y coordinate offset, unit: mm.

Trigger printing:

  • TSPL_PN0 = 1: trigger the printer to start printing.

Printing status:

  • TSPL_PS0 = 1: The printing is normal.
  • TSPL_PS0 = 1: The printing is abnormal.

Print picture

  • For the function of printing pictures, please refer to the configuration of [Printer object].

Conversion between dot and mm

  • Dot is the meaning of pixels. For the conversion between dot and mm, please refer to the printer manual or consult the customer service of the corresponding printer manufacturer. For example, SPRT TL21: 8 dots / mm, that is, 1mm = 8 dot.

EpsonTM Series

HMI Settings

ItemSettingsNote
ProtocolEPSON-TM-T82II/TM-XXX 
ConnectionRS232 
Baud rate9600~115200 
Data bit8 
ParityNone 
Stop bit1 
PLC station No.1 

Each printer protocol has default parameter. These parameters could be configured by addresses. Error parameters may cause print failure.

Printer Settings

AddressDescriptionValue
HSW10603Print direction (only valid for print function)1
HSW10604Dot Matrix Type1
HSW10605Print width (depending on printer and paper)384
HSW10606Printer instruction type1
HSW10607Paper cut2
HSW10608Alignment (only valid for print function)1

Cable Wiring

12.PLC Protocol_html_5e9a81a14106da9e.png

12.PLC Protocol_html_1897d92be6948d58.png

✎Note: COM3 only available in PI8000/PI9000 series.