Wiki source code of Printer

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

Show last authors
1 = {{id name="HPrinter"/}}**Printer** =
2
3 == {{id name="HTSPLLabelPrinter"/}}**TSPL Label Printer** ==
4
5 **Introduction**
6
7 TSPL label printer protocol supports following models.
8
9 * SPRT TL21: [[https:~~/~~/www.sprinter.com.cn/show-60-62-1.html>>url:https://www.sprinter.com.cn/show-60-62-1.html]]
10 * DL-888D: [[https:~~/~~/www.deliworld.com/product/detail/7624>>url:https://www.deliworld.com/product/detail/7624]]
11
12 **Setting Step**
13
14 Select the protocol
15
16 * Create a new project, select the TSPL label printer protocol as shown below.
17
18 {{id name="I12.PLCProtocol_html_a2bec264816230db.png"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_63dca7e1d2bfcd53.png||alt="12.PLC Protocol_html_a2bec264816230db.png" height="331" width="495"]]
19
20 Set parameters
21
22 * The connection between the TSPL label printer and the HMI is via the USB-A interface, no need to configure serial port parameters.
23
24 Printer register
25
26 |**Register**|**System**|**Range**|**Function**
27 |TSPL_SP|decimal|0 - 1|Set the paper size
28 |TSPL_PT|decimal|0 - 1999|Print text
29 |TSPL_PQ|decimal|0 - 999|Print QR code
30 |TSPL_PB|decimal|0 - 999|Print barcode
31 |TSPL_PR|decimal|0 - 1|Print offset
32 |TSPL_PN|decimal|0 - 0|Trigger printing
33 |TSPL_PS|decimal|0 - 0|Print status
34
35 * Set paper size:
36 ** TSPL_SP0: width of paper, unit: mm.
37 ** TSPL_SP1: height of paper, unit: mm.
38 * Print text:
39 ** 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.
40 ** Detailed parameter settings of each text is shown as below table. For example, first text,TSPL_PT0-TSPL_PT99.
41
42 |**Register**|**Function**|**Description**
43 |TSPL_PT0|X coordinate|Unit: dot
44 |TSPL_PT1|Ycoordinate|Unit: dot
45 |TSPL_PT2|Rotation angle|(((
46 0: 0 degrees
47
48 1: 90 degrees
49
50 2: 180 degrees
51
52 3: 270 degrees
53 )))
54 |TSPL_PT3|Size|Range: 0-3
55 |TSPL_PT4 - TSPL_PT99|QR code content(text content)|Use character input device to configure
56
57 By analogy, we can know the text information configuration of the 2nd to 20th QR codes
58
59 Print QR code:
60
61 * 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.
62 * Specific parameter description of each item: for example, the first QR code, TSPL_PQ0-TSPL_PQ99:
63
64 |**Register**|**Function**|**Description**
65 |TSPL_PQ0|X coordinate|Unit: dot
66 |TSPL_PQ1|Ycoordinate|Unit: dot
67 |TSPL_PQ2|Rotation angle|(((
68 0: 0 degrees
69
70 1: 90 degrees
71
72 2: 180 degrees
73
74 3: 270 degrees
75 )))
76 |TSPL_PQ3|Size|Range: 0-5
77 |TSPL_PQ4 - TSPL_PQ99|QR code content|Use character input device to configure
78
79 * By analogy, we can know the text information configuration of the 2nd to 20th QR codes.
80
81 Print bar code:
82
83 * 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.
84 * Specific parameter description of each item: for example, the first barcode, TSPL_PB0-TSPL_PB99:
85
86 |**Register**|**Function**|**Description**
87 |TSPL_PB0|X coordinate|Unit: dot
88 |TSPL_PB1|Ycoordinate|Unit: dot
89 |TSPL_PB2|Rotation angle|(((
90 0: 0 degrees
91
92 1: 90 degrees
93
94 2: 180 degrees
95
96 3: 270 degrees
97 )))
98 |TSPL_PB3|height|Unit: dot
99 |TSPL_PB4|width|Range:0-2
100 |TSPL_PB5- TSPL_PB99|Bar code content|Use character input device to configure
101
102 By analogy, we can know the text information configuration of the 2nd to 20th bar codes.
103
104 Print offset:
105
106 * TSPL_PR0: X coordinate offset, unit: mm;
107 * TSPL_PR1: Y coordinate offset, unit: mm.
108
109 Trigger printing:
110
111 * TSPL_PN0 = 1: trigger the printer to start printing.
112
113 Printing status:
114
115 * TSPL_PS0 = 1: The printing is normal.
116 * TSPL_PS0 = 1: The printing is abnormal.
117
118 Print picture
119
120 * For the function of printing pictures, please refer to the configuration of [Printer object].
121
122 Conversion between dot and mm
123
124 * 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.
125
126 == {{id name="HEpsonTMSeries"/}}**EpsonTM Series** ==
127
128 **HMI Settings**
129
130 |**Item**|**Settings**|**Note**
131 |Protocol|EPSON-TM-T82II/TM-XXX|
132 |Connection|RS232|
133 |Baud rate|9600~~115200|
134 |Data bit|8|
135 |Parity|None|
136 |Stop bit|1|
137 |PLC station No.|1|
138
139 Each printer protocol has default parameter. These parameters could be configured by addresses. Error parameters may cause print failure.
140
141 **Printer Settings**
142
143 |**Address**|**Description**|**Value**
144 |HSW10603|Print direction (only valid for print function)|1
145 |HSW10604|Dot Matrix Type|1
146 |HSW10605|Print width (depending on printer and paper)|384
147 |HSW10606|Printer instruction type|1
148 |HSW10607|Paper cut|2
149 |HSW10608|Alignment (only valid for print function)|1
150
151 **Cable Wiring**
152
153 {{id name="I12.PLCProtocol_html_5e9a81a14106da9e.png-4"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_7b2556c42d43a768.png||alt="12.PLC Protocol_html_5e9a81a14106da9e.png" height="223" width="392"]]
154
155 {{id name="I12.PLCProtocol_html_1897d92be6948d58.png-5"/}}[[image:xwiki_PIStudio_12.PLC+protocols_WebHome_c6d16b5adff76549.png||alt="12.PLC Protocol_html_1897d92be6948d58.png" height="223" width="393"]]
156
157 **✎Note:** COM3 only available in PI8000/PI9000 series.