Wiki source code of 10 Communication

Version 29.1 by Mora Zhou on 2023/09/09 13:53

Show last authors
1 = **Communication** =
2
3 == **Protocol** ==
4
5 **PROTOCOL(P)**
6
7 Set (s) protocol for (N) communication port.
8
9 -[PROTOCOL (S) (N)]
10
11 **Content, range and data type**
12
13 (% class="table-bordered" %)
14 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
15 |(S)|Protocol number to be set|-|Unsigned BIN 16 bit|ANY16
16 |(N)|Which communication port to set, 0 means COM1, 1 means COM2 *1|0, 1|Unsigned BIN 16 bit|ANY16
17
18 **Device used**
19
20 (% class="table-bordered" %)
21 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
22 **Offset**
23
24 **modification**
25 )))|(((
26 **Pulse**
27
28 **extension**
29 )))
30 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
31 |(% rowspan="2" %)PROTOCOL|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|●
32 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●
33
34 **Features**
35
36 This instruction is mainly used to set the protocol during run, and can also be used in the first cycle of run.
37
38 The value of the protocol address (COM1 SD2542, COM2 SD2592) and the protocol modification flag (COM1 SD2543, COM2 SD2593) can be directly set according to the command parameters.
39
40 The specific calculation formula for setting the protocol modification flag (COM1 SD2543, COM2 SD2593) is: (parameter setting value + offset of the corresponding serial port's initial special soft component + 10)*2
41
42 For example, setting the protocol to 2 is (2 +2593-2590 +10)*2, which is (2+3+10) *2=30. At this time, SD2592 will be set to 1, and SD2593 will be set to 32.
43
44 (% class="box infomessage" %)
45 (((
46 **✎Note: **Whether it is by self-calculation and then modifying the setting value of the identifier (COM1 SD2543, COM2 SD2593) to the protocol, or using this instruction to set, it is possible to modify the protocol when the PLC is in the RUN state.
47 )))
48
49 Regarding the protocol modification flags (COM1 SD2543, COM2 SD2593): During the RUN process, the first cycle of setting the protocol and modifying the flags is correct (judging at END) to the correct first cycle. When the modification is completed, the protocol modification flags (COM1 SD2543, COM2 SD2593) is cleared, and then set the same value will not be processed. Mainly to avoid repeated settings multiple times.
50
51 **Agreement Number**
52
53 (% class="table-bordered" %)
54 |**Agreement Number**|**Content**
55 |0 H|Wecon Modbus slave
56 |2 H|ModbusRTU slave
57 |3 H|ModbusASCII slave
58 |10 H|User-defined protocol
59 |20 H|ModbusRTU master station
60 |30 H|ModbusASCII master
61
62 **Related software components**
63
64 (% class="table-bordered" %)
65 |**Devices**|**Content**
66 |SD2542|COM1 protocol settings
67 |SD2543|COM1 protocol modification sign
68 |SD2592|COM2 protocol settings
69 |SD2593|COM2 protocol modification sign
70
71 (% class="box infomessage" %)
72 (((
73 **✎Note:**
74
75 The setting of communication parameters will affect the overall communication. The processing in the PLC is to modify it when there is no communication or after a round of communication is completed. This point needs attention.
76 )))
77
78 If the set protocol does not match the provided protocol number, the protocol modification flag (COM1 SD2543, COM2 SD2593) will not be cleared after setting. At this time, the protocol will not be set successfully, and it will run according to the original protocol.
79
80 **Error code**
81
82 (% class="table-bordered" %)
83 |**Error code**|**Content**
84 |4085H|The read address of (s) and (N) exceeds the device range
85 |4084H|(N) is not 1
86
87 **Example**
88
89 (% style="text-align:center" %)
90 [[image:10_html_2947ba20da1d1c90.png||class="img-thumbnail"]]
91
92 Example above
93
94 M1 changes from OFF to ON during the run
95
96 SD2592 will be set to 32 (20H), SD2593 will be set to 90 and then it will be cleared. At this time, it means that the setting is successful.
97
98 (% style="text-align:center" %)
99 [[image:10_html_38333ed8624e86d1.png||class="img-thumbnail"]]
100
101 If you turn M1 from OFF to ON again
102
103 SD2592 will be set to 32 (20H), SD2593 will be set to 90 but will not be cleared.
104
105 (% style="text-align:center" %)
106 [[image:10_html_54692bd97d6e3bfd.png||class="img-thumbnail"]]
107
108 = **Modbus serial port parameter setting** =
109
110 == {{id name="_PORTPARA/MODBUS串口参数设置"/}}{{id name="_Toc1121"/}}{{id name="_Toc11010"/}}**PORTPARA/Modbus serial port parameter setting** ==
111
112 **PORTPARA(P)**
113
114 Set (s) serial port parameters for (N) communication port.
115
116 -[PORTPARA (s) (N)]
117
118 **Content, range and data type**
119
120 (% class="table-bordered" %)
121 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
122 |(s)|Serial port parameters to be set|-|Unsigned BIN 16 bit|ANY16
123 |(N)|Which communication port to set, 0 means COM1, 1 means COM2|0, 1|Unsigned BIN 16 bit|ANY16
124
125 **Device used**
126
127 (% class="table-bordered" %)
128 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
129 **Offset**
130
131 **modification**
132 )))|(((
133 **Pulse**
134
135 **extension**
136 )))
137 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
138 |(% rowspan="2" %)ECAMCUT|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|●
139 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●
140
141 **Features**
142
143 This instruction is mainly used to set serial port parameters during run, and can also be used in the first cycle of run.
144
145 Can directly set the serial port parameter address (COM1 SD2540, COM2 SD2590) and the value of the serial parameter modification flag (COM1 SD2541, COM2 SD2591) according to the command parameters.
146
147 The specific calculation formula for setting the serial port parameter modification flags (COM1 SD2541, COM2 SD2591) is: (parameter setting value + offset of the corresponding serial port's initial special soft component + 10)*2
148
149 For example, setting the COM1 serial port parameter to 193 (HC1) is (193 +2541-2540 +10)*2 which is (193 +1+10) *2=408. At this time, 193 (HC1) will be set for SD2540 and 408 for SD2541.
150
151 (% class="box infomessage" %)
152 (((
153 **✎Note: **Whether it is by self-calculation and then to the serial port parameter to modify the flag (COM1 SD2541, COM2 SD2591) setting value, or use this instruction to set, it is possible to modify the serial port parameter when the PLC is in the RUN state.
154 )))
155
156 About serial port parameter modification flags (COM1 SD2541, COM2 SD2591): During RUN, when the serial port parameters are set and the modified flag is correct (judging at END) to the correct first cycle, the serial port parameter modification flag (COM1 SD2541, COM2, SD2591) are cleared, and then set the same value will not be processed. Mainly to avoid repeated settings multiple times.
157
158 **Serial port parameter setting table**
159
160 (% class="table-bordered" %)
161 |(% colspan="2" %)**Bit number**|**B0**|**B1、B2**|**B3**|**B4、B5、B6、B7、B8、B9**|**B10**|**B11**
162 |(% colspan="2" %)**Name**|**Data length**|**Parity**|**Stop Bit**|**Baud Rate(bps)**|**STX**|**ETX**
163 |(% rowspan="2" %)**Content**|**0 off**|7bit|(% rowspan="2" %)(((
164 b2,b1
165
166 (0,0):None
167
168 (0,1):Odd parity(ODD)
169
170 (1,1):Even parity(EVEN)
171 )))|1bit|(% rowspan="2" %)(((
172 |4800|0111
173 |9600|1000
174 |19200|1001
175 |38400|1010
176 |57600|1011
177 |115200|1100
178 |187500|1101
179 |230400|1110
180 |460800|1111
181 |921600|10000
182 )))|Turn off STX function|Turn off ETX function
183 |**1 on**|8bit|2bit|Enable STX function, the specific value is set by D8124|Turn on the ETX function, the specific value is set by D8125
184
185 **Related software components**
186
187 (% class="table-bordered" %)
188 |**Devices**|**Content**
189 |SD2540|COM1 serial port parameter setting
190 |SD2541|COM1 serial port parameter modification identification
191 |SD2590|COM2 serial port parameter setting
192 |SD2591|COM2 serial port parameter modification sign
193
194 (% class="box infomessage" %)
195 (((
196 **✎Note:** The setting of communication parameters will affect the overall communication. The processing in the PLC is to be modified when there is no communication or after a round of communication is completed. This point needs attention.
197
198 STX function and ETX function are only useful in the case of custom protocol.
199 )))
200
201 If the set protocol does not match the provided protocol number, the serial port parameter modification flags (COM1 SD2541, COM2 SD2591) will not be cleared after setting. At this time, the protocol will not be set successfully, and it will run according to the original protocol.
202
203 **Error code**
204
205 (% class="table-bordered" %)
206 |**Error code**|**Content**
207 |4085H|The read address of (s) and (N) exceeds the device range
208 |4084H|(N) is not 0 or 1
209
210 **Example**
211
212 (% style="text-align:center" %)
213 [[image:10_html_4a65cac3b7fac971.png||class="img-thumbnail"]]
214
215 Example above
216
217 M1 changes from OFF->ON during run
218
219 SD2540 will be set to 129 (H81, baud rate: 9600, stop bit: 1, data bit: 8, parity bit: none), SD2541 will be set to 280 and then cleared. At this time it has been set successfully
220
221 (% style="text-align:center" %)
222 [[image:10_html_6c71076e92745b55.png||class="img-thumbnail"]]
223
224 If you turn M1 from OFF->ON again
225
226 SD2540 will be set to 129 (H81), SD2541 will be set to 280 but will be cleared.
227
228 (% style="text-align:center" %)
229 [[image:10_html_b19182554f11878c.png||class="img-thumbnail"]]
230
231 = {{id name="_Toc18012"/}}**{{id name="_Toc31925"/}}Modbus station number setting** =
232
233 == {{id name="_Toc27385"/}}**{{id name="_Toc31405"/}}STATION/Modbus station number setting** ==
234
235 **STATION(P)**
236
237 Under the Modbus slave station protocol. Set the station number (s) for the (N) communication port.
238
239 -[STATION (s) (N)]
240
241 **Content, range and data type**
242
243 (% class="table-bordered" %)
244 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
245 |(s)|Station number to be set|0 to 255|Unsigned BIN 16 bit|ANY16
246 |(N)|Which communication port to set 0 means COM1, 1 means COM2|0, 1|Unsigned BIN 16 bit|ANY16
247
248 **Device used**
249
250 (% class="table-bordered" %)
251 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
252 **Offset**
253
254 **modification**
255 )))|(((
256 **Pulse**
257
258 **extension**
259 )))
260 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
261 |(% rowspan="2" %)ECAMCUT|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|(% rowspan="2" %)●
262 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●
263
264 **Features**
265
266 ●This instruction is mainly used to set the station number during run, and it can also be used in the first cycle of run.
267
268 ●The value of the station number address (COM1 SD2544, COM2 SD2594) and the station number modification flag (COM1 SD2545, COM2 SD2595) can be directly set according to the command parameters.
269
270 ●The specific calculation formula for setting the station number modification flag (COM1 SD2545, COM2 SD2595) is: (parameter setting value + offset of the corresponding serial port's initial special device + 10)*2
271
272 ●For example, setting the COM2 station number to 1 is (1 +2595-2590 +10)*2, which is (1 +5+10) *2=32. At this time, SD2594 will be set to 1, and SD2595 will be set to 32.
273
274 **✎Note: **Whether it is by self-calculation and then modifying the ID (COM1 SD2545, COM2 SD2595) setting value to the station number, or setting with this instruction, the station number can be modified when the PLC is in the RUN state.
275
276 ●Regarding station number modification identification (COM1 SD2545, COM2 SD2595): During RUN, when the station number is set and the modification identification is correct (judgment at END) to the correct first cycle, the station number will be modified when the modification is completed (COM1 SD2545, COM2 SD2595) are cleared, and then set the same value will not be processed. Mainly to avoid repeated settings multiple times.
277
278 **Related software components**
279
280 (% class="table-bordered" %)
281 |**Devices**|**Content**
282 |SD2544|COM1 station number setting
283 |SD2545|COM1 station number modification sign
284 |SD2594|COM2 station number setting
285 |SD2595|COM2 station number modification sign
286
287 **Error code**
288
289 (% class="table-bordered" %)
290 |**Error code**|**Content**
291 |4085H|The read address of (s) and (N) exceeds the device range
292 |(% rowspan="2" %)4084H|(s) not in the range of 0 to 255
293 |(N) is not 0 or 1
294
295 **✎Note:**
296
297 The setting of communication parameters will affect the overall communication. The processing in the PLC is to modify it when there is no communication or after a round of communication is completed. This point needs attention.
298
299 **Example**
300
301 (% style="text-align:center" %)
302 [[image:10_html_687577f8e28f9089.png||class="img-thumbnail"]]
303
304 Example above
305
306 M1 changes from OFF->ON during run
307
308 SD2594 will be set to 2, SD2595 will be set to 34 and then it will be cleared. At this time it has been set successfully
309
310 (% style="text-align:center" %)
311 [[image:10_html_b474623d8ed5305f.png||class="img-thumbnail"]]
312
313 If you turn M1 from OFF->ON again
314
315 SD2594 will be set to 2, SD2595 will be set to 34 but will not be cleared.
316
317 (% style="text-align:center" %)
318 [[image:10_html_309b7cb63c6f5d1b.png||class="img-thumbnail"]]
319
320 = {{id name="_Toc1836"/}}**{{id name="_Toc10711"/}}{{id name="_Toc29509"/}}{{id name="_Toc5112"/}}RS instruction** =
321
322 == {{id name="_Toc10635"/}}**{{id name="_Toc16249"/}}{{id name="_Toc17183"/}}{{id name="_Toc29599"/}}RS/External communication instruction** ==
323
324 **RS**
325
326 In the case of Modbus master station protocol: This instruction is the setting interface for the master station to send protocol frames. The function code (s), slave address (m), length (d) of the station number set according to the instruction, and the function code determines whether the data of n is required to be automatically combined to send and receive protocol frames. If it is a read type function code, the data will be written into (N).
327
328 -[RS (s) (m) (d) (N)]
329
330 **{{id name="_Toc26963"/}}Content, range and data type**
331
332 In the case of user-defined protocol:
333
334 (% class="table-bordered" %)
335 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
336 |(s)|The start address of register area that stores the data to be sent|-|Unsigned BIN 16 bit|ANY16
337 |(m)|The length of data to be sent (bytes)|0 to 523|Unsigned BIN 16 bit|ANY16
338 |(d)|The device start number that stores the written data|-|Unsigned BIN 16 it|ANY16
339 |(N)|Number of data written (bytes)|0 to 523|Unsigned BIN 16 bit|ANY16
340
341 In the case of Modbus protocol:
342
343 (% class="table-bordered" %)
344 |**Parameter**|**Content**|**Range**|**Data type**|(((
345 **Data type**
346
347 **(label)**
348 )))
349 |(s)|The high byte stores the station number of slave station, and the low byte stores function code of Modbus|-|Unsigned BIN 16 bit|ANY16
350 |(m)|Slave address. The address provided by the slave station will read or write data from this address of the slave station|-|Unsigned BIN 16 bit|ANY16
351 |(d)|Length. The length of Modbus read or write. The unit is determined by function code.|-|Unsigned BIN 16 bit|ANY16
352 |(N)|Start address for reading or writing data|-|Unsigned BIN 16 bit|ANY16
353
354 {{id name="_Toc26776"/}}{{id name="_Toc17529"/}}**Device used**
355
356 (% class="table-bordered" %)
357 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="6" %)**Devices**|**Offset modification**|(((
358 **Pulse**
359
360 **extension**
361 )))
362 |**T**|**C**|**D**|**R**|**K**|**H**|**[D]**|**XXP**
363 |(% rowspan="4" %)RS|Parameter 1|●|●|●|●|●|●| |
364 |Parameter 2|●|●|●|●|●|●| |
365 |Parameter 3|●|●|●|●|●|●| |
366 |Parameter 4|●|●|●|●|●|●| |
367
368 **{{id name="OLE_LINK409"/}}(1) {{id name="_Toc13811"/}}Custom protocol**
369
370 When the communication protocol is set as a [[custom protocol>>url:http://dict.cn/self-defined%20protocol]]. When the contact in before RS instruction is turned on and SM2591 is also turned on at the same time, if the sending length (m) is not 0, the data of (s) will be sent (m) bytes out, and then it will be in the mode of waiting for reception. When the data is received, (N) bytes of data will be stored in (d). SM2593 will be turned ON after receiving (N) data.
371
372 In addition, when the sending length (m) is 0, it will be in the receive-only mode. When the receiving length (N) is 0, it will be in the send-only mode.
373
374 To enable the start character (STX) and the end character (ETX) modes of RS instruction, the status of the 10th and 11th bits of the special address SD2600 must be set. See the table below for detailed settings:
375
376 (% class="table-bordered" %)
377 |(% colspan="2" %)**Bit number**|**B0**|**B1、B2**|**B3**|(((
378 **B4、B5、B6、**
379
380 **B7、B8、B9**
381 )))|**B10**|**B11**
382 |(% colspan="2" %)**Name**|**Data length**|**Parity**|**Stop Bit**|**Baud rate(bps)**|**STX**|**ETX**
383 |(% rowspan="2" %)**Content**|(((
384 **0**
385
386 **off**
387 )))|7-bit|(% rowspan="2" %)(((
388 b2, b1
389
390 (0,0): None
391
392 (0,1): Odd parity (ODD)
393
394 (1,1): Even parity (EVEN)
395 )))|1-bit|(% rowspan="2" %)(((
396 |9600|001000
397 |19200|001001
398 |38400|001010
399 |57600|001011
400 |115200|001100
401 |187500|001101
402 |230400|001110
403 |460800|001111
404 |921600|010000
405 )))|None|None
406 |(((
407 **1**
408
409 **on**
410 )))|8-bit|2-bit|Turn on STX, the STX value is set in SD2600|Turn on ETX, the ETX value is set in SD2601
411
412 **Example**
413
414 (% style="text-align:center" %)
415 [[image:10_html_dbd00c955b74b44.png||class="img-thumbnail"]]
416
417 When M1 is ON, the sending and receiving data of communication after executing instruction is stored as the following figure.
418
419 (% style="text-align:center" %)
420 [[image:10_html_fa670961ae3e6f05.gif||class="img-thumbnail"]]
421
422 Some configuration and preparation of serial communication are needed for actual programming to communicate as expected, such as setting the transceiver mode of serial port, baud rate, number of bits, parity, software protocol settings, timeout judgment conditions, and data preparation for the transceiver buffer, send and receive flag processing, etc.,
423
424 A relatively complete RS communication setup program is shown as follows:
425
426 (% style="text-align:center" %)
427 [[image:10_html_487e57593173359e.png||class="img-thumbnail"]]
428
429 (((
430 Serial port parameters settings:
431
432 Baud rate 112500, stop bit 1, data bit 8, parity bit none
433 )))
434
435 (((
436 Set the protocol as a custom protocol
437
438 Sending interval: 5ms
439
440 Receiving timeout: 100ms
441
442 Number of repetitions: 3 times
443
444 Timeout between characters: 30ms
445
446 Custom protocol, send start address D200, sending length 8, receive start address D300, receiving length 8,
447
448 Receive start address D300 Receive length 6
449
450 Send directly after trigger
451
452 After receiving, close the instruction directly and reset the instruction receiving flag
453 )))
454
455 For detailed user-defined protocol instructions, please refer to "__[[10.7.1 Custom protocol description>>path:#_10.7.1 Custom protocol description]]__"
456
457 **{{id name="_Toc24060"/}}(2) Modbus protocol**
458
459 When the protocol is set to Modbus master protocol (whether it is RTU or ASCII). When the contact before RS instruction is turned ON, the RS instruction will send the combined data frame according to the station number function code (s), slave station address (m), length (d) and judge whether the data of (N) is needed according to the function code.
460
461 (% style="text-align:center" %)
462 [[image:10_html_9d0ddca3305d21b0.png||class="img-thumbnail"]]
463
464 (% class="table-bordered" %)
465 |**Parameter**|**Content**
466 |(s)|The high byte stores the station number of slave station, and the low byte stores the function code of Modbus
467 |(m)|Slave address. The address provided by the slave station will read or write data from this address of the slave station
468 |(d)|Length, the length of Modbus read or write. The unit is determined by the function code.
469 |(N)|Start address for reading or writing data
470
471 (% style="text-align:center" %)
472 [[image:10_html_a7e64b4f4526b73e.png||class="img-thumbnail"]]
473
474 (((
475 Serial port parameter setting
476
477 Baud rate 115200, data bit 8, parity bit none, stop bit 1
478
479 Communication protocol setting: ModbusRTU master station protocol
480
481 Sending interval: 5ms
482
483 Receiving timeout: 100ms
484
485 Timeout retry times: 3 times
486
487 Station number 01H, function code 03H, slave address 10, length 05
488 )))
489
490 As the ladder program shown above:
491
492 When M1 is turned ON, PLC will send data (hexadecimal) from COM2 of PLC: 01 03 00 0A 00 05 A5 C8
493
494 01: represents slave address, the upper 8 bits of (s);
495
496 03: Modbus instruction code, the lower 8 bits of (s), meaning to read the slave register;
497
498 00 0A: The address of slave register to be read, the value of (m);
499
500 00 05: The number of registers to be read, the value of (d),
501
502 A5 C8: CRC check code.
503
504 For detailed custom protocol instructions, please refer to "[[(% class="wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink" %)__10.7.2 Modbus protocol description__>>path:#_10.7.2 Modbus protocol description]](%%)"
505
506 **✎Note: **
507
508 Although the RS instruction currently allows all the parameters of the instruction to use constants such as K and H, there are different restrictions depending on the protocol.
509
510 When the protocol is a custom protocol, S and D cannot be constants, otherwise it will report (3189H) error.
511
512 When the protocol is Modbus protocol, n cannot be a constant, otherwise it will report (3189H) error.
513
514 The combination of RTU protocol and 7-bit data bits cannot be set.
515
516 If the serial port parameter settings are different, it may still be able to communicate. At present, it is normal to set one.
517
518 Currently, the RS instruction cannot be used in interrupts and events.
519
520 **{{id name="_Toc8113"/}}Error code**
521
522 (% class="table-bordered" %)
523 |(% style="width:102px" %)**Error code**|(% style="width:979px" %)**Content**
524 |(% style="width:102px" %)4085H|(% style="width:979px" %)The read address of (s), (m), (d) and (N) exceed the device range.
525 |(% style="width:102px" %)3180H|(% style="width:979px" %)COM2 data reception error. There may be interference on the communication line, it is recommended to connect the ground wire.
526 |(% style="width:102px" %)3181H|(% style="width:979px" %)COM2 data reception timed out. "Check the wiring, check whether the serial port parameter settings are compatible with master and slave, check whether there is interference. Check whether the slave station is too late to respond. For this reason, you can try to increase the sending interval SD2546."
527 |(% style="width:102px" %)3182H|(% style="width:979px" %)COM2 CRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
528 |(% style="width:102px" %)3183H|(% style="width:979px" %)COM2 LRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
529 |(% style="width:102px" %)3184H|(% style="width:979px" %)The COM2 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism of slave station.
530 |(% style="width:102px" %)3185H|(% style="width:979px" %)COM2 send buffer overflow. Contact a technician if this error occurs
531 |(% style="width:102px" %)3186H|(% style="width:979px" %)COM2 function code is wrong. Check whether the set function code is a function code supported by PLC
532 |(% style="width:102px" %)3187H|(% style="width:979px" %)COM2 address is wrong. Check whether the slave station has this address (please refer to Modbus Abnormal 02)
533 |(% style="width:102px" %)3188H|(% style="width:979px" %)The length of COM2 is wrong. Check whether the communication length exceeds the length range specified by the Modbus protocol, or whether it exceeds the specified length range of the custom protocol.
534 |(% style="width:102px" %)3189H|(% style="width:979px" %)COM2 data error. "Check whether there are errors in the parameters of the instruction. Check whether the slave station supports the setting of this value. (Please refer to Modbus Abnormal 03)"
535 |(% style="width:102px" %)318AH|(% style="width:979px" %)COM2 slave station is busy. Slave station returns information: Slave station is busy (please refer to Modbus exception 06)
536 |(% style="width:102px" %)318BH|(% style="width:979px" %)COM2 slave station does not support function codes. Check whether the slave station supports this function code (please refer to Modbus exception 01)
537 |(% style="width:102px" %)318CH|(% style="width:979px" %)COM2 slave station is faulty. Slave station returns information: Slave station is faulty, please check whether the slave station is faulty (please refer to Modbus Abnormal 04)
538 |(% style="width:102px" %)318DH|(% style="width:979px" %)COM2 slave station confirmation. Slave station return information: slave station confirmation (please refer to Modbus abnormal 05)
539 |(% style="width:102px" %)318EH|(% style="width:979px" %)COM2 current protocol does not support this instruction or function. The related conmunication instruction of master station or the function of maste station cannot be used when it is set to slave station protocol, please change the protocol or close the contact before the corresponding instruction or diable the corresponding communication function.
540 |(% style="width:102px" %)318FH|(% style="width:979px" %)COM2 sending timed out. Contact a technician if this error occurs
541 |(% style="width:102px" %)31A0H|(% style="width:979px" %)COM2 is not available as a gateway. Slave station returns information: unavailable gateway (please refer to Modbus exception 0A)
542 |(% style="width:102px" %)31A1H|(% style="width:979px" %)COM2 indicates that no response was obtained from the target device. Slave station returns information: the device is not in the network (please refer to Modbus exception 0B)
543
544 = {{id name="_Toc3328"/}}**{{id name="_Toc27516"/}}{{id name="_Toc32747"/}}RS2 instruction** =
545
546 == **RS2/External communication instruction** ==
547
548 **RS2**
549
550 In custom protocol: This instruction is a communication send and receive instruction. It takes out (M) of the initial data specified (s) and send it, and stores (N) of the data received through the serial port in (d) and sent by (n1) automatic communication port.
551
552 In Modbus master station protocol: This instruction is the setting interface for the master station to send protocol frames. According to the station number function code (s), slave address (m), length (d) set by the instruction, and the function code to determine whether n data is required to automatically combined sending and receiving protocol frames. If it is a read type function code, the data would be written to (N) and sent by (n1) custom communication port.
553
554 -[RS2 (s) (m) (d) (N) (n1)]
555
556 **Content, range and data type**
557
558 In custom protocol
559
560 (% class="table-bordered" %)
561 |=(% scope="row" %)**Parameter**|=(% style="width: 453px;" %)**Content**|=(% style="width: 107px;" %)**Range**|=(% style="width: 207px;" %)**Data type**|=(% style="width: 197px;" %)**Data type (label)**
562 |=(s)|(% style="width:453px" %)The start address of register area that stores the data to be sent|(% style="width:107px" %)-|(% style="width:207px" %)Unsigned BIN 16 bit|(% style="width:197px" %)ANY16
563 |=(m)|(% style="width:453px" %)The length of data to be sent (bytes)|(% style="width:107px" %)0 to 528|(% style="width:207px" %)Unsigned BIN 16 bit|(% style="width:197px" %)ANY16
564 |=(d)|(% style="width:453px" %)The device start number that stores the written data|(% style="width:107px" %)-|(% style="width:207px" %)Unsigned BIN 16 bit|(% style="width:197px" %)ANY16
565 |=(N)|(% style="width:453px" %)Number of data written (bytes)|(% style="width:107px" %)0 to 528|(% style="width:207px" %)Unsigned BIN 16 bit|(% style="width:197px" %)ANY16
566 |=(n1)|(% style="width:453px" %)Specify the communication port|(% style="width:107px" %) |(% style="width:207px" %)Unsigned BIN 16 bit|(% style="width:197px" %)ANY16
567
568 In Modbus protocol
569
570 (% class="table-bordered" %)
571 |=(% scope="row" %)**Parameter**|=(% style="width: 517px;" %)**Content**|=(% style="width: 114px;" %)**Range**|=(% style="width: 173px;" %)**Data type**|=(% style="width: 185px;" %)**Data type (label)**
572 |=(s)|(% style="width:517px" %)The high byte stores the station number of slave station, and the low byte stores function code of Modbus|(% style="width:114px" %)-|(% style="width:173px" %)Unsigned BIN 16 bit|(% style="width:185px" %)ANY16
573 |=(m)|(% style="width:517px" %)Slave address. The address provided by the slave station will read or write data from this address of the slave station|(% style="width:114px" %)-|(% style="width:173px" %)Unsigned BIN 16 bit|(% style="width:185px" %)ANY16
574 |=(d)|(% style="width:517px" %)Length. The length of Modbus read or write. The unit is determined by function code.|(% style="width:114px" %)-|(% style="width:173px" %)Unsigned BIN 16 bit|(% style="width:185px" %)ANY16
575 |=(N)|(% style="width:517px" %)The start address of the data to be read or written|(% style="width:114px" %)-|(% style="width:173px" %)Unsigned BIN 16 bit|(% style="width:185px" %)ANY16
576 |=(n1)|(% style="width:517px" %)Specify the communicatiom port|(% style="width:114px" %) |(% style="width:173px" %)Unsigned BIN 16 bit|(% style="width:185px" %)ANY16
577
578 **Device used**
579
580 (% class="table-bordered" style="width:1078px" %)
581 |=(% rowspan="2" style="width: 116px;" %)**Instruction**|=(% rowspan="2" style="width: 101px;" %)**Parameter**|=(% colspan="7" style="width: 496px;" %)**Devices**|=(% style="width: 175px;" %)(((
582 **Offset modification**
583 )))|=(% style="width: 187px;" %)(((
584 **Pulse extension**
585 )))
586 |=(% style="width: 61px;" %)**T**|=(% style="width: 68px;" %)**C**|=(% style="width: 59px;" %)**D**|=(% style="width: 73px;" %)**R**|=(% style="width: 85px;" %)**SD**|=(% style="width: 79px;" %)**K**|=(% style="width: 71px;" %)**H**|=(% style="width: 175px;" %)**[D]**|=(% style="width: 187px;" %)**XXP**
587 |=(% rowspan="5" style="width: 116px;" %)RS2|(% style="width:101px" %)(s)|(% style="width:61px" %)●|(% style="width:68px" %)●|(% style="width:59px" %)●|(% style="width:73px" %)●|(% style="width:85px" %)●|(% style="width:79px" %)●|(% style="width:71px" %)●|(% style="width:175px" %)-|(% style="width:187px" %)-
588 |(% style="width:101px" %)(m)|(% style="width:61px" %)●|(% style="width:68px" %)●|(% style="width:59px" %)●|(% style="width:73px" %)●|(% style="width:85px" %)●|(% style="width:79px" %)●|(% style="width:71px" %)●|(% style="width:175px" %)-|(% style="width:187px" %)-
589 |(% style="width:101px" %)(d)|(% style="width:61px" %)●|(% style="width:68px" %)●|(% style="width:59px" %)●|(% style="width:73px" %)●|(% style="width:85px" %)●|(% style="width:79px" %)●|(% style="width:71px" %)●|(% style="width:175px" %)-|(% style="width:187px" %)-
590 |(% style="width:101px" %)(N)|(% style="width:61px" %)●|(% style="width:68px" %)●|(% style="width:59px" %)●|(% style="width:73px" %)●|(% style="width:85px" %)●|(% style="width:79px" %)●|(% style="width:71px" %)●|(% style="width:175px" %)-|(% style="width:187px" %)-
591 |(% style="width:101px" %)(n1)|(% style="width:61px" %) |(% style="width:68px" %) |(% style="width:59px" %) |(% style="width:73px" %) |(% style="width:85px" %) |(% style="width:79px" %)●|(% style="width:71px" %)●|(% style="width:175px" %) |(% style="width:187px" %)
592
593 **Features**
594
595 Parameter (n1) is the specified port. Curently, k0 indicates COM1, and k1 indicates COM2.
596
597 **(1) Custom protocol**
598
599 When the communication protocol is set as a [[custom protocol>>url:http://dict.cn/self-defined%20protocol]]. When the contact in before RS2 instruction is turned on and “sending control enable” is also turned on at the same time, and the sending length (m) is not 0, the data of (s) will be sent (m) bytes out, and then it will be in the mode of waiting for reception. When the data is received, (N) bytes of data will be stored in (d). “reception control or reception notice” will be turned ON after receiving (N) data.
600
601 In addition, when the sending length (m) is 0, it will be in the receive-only mode. When the receiving length (N) is 0, it will be in the send-only mode.
602
603 To enable the start character (STX) and the end character (ETX) modes of RS2 instruction, the status of the 10th and 11th bits of the special address “communication port setting” must be set. See the table below for detailed settings:
604
605 (% class="table-bordered" style="width:1073px" %)
606 |(% colspan="2" style="width:154px" %)**Bit number**|(% style="width:68px" %)**B0**|(% style="width:181px" %)**B1、B2**|(% style="width:68px" %)**B3**|(% style="width:180px" %)(((
607 **B4、B5、B6、**
608
609 **B7、B8、B9**
610 )))|(% style="width:207px" %)**B10**|(% style="width:213px" %)**B11**
611 |(% colspan="2" style="width:154px" %)**Name**|(% style="width:68px" %)**Data length**|(% style="width:181px" %)**Parity**|(% style="width:68px" %)**Stop Bit**|(% style="width:180px" %)**Baud rate(bps)**|(% style="width:207px" %)**STX**|(% style="width:213px" %)**ETX**
612 |(% rowspan="2" style="width:85px" %)**Content**|(% style="width:69px" %)(((
613 **0**
614
615 **off**
616 )))|(% style="width:68px" %)7-bit|(% rowspan="2" style="width:181px" %)(((
617 b2, b1
618
619 (0,0): none
620
621 (0,1): odd parity (ODD)
622
623 (1,1): even parity (EVEN)
624 )))|(% style="width:68px" %)1-bit|(% rowspan="2" style="width:180px" %)(((
625 (% style="width:164px" %)
626 |(% style="width:83px" %)9600|(% style="width:79px" %)001000
627 |(% style="width:83px" %)19200|(% style="width:79px" %)001001
628 |(% style="width:83px" %)38400|(% style="width:79px" %)001010
629 |(% style="width:83px" %)57600|(% style="width:79px" %)001011
630 |(% style="width:83px" %)115200|(% style="width:79px" %)001100
631 |(% style="width:83px" %)187500|(% style="width:79px" %)001101
632 |(% style="width:83px" %)230400|(% style="width:79px" %)001110
633 |(% style="width:83px" %)460800|(% style="width:79px" %)001111
634 |(% style="width:83px" %)921600|(% style="width:79px" %)010000
635 )))|(% style="width:207px" %)None|(% style="width:213px" %)None
636 |(% style="width:69px" %)(((
637 **1**
638
639 **on**
640 )))|(% style="width:68px" %)8-bit|(% style="width:68px" %)2-bit|(% style="width:207px" %)Turn on STX, the STX value is set in the device of the corresponding communication|(% style="width:213px" %)Turn on ETX, the ETX value is set in the device of the corresponding communication
641
642 **Example**
643
644 (% style="text-align:center" %)
645 [[image:10_html_42196c0b440282c3.gif||class="img-thumbnail"]]
646
647 When M1 is ON, the sending and receiving data of communication after executing instruction is stored as the following figure.
648
649 (% style="text-align:center" %)
650 [[image:image-20220926140831-1.jpeg||class="img-thumbnail"]]
651
652 Some configuration and preparation of serial communication are needed for actual programming to communicate as expected, such as setting the transceiver mode of serial port, baud rate, number of bits, parity, software protocol settings, timeout judgment conditions, and data preparation for the transceiver buffer, send and receive flag processing, etc.,
653
654 A relatively complete RS communication setup program is shown as follows:
655
656 (% style="text-align:center" %)
657 [[image:10_html_1917cca86a75115b.png||class="img-thumbnail"]]
658
659 (((
660 Set the protocol to a custom protocol.
661
662 Set serial port parameter: baud rate 115200 stop bit 1, data bit 8, no parity bit
663 )))
664
665 For detailed custom protocol instructions, please refer to "__[[10.7.1 Custom protocol description>>path:#_10.7.1 Custom protocol description]]__"
666
667 **(2) Modbus protocol**
668
669 When the protocol is set to Modbus master protocol (whether it is RTU or ASCII). When the contact before RS2 instruction is turned ON, the RS2 instruction will send the combined data frame according to the station number function code (s), slave station address (m), length (d) and judge whether the data of (N) is needed according to the function code.
670
671 (% style="text-align:center" %)
672 [[image:10_html_d97afb4fe5346ca.gif||class="img-thumbnail"]]
673
674 (% class="table-bordered" %)
675 |=(% scope="row" %)**Parameter**|=**Content**
676 |=(s)|The high byte stores the station number of slave station, and the low byte stores function code of Modbus
677 |=(m)|Slave address. The address provided by the slave station will read or write data from this address of the slave station
678 |=(d)|Length. The length of Modbus read or write. The unit is determined by function code.
679 |=(N)|The start address of the data to be read or written
680 |=(n1)|Specify the communicatiom port
681
682 (% style="text-align:center" %)
683 [[image:10_html_7400bc2aa339cd6d.png||class="img-thumbnail"]]
684
685 (((
686 As the ladder program shown above:
687
688 When M1 is turned ON, PLC will send data (hexadecimal) from COM2 of PLC: 01 03 00 0A 00 05 A5 C8
689
690 * 01: represents slave address, the high 8 bits of (s);
691 * 03: Modbus command code, the low 8 bits of (s), which means to read the slave register;
692 * 00 0A: The address of slave register to be read, the value of (m);
693 * 00 05: The number of registers to be read, the value of (d),
694 * A5 C8: CRC check code.
695 )))
696
697 For detailed custom protocol instructions, please refer to "[[(% class="wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink" %)__10.7.2 Modbus protocol description__>>path:#_10.7.2 Modbus protocol description]](%%)"
698
699 **✎Note: **
700
701 * The RS2 instruction allows parameters to be represented by K and H constants, but there are different restrictions depending on the protocol.
702 * When the protocol is a custom protocol, S and D cannot be constants, otherwise it will report (3X89H) error.
703 * When the protocol is Modbus protocol, n cannot be a constant, otherwise it will report (3X89H) error.
704 * When the protocol is set to the RTU protocol, only 8 bits of data can be selected
705 * If the serial port parameter settings are different, it may still be able to communicate. However, it is recommended that the serial port parameters be the same to avoid other faults.
706 * Currently, the RS2 instruction cannot be used in interrupts and events.
707
708 **Error code**
709
710 (% class="table-bordered" %)
711 |=(% scope="row" style="width: 104px;" %)**Error code**|=(% style="width: 977px;" %)**Content**
712 |=(% style="width: 104px;" %)4085H|(% style="width:977px" %)The read address of (s), (m), (d) and (N) exceed the device range.
713 |=(% style="width: 104px;" %)4084H|(% style="width:977px" %)The parameter value exceed the specified range
714 |=(% style="width: 104px;" %)3080H|(% style="width:977px" %)COM1 data reception error. There may be interference on the communication line, it is recommended to connect the ground wire.
715 |=(% style="width: 104px;" %)3081H|(% style="width:977px" %)COM1 data reception timed out. "Check the wiring, check whether the serial port parameter settings are compatible with master and slave, check whether there is interference. Check whether the slave station is too late to respond. For this reason, you can try to increase “the sending interval".
716 |=(% style="width: 104px;" %)3082H|(% style="width:977px" %)COM1 CRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
717 |=(% style="width: 104px;" %)3083H|(% style="width:977px" %)COM1 LRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
718 |=(% style="width: 104px;" %)3084H|(% style="width:977px" %)The COM1 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism of slave station.
719 |=(% style="width: 104px;" %)3085H|(% style="width:977px" %)COM1 send buffer overflow. Contact a technician if this error occurs.
720 |=(% style="width: 104px;" %)3086H|(% style="width:977px" %)COM1 function code is wrong. Check whether the set function code is a function code supported by PLC
721 |=(% style="width: 104px;" %)3087H|(% style="width:977px" %)COM1 address is wrong. Check whether the slave station has this address (please refer to Modbus Abnormal 02)
722 |=(% style="width: 104px;" %)3088H|(% style="width:977px" %)The length of COM1 is wrong. Check whether the communication length exceeds the length range specified by the Modbus protocol, or whether it exceeds the specified length range of the custom protocol.
723 |=(% style="width: 104px;" %)3089H|(% style="width:977px" %)COM1 data error. "Check whether there are errors in the parameters of the instruction. Check whether the slave station supports the setting of this value. (Please refer to Modbus Abnormal 03)"
724 |=(% style="width: 104px;" %)308AH|(% style="width:977px" %)COM1 slave station is busy. Slave station returns information: Slave station is busy (please refer to Modbus exception 06)
725 |=(% style="width: 104px;" %)308BH|(% style="width:977px" %)COM1 slave station does not support function codes. Check whether the slave station supports this function code (please refer to Modbus exception 01)
726 |=(% style="width: 104px;" %)308CH|(% style="width:977px" %)COM1 slave station is faulty. Slave station returns information: Slave station is faulty, please check whether the slave station is faulty (please refer to Modbus Abnormal 04)
727 |=(% style="width: 104px;" %)308DH|(% style="width:977px" %)COM1 slave station confirmation. Slave station return information: slave station confirmation (please refer to Modbus abnormal 05)
728 |=(% style="width: 104px;" %)308EH|(% style="width:977px" %)COM1 current protocol does not support this instruction or function. The related conmunication instruction of master station or the function of maste station cannot be used when it is set to slave station protocol, please change the protocol or close the contact before the corresponding instruction or diable the corresponding communication function.
729 |=(% style="width: 104px;" %)308FH|(% style="width:977px" %)COM1 sending timed out. Contact a technician if this error occurs.
730 |=(% style="width: 104px;" %)30A0H|(% style="width:977px" %)COM1 is not available as a gateway. Slave station returns information: unavailable gateway (please refer to Modbus exception 0A)
731 |=(% style="width: 104px;" %)30A1H|(% style="width:977px" %)COM1 indicates that no response was obtained from the target device. Slave station returns information: the device is not in the network (please refer to Modbus exception 0B)
732 |=(% style="width: 104px;" %)3181H|(% style="width:977px" %)COM2 data reception timed out. "Check the wiring, check whether the serial port parameter settings are compatible with master and slave, check whether there is interference. Check whether the slave station is too late to respond. For this reason, you can try to increase the “sending interval".
733 |=(% style="width: 104px;" %)3182H|(% style="width:977px" %)COM2 CRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
734 |=(% style="width: 104px;" %)3183H|(% style="width:977px" %)COM2 LRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
735 |=(% style="width: 104px;" %)3184H|(% style="width:977px" %)The COM2 station number is incorrectly configured. Check the slave station number setting, and check whether there is any problem with the receiving and sending mechanism of slave station.
736 |=(% style="width: 104px;" %)3185H|(% style="width:977px" %)COM2 send buffer overflow. Contact a technician if this error occurs.
737 |=(% style="width: 104px;" %)3186H|(% style="width:977px" %)COM2 function code is wrong. Check whether the set function code is a function code supported by PLC.
738 |=(% style="width: 104px;" %)3187H|(% style="width:977px" %)COM2 address is wrong. Check whether the slave station has this address (please refer to Modbus Abnormal 02)
739 |=(% style="width: 104px;" %)3188H|(% style="width:977px" %)The length of COM2 is wrong. Check whether the communication length exceeds the length range specified by the Modbus protocol, or whether it exceeds the specified length range of the custom protocol.
740 |=(% style="width: 104px;" %)3189H|(% style="width:977px" %)COM2 data error. "Check whether there are errors in the parameters of the instruction. Check whether the slave station supports the setting of this value. (Please refer to Modbus Abnormal 03)"
741 |=(% style="width: 104px;" %)318AH|(% style="width:977px" %)COM2 slave station is busy. Slave station returns information: Slave station is busy (please refer to Modbus exception 06)
742 |=(% style="width: 104px;" %)318BH|(% style="width:977px" %)COM2 slave station does not support function codes. Check whether the slave station supports this function code (please refer to Modbus exception 01)
743 |=(% style="width: 104px;" %)318CH|(% style="width:977px" %)COM2 slave station is faulty. Slave station returns information: Slave station is faulty, please check whether the slave station is faulty (please refer to Modbus Abnormal 04)
744 |=(% style="width: 104px;" %)318DH|(% style="width:977px" %)COM2 slave station confirmation. Slave station return information: slave station confirmation (please refer to Modbus abnormal 05)
745 |=(% style="width: 104px;" %)318EH|(% style="width:977px" %)COM2 current protocol does not support this instruction or function. The related conmunication instruction of master station or the function of maste station cannot be used when it is set to slave station protocol, please change the protocol or close the contact before the corresponding instruction or diable the corresponding communication function.
746 |=(% style="width: 104px;" %)318FH|(% style="width:977px" %)COM2 sending timed out. Contact a technician if this error occurs.
747 |=(% style="width: 104px;" %)31A0H|(% style="width:977px" %)COM2 is not available as a gateway. Slave station returns information: unavailable gateway (please refer to Modbus exception 0A)
748 |=(% style="width: 104px;" %)31A1H|(% style="width:977px" %)COM2 indicates that no response was obtained from the target device. Slave station returns information: the device is not in the network (please refer to Modbus exception 0B)
749
750 = **Expansion module communication** =
751
752 == {{id name="_Toc15142"/}}**{{id name="_Toc7013"/}}{{id name="_Toc4135"/}}Single word data writing from TO/PLC to the module (16-bit specification)** ==
753
754 **TO(P)**
755
756 Write the data at the start (N) point of the device specified in (s3) to the buffer memory in the intelligent function module specified in (s1) after the address specified in (s2).
757
758 -[TO (s1) (s2) (s3) (N)]
759
760 **{{id name="OLE_LINK401"/}}Content, range and data type**
761
762 (% class="table-bordered" %)
763 |**Parameter**|(% style="width:419px" %)**Content**|(% style="width:152px" %)**Range**|(% style="width:228px" %)**Data type**|(% style="width:177px" %)**Data type (label)**
764 |(s1)|(% style="width:419px" %)Module number, the first module is 0, the second module is 1, and so on|(% style="width:152px" %)0 to 32767|(% style="width:228px" %)Unsigned BIN 16 bit|(% style="width:177px" %)ANY16
765 |(s2)|(% style="width:419px" %)Start writing from which BFM in the module|(% style="width:152px" %)0 to 32767|(% style="width:228px" %)Unsigned BIN 16 bit|(% style="width:177px" %)ANY16
766 |(s3)|(% style="width:419px" %)Start number of the device storing the written data|(% style="width:152px" %)-32768 to 32767|(% style="width:228px" %)Signed BIN 16 bit|(% style="width:177px" %)ANY16
767 |(N)|(% style="width:419px" %)Number of data written|(% style="width:152px" %)0 to 512|(% style="width:228px" %)Unsigned BIN 16 bit|(% style="width:177px" %)ANY16
768
769 **Device used**
770
771 (% class="table-bordered" %)
772 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
773 **Offset**
774
775 **modification**
776 )))|(((
777 **Pulse**
778
779 **extension**
780 )))
781 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
782 |(% rowspan="4" %)TO|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|●
783 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●
784 |Parameter 3|●|●|●|●|●|●|●|●|●|●|●|●
785 |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●
786
787 **Features**
788
789 Write the data at the start (N) point of the device specified in (s3) to the buffer memory in the intelligent function module specified in (s1) after the address specified in (s2).
790
791 (% style="text-align:center" %)
792 [[image:10_html_603a54a4bdbc6b8f.gif||class="img-thumbnail"]]
793
794 As the following Circuit program
795
796 (% style="text-align:center" %)
797 [[image:10_html_9d053b1a8c234094.png||class="img-thumbnail"]]
798
799 Indicates that when X1 is ON, write the data in the PLC's D220 register to the buffer register (BFM) #24 in the #1 (second) special module. When X1 is OFF, no operation is performed.
800
801 Currently LX5VPLC supports 16 special expansion modules at the same time.
802
803 The special devices used are as follows
804
805 (% class="table-bordered" %)
806 |**Devices**|**Content**
807 |SD2081|Total number of modules
808 |SD2082|Number of IO expansion modules
809 |SD2083|Number of special expansion modules
810 |SD2084|The first missing expansion module. When the value is -1, it means not lost
811
812 **Error code**
813
814 (% class="table-bordered" %)
815 |**Error code**|**Content**
816 |4085H|The read addresses of (s1), (s2), (s3) and (N) exceed the device range
817 |4084H|(s1) and (s2) is not in the range of 0 to 32767 or (N) is not in the range of 0 to 512
818 |7080H|Check error when communicating between PLC and module
819 |7081H|Expansion module communication message is abnormal
820 |7082H|FROM/TO instruction error
821 |7083H|The specified extension module was not found
822
823 **Example**
824
825 (% style="text-align:center" %)
826 [[image:10_html_936412ccc04cc4cb.png||class="img-thumbnail"]]
827
828 When M1 is turned on
829
830 The values of D200 and D201 will be passed to BFM2 and BFM3 of module #0 (the first)
831
832 (% style="text-align:center" %)
833 [[image:10_html_555c0224c9a9e02d.png||class="img-thumbnail"]]
834
835 (% style="text-align:center" %)
836 [[image:10_html_ab29c2a6c272559.png||class="img-thumbnail"]]
837
838 == **Double word data write from DTO/PLC to the module (32-bit specification)** ==
839
840 DTO(P)
841
842 Write the data of (N)×2 points from the device specified in (s3) to the buffer memory in the intelligent function module specified in (s1) and beyond the address specified in (s2).
843
844 -[DTO (s1) (s2) (s3) (N)]
845
846 **Content, range and data type**
847
848 (% class="table-bordered" %)
849 |**Parameter**|(% style="width:421px" %)**Content**|(% style="width:228px" %)**Range**|(% style="width:201px" %)**Data type**|**Data type (label)**
850 |(s1)|(% style="width:421px" %)Module number, the first module is 0, the second module is 1, and so on|(% style="width:228px" %)0 to 32767|(% style="width:201px" %)Unsigned BIN 16 bit|ANY16
851 |(s2)|(% style="width:421px" %)Start writing from which BFM in the module|(% style="width:228px" %)0 to 32767|(% style="width:201px" %)Unsigned BIN 16 bit|ANY16
852 |(s3)|(% style="width:421px" %)Start number of the device storing the written data|(% style="width:228px" %)-2147483648 to 2147483647|(% style="width:201px" %)Signed BIN 32 bit|ANY32
853 |(N)|(% style="width:421px" %)Number of data written|(% style="width:228px" %)0 to 256|(% style="width:201px" %)Unsigned BIN 16 bit|ANY16
854
855 **Device used**
856
857 (% class="table-bordered" %)
858 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="12" %)**Devices**|(((
859 **Offset**
860
861 **modification**
862 )))|(((
863 **Pulse**
864
865 **extension**
866 )))
867 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**[D]**|**XXP**
868 |(% rowspan="4" %)DTO|Parameter 1|●|●|●|●|●|●|●|●| | |●|●|●|●
869 |Parameter 2|●|●|●|●|●|●|●|●| | |●|●|●|●
870 |Parameter 3|●|●|●|●|●|●|●|●|●|●|●|●|●|●
871 |Parameter 4|●|●|●|●|●|●|●|●| | |●|●|●|●
872
873 **Features**
874
875 Write the data of (N)×2 points from the device specified in (s3) to the buffer memory in the intelligent function module specified in (s1) and beyond the address specified in (s2).
876
877 (% style="text-align:center" %)
878 [[image:10_html_86bfbd89b2652fbf.gif||class="img-thumbnail"]]
879
880 As the following Circuit program
881
882 (% style="text-align:center" %)
883 [[image:10_html_d3dfe7b80f649f8e.png||class="img-thumbnail"]]
884
885 Indicates that when M1 is ON, write the data in the PLC's D200 and D201 registers to the buffer registers (BFM) #1 and #2 in the #0 (first) special module. When X1 is OFF, no operation is performed.
886
887 Currently LX5V PLC supports 16 special expansion modules at the same time.
888
889 The special devices used are as follows
890
891 (% class="table-bordered" %)
892 |**Devices**|**Content**
893 |SD2081|Total number of modules
894 |SD2082|Number of IO expansion modules
895 |SD2083|Number of special expansion modules
896 |SD2084|The first missing expansion module. When the value is -1, it means not lost
897
898 **Error code**
899
900 (% class="table-bordered" %)
901 |**Error code**|**Content**
902 |4085H|(s1) (s2) (s3) (N) The read address exceeds the device range
903 |4084H|(s1) (s2) is not in the range of 0 to 32767 or (N) is not in the range of 0 to 256
904 |7080H|Check error when communicating between PLC and module
905 |7081H|Expansion module communication message is abnormal
906 |7082H|FROM/TO instruction error
907 |7083H|The specified extension module was not found
908
909 **Example**
910
911 (% style="text-align:center" %)
912 [[image:10_html_12ff08a3df52558c.png||class="img-thumbnail"]]
913
914 When M1 is turned on
915
916 The values from D200 to D203 will be transferred to BFM1 to BFM4 of module #0 (first)
917
918 (% style="text-align:center" %)
919 [[image:10_html_fe06c272cbdd1f7f.png||class="img-thumbnail"]]
920
921 (% style="text-align:center" %)
922 [[image:10_html_adeb00a341e12368.png||class="img-thumbnail"]]
923
924 == {{id name="_Toc9726"/}}**{{id name="_Toc721"/}}{{id name="_Toc151"/}}{{id name="_Toc25394"/}}FROM/Read single word data from the module (16-bit specification)** ==
925
926 **FROM(P)**
927
928 Read (N) word data from the buffer memory specified in (s2) in the module specified in (s1), and store it in the device specified in (d) and later.
929
930 Ladder
931
932 -[FROM (s1) (s2) (d) (N)]
933
934 **Content, range and data type**
935
936 (% class="table-bordered" %)
937 |**Parameter**|(% style="width:473px" %)**Content**|(% style="width:134px" %)**Range**|(% style="width:185px" %)**Data type**|(% style="width:180px" %)**Data type (label)**
938 |(s1)|(% style="width:473px" %)Module number, the first module is 0, the second module is 1, and so on|(% style="width:134px" %)0 to 32767|(% style="width:185px" %)Unsigned BIN 16 bit|(% style="width:180px" %)ANY16
939 |(s2)|(% style="width:473px" %)Start reading from which BFM in the module|(% style="width:134px" %)0 to 32767|(% style="width:185px" %)Unsigned BIN 16 bit|(% style="width:180px" %)ANY16
940 |(d)|(% style="width:473px" %)Start number of the device storing the read data|(% style="width:134px" %)-|(% style="width:185px" %)Signed BIN 16 bit|(% style="width:180px" %)ANY16
941 |(N)|(% style="width:473px" %)Number of read data|(% style="width:134px" %)0 to 512|(% style="width:185px" %)Unsigned BIN 16 bit|(% style="width:180px" %)ANY16
942
943 **Device used**
944
945 (% class="table-bordered" style="width:1098px" %)
946 |=(% rowspan="2" style="width: 76px;" %)**Instruction**|=(% rowspan="2" style="width: 114px;" %)**Parameter**|=(% colspan="10" style="width: 490px;" %)**Devices**|=(% style="width: 218px;" %)(((
947 **Offset modification**
948 )))|=(% style="width: 119px;" %)(((
949 **Pulse extension**
950 )))
951 |=(% style="width: 53px;" %)**KnY**|=(% style="width: 63px;" %)**KnM**|=(% style="width: 49px;" %)**KnS**|=(% style="width: 41px;" %)**T**|=(% style="width: 65px;" %)**C**|=(% style="width: 48px;" %)**D**|=(% style="width: 52px;" %)**R**|=(% style="width: 39px;" %)**SD**|=(% style="width: 48px;" %)**K**|=(% style="width: 34px;" %)**H**|=(% style="width: 218px;" %)**[D]**|=(% style="width: 119px;" %)**XXP**
952 |=(% rowspan="4" style="width: 76px;" %)FROM|(% style="width:114px" %)Parameter 1|(% style="width:53px" %)●|(% style="width:63px" %)●|(% style="width:49px" %)●|(% style="width:41px" %)●|(% style="width:65px" %)●|(% style="width:48px" %)●|(% style="width:52px" %)●|(% style="width:39px" %)●|(% style="width:48px" %)●|(% style="width:34px" %)●|(% style="width:218px" %)●|(% style="width:119px" %)●
953 |(% style="width:114px" %)Parameter 2|(% style="width:53px" %)●|(% style="width:63px" %)●|(% style="width:49px" %)●|(% style="width:41px" %)●|(% style="width:65px" %)●|(% style="width:48px" %)●|(% style="width:52px" %)●|(% style="width:39px" %)●|(% style="width:48px" %)●|(% style="width:34px" %)●|(% style="width:218px" %)●|(% style="width:119px" %)●
954 |(% style="width:114px" %)Parameter 3|(% style="width:53px" %)●|(% style="width:63px" %)●|(% style="width:49px" %)●|(% style="width:41px" %)●|(% style="width:65px" %)●|(% style="width:48px" %)●|(% style="width:52px" %)●|(% style="width:39px" %)●|(% style="width:48px" %) |(% style="width:34px" %) |(% style="width:218px" %)●|(% style="width:119px" %)●
955 |(% style="width:114px" %)Parameter 4|(% style="width:53px" %)●|(% style="width:63px" %)●|(% style="width:49px" %)●|(% style="width:41px" %)●|(% style="width:65px" %)●|(% style="width:48px" %)●|(% style="width:52px" %)●|(% style="width:39px" %)●|(% style="width:48px" %)●|(% style="width:34px" %)●|(% style="width:218px" %)●|(% style="width:119px" %)●
956
957 **Features**
958
959 Read (N) word data from the buffer memory specified in (s2) in the intelligent function module specified in (s1) and store it in the device specified in (d) and later.
960
961 (% style="text-align:center" %)
962 [[image:10_html_1b9d34e74f852368.gif||class="img-thumbnail"]]
963
964 As the following Circuit program
965
966 (% style="text-align:center" %)
967 [[image:10_html_ad9897d46ca8f957.png||class="img-thumbnail"]]
968
969 It means that when M1 is ON, the data in the buffer registers (BFM) #10 and #11 in the special module #0 (the first) will be written into the D200 and D201 registers of the PLC. When M1 is OFF, no operation is performed.
970
971 Currently LX5V PLC supports 16 special expansion modules at the same time.
972
973 The special soft components used are as follows:
974
975 (% class="table-bordered" %)
976 |=(% scope="row" style="width: 163px;" %)**Devices**|=(% style="width: 911px;" %)**Content**
977 |=(% style="width: 163px;" %)SD2081|(% style="width:911px" %)Total number of modules
978 |=(% style="width: 163px;" %)SD2082|(% style="width:911px" %)Number of IO expansion modules
979 |=(% style="width: 163px;" %)SD2083|(% style="width:911px" %)Number of special expansion modules
980 |=(% style="width: 163px;" %)SD2084|(% style="width:911px" %)The first missing expansion module. When the value is -1, it means not lost
981
982 **Error code**
983
984 (% class="table-bordered" %)
985 |=(% scope="row" %)**Error code**|=**Content**
986 |=4085H|(s1) (s2) (N) The read address exceeds the device range
987 |=4086H|(d) The write address exceeds the device range
988 |=4084H|(s1) (s2) is not in the range of 0 to 32767 or (N) is not in the range of 0 to 512
989 |=7080H|Check error when communicating between PLC and module
990 |=7081H|Expansion module communication message is abnormal
991 |=7082H|FROM/TO instruction error
992 |=7083H|The specified extension module was not found
993
994 **Example**
995
996 (% style="text-align:center" %)
997 [[image:10_html_a9071734dc5cfce5.png||class="img-thumbnail"]]
998
999 When M1 is turned on
1000
1001 The values of BFM3, BFM4, and BFM5 of the #0 (first) module will be transferred to D200, D201, D202
1002
1003 (% style="text-align:center" %)
1004 [[image:10_html_f1df0562ea9002cf.png||class="img-thumbnail"]]
1005
1006 (% style="text-align:center" %)
1007 [[image:10_html_73bb66d1890735ff.png||class="img-thumbnail"]]
1008
1009 == {{id name="_Toc18124"/}}{{id name="_Toc10981"/}}{{id name="_Toc21090"/}}**DFROM/single word data read from the module (32-bit specification)** ==
1010
1011 **DFROM(P)**
1012
1013 Read (N)*2 words of data from the buffer memory specified in (s2) in the module specified in (s1), and store it in the device specified in (d) and later.
1014
1015 -[DFROM (s1) (s2) (d) (N)]
1016
1017 **Content, range and data type**
1018
1019 (% class="table-bordered" %)
1020 |=(% scope="row" %)**Parameter**|=(% style="width: 473px;" %)**Content**|=(% style="width: 134px;" %)**Range**|=(% style="width: 193px;" %)**Data type**|=(% style="width: 172px;" %)**Data type (label)**
1021 |=(s1)|(% style="width:473px" %)Module number, the first module is 0, the second module is 1, and so on|(% style="width:134px" %)0 to 32767|(% style="width:193px" %)Unsigned BIN 16 bit|(% style="width:172px" %)ANY16
1022 |=(s2)|(% style="width:473px" %)Start reading from which BFM in the module|(% style="width:134px" %)0 to 32767|(% style="width:193px" %)Unsigned BIN 16 bit|(% style="width:172px" %)ANY16
1023 |=(d)|(% style="width:473px" %)Start number of the device storing the read data|(% style="width:134px" %)-|(% style="width:193px" %)Signed BIN 32 bit|(% style="width:172px" %)ANY32
1024 |=(N)|(% style="width:473px" %)Number of read data|(% style="width:134px" %)0 to 256|(% style="width:193px" %)Unsigned BIN 16 bit|(% style="width:172px" %)ANY16
1025
1026 **Device used**
1027
1028 (% class="table-bordered" style="width:1074px" %)
1029 |=(% rowspan="2" %)**Instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="12" %)**Devices**|=(((
1030 **Offset**
1031
1032 **modification**
1033 )))|=(% style="width: 147px;" %)(((
1034 **Pulse**
1035
1036 **extension**
1037 )))
1038 |=**KnY**|=**KnM**|=**KnS**|=**T**|=**C**|=**D**|=**R**|=**SD**|=**LC**|=(% style="width: 40px;" %)**HSC**|=(% style="width: 55px;" %)**K**|=**H**|=**[D]**|=(% style="width: 147px;" %)**XXP**
1039 |=(% rowspan="4" %)DFROM|Parameter 1|●|●|●|●|●|●|●|●| |(% style="width:40px" %) |(% style="width:55px" %)●|●|●|(% style="width:147px" %)●
1040 |Parameter 2|●|●|●|●|●|●|●|●| |(% style="width:40px" %) |(% style="width:55px" %)●|●|●|(% style="width:147px" %)●
1041 |Parameter 3|●|●|●|●|●|●|●|●|●|(% style="width:40px" %)●|(% style="width:55px" %) | |●|(% style="width:147px" %)●
1042 |Parameter 4|●|●|●|●|●|●|●|●| |(% style="width:40px" %) |(% style="width:55px" %)●|●|●|(% style="width:147px" %)●
1043
1044 **Features**
1045
1046 Read (N)×2 words of data from the buffer memory specified in (s2) in the intelligent function module specified in (s1), and store it in the device specified in (d) and later.
1047
1048 (% style="text-align:center" %)
1049 [[image:10_html_ea4017a0483ddbbe.gif||class="img-thumbnail"]]
1050
1051 As the following Circuit program
1052
1053 (% style="text-align:center" %)
1054 [[image:10_html_6d0c9e8bc37fe95.png||class="img-thumbnail"]]
1055
1056 It means that when M1 is ON, the data in the buffer register (BFM) #10 to #13 in the special module #0 (the first) will be written to the D200 to D203 registers of the PLC. When M1 is OFF, no operation is performed.
1057
1058 Currently LX5V PLC supports 16 special expansion modules at the same time.
1059
1060 The special soft components used are as follows:
1061
1062 (% class="table-bordered" %)
1063 |=(% scope="row" %)**Devices**|=**Content**
1064 |=SD2081|Total number of modules
1065 |=SD2082|Number of IO expansion modules
1066 |=SD2083|Number of special expansion modules
1067 |=SD2084|The first missing expansion module. When the value is -1, it means not lost
1068
1069 **Error code**
1070
1071 (% class="table-bordered" %)
1072 |=(% scope="row" style="width: 140px;" %)**Error code**|=(% style="width: 934px;" %)**Content**
1073 |=(% style="width: 140px;" %)4085H|(% style="width:934px" %)(s1) (s2) (N) The read address exceeds the device range
1074 |=(% style="width: 140px;" %)4086H|(% style="width:934px" %)(d) The write address exceeds the device range
1075 |=(% style="width: 140px;" %)4084H|(% style="width:934px" %)(s1) (s2) is not in the range of 0 to 32767 or (N) is not in the range of 0 to 256
1076 |=(% style="width: 140px;" %)7080H|(% style="width:934px" %)Check error when communicating between PLC and module
1077 |=(% style="width: 140px;" %)7081H|(% style="width:934px" %)Expansion module communication message is abnormal
1078 |=(% style="width: 140px;" %)7082H|(% style="width:934px" %)FROM/TO instruction error
1079 |=(% style="width: 140px;" %)7083H|(% style="width:934px" %)The specified extension module was not found
1080
1081 **Example**
1082
1083 (% style="text-align:center" %)
1084 [[image:10_html_7389fb305b495d09.png||class="img-thumbnail"]]
1085
1086 When M1 is turned on
1087
1088 The value of BFM3 to BFM8 of module #0 (first) will be transferred to D200 to D205
1089
1090 (% style="text-align:center" %)
1091 [[image:10_html_2f6f4ddff10c30ec.png||class="img-thumbnail"]]
1092
1093 (% style="text-align:center" %)
1094 [[image:10_html_8a1de3e41b64afe1.png||class="img-thumbnail"]]
1095
1096 = {{id name="_Toc28953"/}}**{{id name="_Toc13721"/}}{{id name="_Toc14994"/}}{{id name="_Toc4655"/}}RS and RS2 instructions corresponding protocol description** =
1097
1098 == {{id name="_10.7.1 Custom protocol description"/}}**{{id name="_Toc19972"/}}{{id name="_Toc7163"/}}{{id name="_Toc25715"/}}{{id name="_Toc23891"/}}{{id name="_Toc21391"/}}{{id name="_自定义协议说明"/}}Custom protocol description** ==
1099
1100 **{{id name="_Toc28071132"/}}Introduction**
1101
1102 The function of custom protocol is that it can directly transmit data with the device without any processing or communicate with other devices with the corresponding protocol set by the customer.
1103
1104 At present, the custom protocol of 5V PLC is configured and sent by COM2, and the instruction used is RS instruction, and it need to configure the protocol and serial port parameters through the Devices.
1105
1106 The current custom protocol is generally close to 3V series.
1107
1108 **{{id name="_Toc28071133"/}}Basic configuration**
1109
1110 **(1) Instructions**
1111
1112 The RS instruction itself has the same usage as the previous RS instruction at 3V, and it can use R device.
1113
1114 -[RS (s) (m) (d) (N)]
1115
1116 **Content, range and data type**
1117
1118 (% class="table-bordered" %)
1119 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1120 |(s)|The start address of the register area where the data to be sent is stored|-|Unsigned BIN 16 bit|ANY16
1121 |(m)|Is the length of the data to be sent (number of bytes)|0 to 528|Unsigned BIN 16 bit|ANY16
1122 |(d)|Start number of the device storing the written data|-|Unsigned BIN 16 bit|ANY16
1123 |(N)|Number of data written|0 to 528|Unsigned BIN 16 bit|ANY16
1124
1125 **{{id name="_Toc20319"/}}Device used**
1126
1127 (% class="table-bordered" %)
1128 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="6" %)**Devices**|**Offset modification**|(((
1129 **Pulse**
1130
1131 **extension**
1132 )))
1133 |**T**|**C**|**D**|**R**|**K**|**H**|**[D]**|**XXP**
1134 |(% rowspan="4" %)RS|Parameter 1|●|●|●|●|●|●| |
1135 |Parameter 2|●|●|●|●|●|●| |
1136 |Parameter 3|●|●|●|●|●|●| |
1137 |Parameter 4|●|●|●|●|●|●| |
1138
1139 **✎Note: **Although the RS instruction currently allows all the parameters of the instruction to use constants such as K and H, there are different restrictions according to the different protocol. When the protocol is a custom protocol, S and D cannot be constants, otherwise it will report an error.
1140
1141 **{{id name="_Toc28071135"/}}(2) Special device settings**
1142
1143 Special address table
1144
1145 (% class="table-bordered" %)
1146 |(% colspan="2" %)**COM2 special D device (SD)**|(% colspan="2" %)**COM2 special M Device (SM)**
1147 |2590|__**Communication port setting**__|2590|__**Send control on**__
1148 |2591|__**Serial parameter modification identification**__|2591|__**Send control/send reminder**__
1149 |2592|Protocol settings|2592|__**Receive control on**__
1150 |2593|Protocol modification logo|2593|__**Accept control/receive prompt**__
1151 |2594|Station number setting|2594|__**8-bit mode (for custom protocol)**__
1152 |2595|Station number modification logo|2595|
1153 |2596|(((
1154 __**Sending interval (0.1ms) 0-32767**__
1155
1156 __**It is 10 (1ms) when set to 0**__
1157 )))|2596|
1158 |2597|(((
1159 __**Communication timeout setting (10ms) 0-32767**__
1160
1161 __**It is 10(100ms) when set to 0**__
1162 )))|2597|
1163 |2598|__**Timeout retry times 0-32767**__|2598|
1164 |2599|(((
1165 __**Character interval timeout setting (for custom protocol) (0.1ms)**__
1166
1167 __**0-32767 . It is 10 (1ms) when set to 0**__
1168 )))|2599|
1169 |2600|__**STX value**__|2600|
1170 |2601|__**ETX value**__|2601|
1171 |...| |...|
1172 |2610|**The amount of data received**|2610|**Communication complete flag**
1173 |2611|**Last error**|2611|**Receiving flag**
1174 |2612|**Current error**|2612|**Retry occurred**
1175 |2613|**Error steps**|2613|**Communication error**
1176 |2614|**Error station number**|2614|**Communication timeout**
1177 |2615|**Cumulative number of errors**|2615|
1178
1179 The contents that the custom protocol will be used and set has been marked with underline and bold.
1180
1181 In addition, the devices to be used as judgment conditions have also been marked in bold in the table.
1182
1183 **✎Note: **COM1 currently does not support custom protocols.
1184
1185 **{{id name="_Toc28071136"/}}1) Communication port setting SD2590**
1186
1187 (% class="table-bordered" %)
1188 |(% colspan="2" %)**Bit number**|**B0**|**B1、B2**|**B3**|(((
1189 **B4、B5、B6、**
1190
1191 **B7、B8、B9**
1192 )))|**B10**|**B11**
1193 |(% colspan="2" %)**Name**|**Data length**|**Parity**|**Stop Bit**|**Baud rate(bps)**|**STX**|**ETX**
1194 |(% rowspan="2" %)**Content**|**0 off**|7 bit|(% rowspan="2" %)(((
1195 b2,b1
1196
1197 (0,0): None
1198
1199 (0,1): Odd parity (ODD)
1200
1201 (1,1): Even parity (EVEN)
1202 )))|1 bit|(% rowspan="2" %)(((
1203 |4800|0111
1204 |9600|1000
1205 |19200|1001
1206 |38400|1010
1207 |57600|1011
1208 |115200|1100
1209 |187500|1101
1210 |230400|1110
1211 |460800|1111
1212 |921600|10000
1213 )))|None|None
1214 |**1 on**|8 bit|2 bit|Turn on ETX, the ETX value is set in SD2600|Turn on ETX, the ETX value is set in SD2601
1215
1216 Set the serial port parameters to SD2590 according to the bit settings provided in the table above. The setting is roughly the same as 3V. It is mainly because the baud rate can be set to a higher baud rate, the bit used need backward two bits when STX and ETX start.
1217
1218 For example: To set the serial port parameters: baud rate 115200, stop bit 1, data bit 8, no parity bit, turn on STX, you need to set the value H4C1 (K1217) on SD2590. The parameters directly set to SD2590 are only valid in the first cycle of PLC RUN.
1219
1220 If you need to modify it during RUN, you can use the PORTPARAM instruction to set it.
1221
1222 **{{id name="_Toc28071137"/}}2) Protocol setting SD2592**
1223
1224 (% class="table-bordered" %)
1225 |(% colspan="2" %)**Protocol settings**|(% colspan="2" %)**Protocol settings**
1226 |0 H|Wecon Modbus slave station|10 H|Cunstom protocol
1227 |2 H|ModbusRTU slave station|20 H|ModbusRTU master station
1228 |3 H|ModbusASCII slave station|30 H|ModbusASCII master station
1229
1230 The corresponding protocol can be set by setting the corresponding value in SD2592.
1231
1232 The parameters directly set to SD2592 are only valid in the first cycle of PLC RUN.
1233
1234 If you need to modify it during RUN, you can use the PROTOCOL instruction to set it.
1235
1236 **{{id name="_Toc28071138"/}}3) Sending interval SD2596**
1237
1238 The main function of sending interval is: how long to wait for sending the next instruction after one instruction is completed. If the value is set to 0, there is basically no waiting for sending interval, but it will be affected by the scan cycle.
1239
1240 The unit of the sending interval is 0.1ms, that is, the interval time is 10ms when the setting is 100.
1241
1242 **{{id name="_Toc28071139"/}}4) Communication timeout SD2597 and timeout retry SD2598**
1243
1244 (% style="text-align:center" %)
1245 [[image:10_html_53f716718aad2197.png||class="img-thumbnail"]]
1246
1247 The main function of communication timeout is: How long does it take to wait for no data to be received after the PLC sends retry or occurs an error. When 0 is set, the default is 100ms.
1248
1249 The unit of communication timeout is 10ms, that is, the timeout judgment time is 10ms when the setting is 100.
1250
1251 When a receiving timeout occurs, it will determine whether there are retry times and the current retry times. If the retry times are greater than or equal to SD2598, an error will be reported.
1252
1253 If SD2598 is set to 0, it will not try again.
1254
1255 If it is set to 1, send once again after sending a timeout.
1256
1257 **{{id name="_Toc28071140"/}}5) Character interval timeout SD2599**
1258
1259 Currently this setting is only available for custom protocols.
1260
1261 The main function of the character interval timeout is: after receiving at least one character before the communication timeout, judge whether the interval time between the following two characters has exceeded. if it is, report an error and end the communication.
1262
1263 (% style="text-align:center" %)
1264 [[image:10_html_3725d523c70bd43d.png||class="img-thumbnail"]]
1265
1266 This setting is mainly designed considering that some devices may send slow or have other specific sending requirements.
1267
1268 {{id name="_Toc28071141"/}}The character interval timeout will not retry.
1269
1270 **(3) Serial port parameter setting instructions**
1271
1272 **1) Host computer interface settings**
1273
1274 (% style="text-align:center" %)
1275 [[image:10_html_3f08ef293fcbfcf1.png||class="img-thumbnail"]]
1276
1277 Through the PLC parameter setting in the upper computer interface, If protocol is set to none, it is a custom protocol.
1278
1279 The serial port parameter content mainly sets the serial port parameters such as baud rate and data bit.
1280
1281 After the start character is enabled, the start/end character can be sent. The start/end character will also be distinguished when receiving. See the description in the sending and receiving process for details.
1282
1283 **✎Note: **The characters here are decimal values.
1284
1285 **{{id name="_Toc28071142"/}}2) PORTPARA instruction**
1286
1287 -[PORTPARA (s) (N)]
1288
1289 **Content, range and data type**
1290
1291 (% class="table-bordered" %)
1292 |**Parameter**|**Content**|**Range**|**Data type**|(((
1293 **Data type**
1294
1295 **(label)**
1296 )))
1297 |(s)|Serial port parameters to be set|0 to 256|Unsigned BIN 16 bit|ANY16
1298 |(N)|Which communication port to set (0 means COM1, 1 means COM2)|0, 1|Unsigned BIN 16 bit|ANY16
1299
1300 **{{id name="_Toc23976"/}}Device used**
1301
1302 (% class="table-bordered" %)
1303 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|**Offset modification**|(((
1304 **Pulse**
1305
1306 **extension**
1307 )))
1308 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
1309 |(% rowspan="2" %)PROTPARA|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|●
1310 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●
1311
1312 Function: To set communication parameters when running.
1313
1314 Please refer to "PORTPARA instruction description" for details.
1315
1316 **{{id name="_Toc28071143"/}}3) PROTOCOL instruction**
1317
1318 -[PROTOCOL (s) (N)]
1319
1320 **Content, range and data type**
1321
1322 (% class="table-bordered" %)
1323 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1324 |(s)|Protocol number to be set|0 to 65535|Unsigned BIN 16 bit|ANY16
1325 |(N)|Which communication port to set (0 means COM1, 1 means COM2 *1)|1|Unsigned BIN 16 bit|ANY16
1326
1327 **{{id name="_Toc1191"/}}Device used**
1328
1329 (% class="table-bordered" %)
1330 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
1331 **Offset**
1332
1333 **modification**
1334 )))|(((
1335 **Pulse**
1336
1337 **extension**
1338 )))
1339 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
1340 |(% rowspan="2" %)PORTOCOL|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|
1341 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|
1342
1343 **Features:**
1344
1345 It is used to set the communication protocol when running. The above instruction actually sets a specific value for the parameter modification flag. The specific calculation formula is: (parameter setting value + the offset of the start special device corresponding to the serial port + 10)*2
1346
1347 For example, setting the protocol to Modbusrtu master station (H20) is (0x20 +2593-2590 +10)*2, that is (32 +3+10) *2=90. This is to prevent the serial port parameters from being modified at will.
1348
1349 The trigger of setting parameters in custom protocol will not change the value until an instruction is completed.
1350
1351 The trigger of setting parameters in Modbus master station protocol won’t change the value until an instruction is completed.
1352
1353 The trigger of setting parameters in the Modbus slave protocol can be switched as long as it is not processing the received data. Please refer to "PROTOCOL instruction description" for details.
1354
1355 **4) Priority description of serial port parameters**
1356
1357 The priority of serial port parameter settings are listed as blow. The serial port parameters are saved by power failure currently.
1358
1359 Serial port parameter set instruction setting = Ladder program MOV instruction set the corresponding SD device > the download parameters of host computer > Previous power-off save data.
1360
1361 **(4) Ladder program**
1362
1363 (% style="text-align:center" %)
1364 [[image:10_html_487e57593173359e.png||class="img-thumbnail"]]
1365
1366 (((
1367 * Set serial port parameters:
1368 * Baud rate 112500, stop bit 1, data bit 8, no parity bit none
1369 * Set protocol to custom protocol
1370 * Sending interval: 5ms
1371 * Receiving timeout: 100ms
1372 * Number of repetitions: 3 times
1373 * Characters interval timeout: 30ms
1374 * Custom protocol sending start address D200, sending length 8.
1375 * Receiving start address D300, receiving length 6
1376 * Send directly after trigger
1377 * After receiving is completed, close the instruction directly and reset the instruction receiving flag
1378 )))
1379
1380 **{{id name="_Toc28071145"/}}Sending and receiving process**
1381
1382 **{{id name="_Toc28071146"/}}(1) Sending and receiving mechanism**
1383
1384 **1) **{{id name="_Toc28071147"/}}**No start character (STX) and end character (ETX)**
1385
1386 ①16-bit (SM2594 is OFF)
1387
1388 The devices will be divided into high and low directly, and send data from the low address first and then the high address in order.
1389
1390 (% style="text-align:center" %)
1391 [[image:10_html_5891dcc3161d6651.png||class="img-thumbnail"]]
1392
1393 (% style="text-align:center" %)
1394 [[image:image-20220926145824-1.jpeg||height="430" width="607"]]
1395
1396 ②8-bit (SM2594 is ON)
1397
1398 Get the value of the low address of device directly and send it
1399
1400 (% style="text-align:center" %)
1401 [[image:10_html_1d76c606ba1b2ba8.png||class="img-thumbnail"]]
1402
1403 (% style="text-align:center" %)
1404 [[image:10_html_a46b2be94cb51e78.png||class="img-thumbnail"]]
1405
1406 The data sent in the case of the ladder program and the data above should be 70 E1 31 62 6C.
1407
1408 (% style="text-align:center" %)
1409 [[image:10_html_1920f501fdbca9b8.png||class="img-thumbnail"]]
1410
1411 Receiving will also be stored in the lower address
1412
1413 **{{id name="_Toc28071148"/}}2) Open and set the start character STX**
1414
1415 The value of the start character SD2600 is only valid in the low bit
1416
1417 When STX is enabled, the send will start with STX. When receiving, the send will start with STX, but STX will not be displayed.
1418
1419 If it receives the STX during the receiving, the receiving will restart.
1420
1421 If the first character is not received, the timeout period is judged by the first character timeout. When a character is received, no matter what data is received, the inter-character timeout will be counted from the last character received.
1422
1423 (% style="text-align:center" %)
1424 [[image:10_html_bd054fd74ccaddc.png||class="img-thumbnail"]]
1425
1426 (% style="text-align:center" %)
1427 [[image:10_html_a46b2be94cb51e78.png||class="img-thumbnail"]]
1428
1429 For example, the result of the above ladder program and the above data sending is FE 70 7D E1 00 31.
1430
1431 Sending FE 51 26 34 15 to the PLC at this time will receive the following data. And if you send FE 25 63 FE 51 26 34 15 you will also receive the following data.
1432
1433 (% style="text-align:center" %)
1434 [[image:10_html_f2dbc2f6fb276e3f.png||class="img-thumbnail"]]
1435
1436 **{{id name="_Toc28071149"/}}3) Open and set the end character ETX situation**
1437
1438 The value of ending character SD2601 is only valid in the low bit.
1439
1440 When ETX is enabled, the send will end with ETX.
1441
1442 When ETX is received, SM2610 and SM2593 are immediately turned ON, regardless of whether sufficient length is received.
1443
1444 (% style="text-align:center" %)
1445 [[image:10_html_17fa71d20bec1531.png||class="img-thumbnail"]]
1446
1447 (% style="text-align:center" %)
1448 [[image:10_html_a46b2be94cb51e78.png||class="img-thumbnail"]]
1449
1450 For example, the result of the above Circuit program and the above data transmission is 70 7D E1 00 31 FD.
1451
1452 If the above Circuit program sends 01 06 FD to him, the following data will be received. If the FD is sent directly, it will be judged as the end directly.
1453
1454 (% style="text-align:center" %)
1455 [[image:10_html_72c7fdeee574504.png||class="img-thumbnail"]]
1456
1457 **{{id name="_Toc28071150"/}}4) Both the start character STX and the end character ETX are turned on**
1458
1459 When both are opened, it is basically a combination of the above single opened states. But if only ETX data is received when both start, it will not end immediately. It will judge the character interval time and does not start receiving data.
1460
1461 **{{id name="_Toc28071151"/}}(2) Receiving after sending (similar to Modbus master station mechanism)**
1462
1463 **{{id name="_Toc28071152"/}}1) Send control switch (SM2590) and receive control switch (SM2592) OFF (default)**
1464
1465 When the contact of RS instruction is on, turn SM2591 on and send it immediately. SM2591 will be automatically OFF immediately after sending.
1466
1467 After sending, SM2593 is ON, it will always stop at this instruction, and wait for it to be OFF and then receive data. If it is OFF, it will start to receive data.
1468
1469 After the first character timeout period (SD2597), if no character is received, it is judged as a timeout. If there are retry times, it will retry. But after retrying, the communication still does not report an error, and SM2593 and SM2614 are turned on.
1470
1471 After receiving the first character, it will judge whether that the interval between characters exceeds the time set by SD2599. If it it doesn’t. it will report an error.(For the details, please refer to [the timeout of the interval character].)
1472
1473 When there are two or more instructions, the first RS instruction which is set ON will be sent after SM2591 is ON. Later, if this RS instruction is completed*1, then turn ON, SM2591 will switch to the next RS instruction*2 in the ladder sequence.
1474
1475 When there are two or more instructions, switch to another one during the data reception and it continue to stay back in the original instruction to until the reception is complete.
1476
1477 **✎Note:**
1478
1479 **✎**Completion refers to receiving data or reporting an error.
1480
1481 **✎**If there is no other open RS instruction after the ladder sequence, it will return to the first RS instruction that was opened in the ladder sequence for execution.
1482
1483 **{{id name="_Toc28071153"/}}2) The sending way when the sending control switch (SM2590) is ON**
1484
1485 When the sending control switch (SM2590) is ON, there is no need to set SM2591 ON. At this time, as long as the contact of the RS instruction is triggered, it can be sent, and SM2591 is automatically turned ON.
1486
1487 **{{id name="_Toc28071154"/}}3) The receiving way when the receiving control switch (SM2592) is ON**
1488
1489 When the receiving control switch (SM2592) is ON, SM2593 will be OFF automatically when the instruction is executed. It will no longer judge the status of SM2593 when receiving, and SM2593 will still be turned ON after receiving.
1490
1491 **{{id name="_Toc28071155"/}}4) Sending control switch (SM2590) and receiving control switch (SM2592) ON**
1492
1493 In this case, you only need to trigger the contact before the RS instruction to send data, then it will automatically switch to the waiting status. When the reception is completed, it will turn to the next RS instruction that is turned on.
1494
1495 **{{id name="_Toc28071156"/}}(3) Send-only**
1496
1497 (% style="text-align:center" %)
1498 [[image:10_html_ee6092e0d3a61be2.png||class="img-thumbnail"]]
1499
1500 When the sending length is set to a value other than 0, and the receiving length is set to 0, it is send-only mode.
1501
1502 **{{id name="_Toc28071157"/}}1) The sending control switch (SM2590) is OFF**
1503
1504 When SM2591 is turned ON, the data will be sent without receiving.
1505
1506 When there are two or more instructions, the first RS instruction which is turned ON will be sent after SM2591 is turned ON. After this RS instruction is completed, then turn ON SM2591 will switch to the next RS instruction in the ladder program.
1507
1508 **{{id name="_Toc28071158"/}}2) The Sending control switch (SM2590) is ON**
1509
1510 The RS instruction will be sent when triggered. Multiple instructions are triggered and sent in a loop. During the sending cycle, the interval will be sent according to the set sending interval.
1511
1512 **{{id name="_Toc28071159"/}}(4) Receive-only**
1513
1514 (% style="text-align:center" %)
1515 [[image:10_html_46075eaee9d78457.png||class="img-thumbnail"]]
1516
1517 When the sending length is 0 and the receiving length is not 0, it is only receiving.
1518
1519 **{{id name="_Toc28071160"/}}1) SM2592 receiving control switch OFF**
1520
1521 SM2593 will be turned ON when receiving, and the ladder program control must be turned OFF to continue receiving. SM2593 will not turn ON without receiving data.
1522
1523 When multiple instructions are enabled to receive only at the same time, it will start to receive from the smallest number of steps in the ladder diagram. Time out or received data will be forwarded to the second to continue receiving.
1524
1525 **{{id name="_Toc28071161"/}}2) SM2592 receiving control switch ON**
1526
1527 It can receive normally and will not be controlled by the flag bit. The SM2593 receiving identifier serves as the receiving prompt identifier,and SM2593 will not turn ON without receiving data.
1528
1529 If multiple RS receive only instructions are turned on at the same time, the receiving position is uncertain due to the timeout judgment and switching to the next one.
1530
1531 **{{id name="_Toc28071162"/}}(5) Use receive-only and send-only methods to send after receiving (similar to Modbus slave mechanism)**
1532
1533 (% style="text-align:center" %)
1534 [[image:10_html_a70fbc189fa39660.png||class="img-thumbnail"]]
1535
1536 (((
1537 Receive-only: When it is determined that the reception is complete, it will determine the instruction to be triggered according to the received content, and save the received data at the same time.
1538
1539 Send-only: The content sent by triggered M2 is different from that of triggered M3. After the trigger is over, they will return to trigger the receive-only of M1.
1540 )))
1541
1542 **{{id name="_Toc28071163"/}}10.7.1.4 Error message**
1543
1544 Currently The Error code will be displayed on SD7, SD0, SD 2611 and SD2612.
1545
1546 The Error codes that will appear in the custom protocol are mainly as follows.
1547
1548 (% class="table-bordered" %)
1549 |(% style="width:106px" %)**Error code**|(% style="width:975px" %)**Content**
1550 |(% style="width:106px" %)3181H|(% style="width:975px" %)Data receiving timeout
1551 |(% style="width:106px" %)3188H|(% style="width:975px" %)Wrong length
1552 |(% style="width:106px" %)3189H|(% style="width:975px" %)COM2 data error. "Check whether there are errors in the parameters of instruction. Check whether the slave station supports the setting of this value. (Please refer to Modbus exception 03)"
1553 |(% style="width:106px" %)318EH|(% style="width:975px" %)(((
1554 Current protocol does not support this instruction
1555
1556 (This error is only displayed on SD7 and SD0)
1557 )))
1558 |(% style="width:106px" %)318FH|(% style="width:975px" %)COM2 sending timed out. Contact a technician if this error occurs
1559 |(% style="width:106px" %)3190H|(% style="width:975px" %)COM2 receiving data exceeds the buffer limit.
1560
1561 After resetting the protocol or communication parameters, the error will be cleared.
1562
1563 In addition, the communication completion/communication error/communication timeout flag will be set after the executed instruction.
1564
1565 **10.7.1.5 The difference with Mitsubishi**
1566
1567 The current differences:
1568
1569 1. STX and ETX: Mitsubishi can set up to 4 bytes, we only have one byte.
1570 1. Add sum check and CR, LF.
1571 1. The instruction control of Mitsubishi is that the first instruction triggered is fixed to execute this instruction. It will not be switched to other instructions midway, unless the contact of this instruction is closed.
1572
1573 == **Modbus protocol description** ==
1574
1575 **Introduction**
1576
1577 The Modbus master station protocol is generally close to LX3V. The address was modified in the slave station.
1578
1579 **Basic configuration**
1580
1581 **(1) Introduction**
1582
1583 The RS instruction has the same usage as the previous RS instruction of 3V, and can use R device.
1584
1585 -[RS (s) (m) (d) (N)]
1586
1587 **Content, range and data type**
1588
1589 (% class="table-bordered" %)
1590 |**Parameter**|(% style="width:589px" %)**Content**|(% style="width:119px" %)**Range**|(% style="width:168px" %)**Data type**|(% style="width:113px" %)**Data type (label)**
1591 |(s)|(% style="width:589px" %)The high byte stores the station number of slave station, and the low byte stores the Modbus function code.|(% style="width:119px" %)-|(% style="width:168px" %)Unsigned BIN 16 bit|(% style="width:113px" %)ANY16
1592 |(m)|(% style="width:589px" %)Slave address. The address provided by slave station will read or write data from this address of the slave station|(% style="width:119px" %)-|(% style="width:168px" %)Unsigned BIN 16 bit|(% style="width:113px" %)ANY16
1593 |(d)|(% style="width:589px" %)Length. The length of Modbus read or write. The unit is determined by function code.|(% style="width:119px" %)-|(% style="width:168px" %)Unsigned BIN 16 bit|(% style="width:113px" %)ANY16
1594 |(N)|(% style="width:589px" %)Start address for reading or writing data|(% style="width:119px" %)-|(% style="width:168px" %)Unsigned BIN 16 bit|(% style="width:113px" %)ANY16
1595
1596 **{{id name="_Toc20576"/}}Device used**
1597
1598 (% class="table-bordered" style="width:1058px" %)
1599 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="6" style="width:348px" %)**Devices**|(% style="width:226px" %)**Offset modification**|(((
1600 **Pulse**
1601
1602 **extension**
1603 )))
1604 |**T**|**C**|**D**|**R**|**K**|(% style="width:96px" %)**H**|(% style="width:226px" %)**[D]**|**XXP**
1605 |(% rowspan="4" %)RS|Parameter 1|●|●|●|●|●|(% style="width:96px" %)●|(% style="width:226px" %) |
1606 |Parameter 2|●|●|●|●|●|(% style="width:96px" %)●|(% style="width:226px" %) |
1607 |Parameter 3|●|●|●|●|●|(% style="width:96px" %)●|(% style="width:226px" %) |
1608 |Parameter 4|●|●|●|●| |(% style="width:96px" %) |(% style="width:226px" %) |
1609
1610 **✎Note: **Although the RS instruction currently allows all the parameters of the instruction to use constants such as K and H, there are different restrictions according to the different protocols. When the protocol is Modbus master station protocol, n cannot be a constant, otherwise an error will be reported.
1611
1612 **{{id name="_Toc33979607"/}}(2) Special device setting**
1613
1614 Special address table
1615
1616 (% class="table-bordered" %)
1617 |(% colspan="2" %)**COM 1 special D device (SD)**
1618 |2540|__**Communication port settings**__
1619 |2541|__**Serial parameter modification identification**__
1620 |2542|
1621 |2543|
1622 |2544|__**Station number setting**__
1623 |2545|__**Station number modification logo**__
1624
1625 **✎Note: **COM1 does not support modifying the protocol.
1626
1627 (% class="table-bordered" %)
1628 |(% colspan="2" %)**COM2 special D device (SD)**|(% colspan="2" %)**COM2 special M Device (SM)**
1629 |2590|__**Communication port setting**__|2590|Send control start
1630 |2591|__**Serial parameter modification identifier**__|2591|**Send control/send reminder**
1631 |2592|__**Protocol setting**__|2592|Receive control start
1632 |2593|__**Protocol modification identifier**__|2593|**Receive control/receive prompt**
1633 |2594|__**Station number setting**__|2594|8-bit mode (for custom protocol)
1634 |2595|__**Station number modification identifier**__|2595|
1635 |2596|(((
1636 __**Sending interval (0.1ms) 0-32767.**__
1637
1638 __**It is 10 when set to 0 (1ms)**__
1639 )))|2596|
1640 |2597|(((
1641 __**Communication timeout setting (10ms) 0-32767**__
1642
1643 __**It is 10 when set to 0 (100ms)**__
1644 )))|2597|
1645 |2598|__**Timeout retry times 0-32767**__|2598|
1646 |2599|Character interval timeout setting (for custom protocol) (0.1ms) 0-32767. It is 10 when set to 0 (1ms)|2599|
1647 |2600|STX value|2600|
1648 |2601|ETX value|2601|
1649 |...| |...|
1650 |2610|**The amount of data received**|2610|**Communication complete flag**
1651 |2611|**Last error**|2611|**Receiving flag**
1652 |2612|**Current error**|2612|**Retry occurred**
1653 |2613|**Error steps**|2613|**Communication error**
1654 |2614|**Error station number**|2614|**Communication timeout**
1655 |2615|**Cumulative number of errors**|2615|
1656
1657 {{id name="_Toc33979608"/}}The contents that the custom protocol will be used and set has been marked with underline and bold. In addition, the devices to be used as judgment conditions have also been marked in bold in the table.
1658
1659 **1) Communication port setting SD2590**
1660
1661 (% class="table-bordered" %)
1662 |(% colspan="2" %)**Bit number**|**B0**|**B1、B2**|**B3**|**B4、B5、B6、B7、B8、B9**
1663 |(% colspan="2" %)**Name**|**Data length**|**Parity**|**Stop Bit**|**Baud rate(bps)**
1664 |(% rowspan="2" %)**Content**|**0 off**|7 bit|(% rowspan="2" %)(((
1665 b2,b1
1666
1667 (0,0): None
1668
1669 (0,1): Odd parity (ODD)
1670
1671 (1,1): Even parity (EVEN)
1672 )))|1 bit|(% rowspan="2" %)(((
1673 |4800|0111
1674 |9600|1000
1675 |19200|1001
1676 |38400|1010
1677 |57600|1011
1678 |115200|1100
1679 |187500|1101
1680 |230400|1110
1681 |460800|1111
1682 |921600|10000
1683 )))
1684 |**1 on**|8 bit|2 bit
1685
1686 Set the serial port parameters to SD2590 according to the bit settings provided in the table above. The setting is roughly the same as 3V. It is mainly because the baud rate can be set to a higher baud rate, the bit used need backward two bits when STX and ETX start.
1687
1688 {{id name="_Toc33979609"/}}For example: To set the serial port parameters: baud rate 115200, stop bit 1, data bit 8, no parity bit, you need to set the value H4C1 (K1217) on SD2590. The parameters directly set to SD2590 are only valid in the first cycle of PLC RUN. If you need to modify it during RUN, you can use the PORTPARAM instruction to set it.
1689
1690 **2) Protocol setting SD2592**
1691
1692 (% class="table-bordered" %)
1693 |(% colspan="4" %)**Protocol settings**
1694 |0 H|Wecon Modbus slave station|10 H|Custom protocol
1695 |2 H|ModbusRTU slave station|20 H|ModbusRTU master station
1696 |3 H|ModbusASCII slave station|30 H|ModbusASCII master station
1697
1698 The corresponding protocol can be set by setting the corresponding value in SD2592. The parameters directly set to SD2592 are only valid in the first cycle of PLC RUN. If you need to modify it during RUN, you can use the PROTOCOL instruction to set it. COM1 cannot use protocols other than Wecon Modbus slave station Currently.
1699
1700 **{{id name="_Toc33979610"/}}3) Sending interval SD2596**
1701
1702 The main function of sending interval is: how long to wait for sending the next instruction after one instruction is completed. If it is set to 0, there is basically no waiting for interval sending, but it will be affected by the scan cycle. The unit of the sending interval is 0.1ms, that is, the interval is 10ms when set to 100.
1703
1704 **{{id name="_Toc33979611"/}}4) Communication timeout SD2597 and timeout retry SD2598**
1705
1706 (% style="text-align:center" %)
1707 [[image:10_html_8c204d3cecb508d7.png||class="img-thumbnail"]]
1708
1709 The main function of communication timeout is: How long does it take to wait for no data to be received and then retry or report an error after the PLC sends. When it is set to 0, the default value is 100ms.
1710
1711 The unit of communication timeout is 10ms, that is, the timeout determine time is 100ms when set to 10.
1712
1713 When a receiving timeout occurs, it will determine whether there are retry times and the current retry times. If the retry times are greater than or equal to SD2598, an error will be reported.
1714
1715 If SD2598 is set to 0, it will not retry.
1716
1717 If it is set to 1, send once and then send once again after timeout.
1718
1719 (% class="wikigeneratedid" id="HSerialportparametersetting" %)
1720 **Serial port parameter setting**
1721
1722 (% class="wikigeneratedid" id="HPORTPARAinstruction" %)
1723 **PORTPARA instruction**
1724
1725 -[PORTPARA (s) (N)]
1726
1727 **Content, range and data type**
1728
1729 (% class="table-bordered" %)
1730 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1731 |(s1)|The start number of the device that stores the number of digits of converted value|-|Signed BIN 16 bit|ANY16_S_ARRAY
1732 |(s2)|Converted BIN data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
1733
1734 **{{id name="_Toc3250"/}}Device used**
1735
1736 (% class="table-bordered" %)
1737 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|(((
1738 **Offset**
1739
1740 **modification**
1741 )))|(((
1742 **Pulse**
1743
1744 **extension**
1745 )))
1746 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
1747 |(% rowspan="2" %)PORTPARA|Parameter 1|●|●|●|●|●|●|●|●|●|●|●|●
1748 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●
1749
1750 **Features**
1751
1752 Set communication parameters when used for run. Please refer to "__[[PORTPARA instruction description>>path:#_PORTPARA/MODBUS serial port parameter setting]]__" for details**.**
1753
1754 **PROTOCOL instruction**
1755
1756 -[PROTOCOL (s) (N)]
1757
1758 **Content, range and data type**
1759
1760 (% class="table-bordered" %)
1761 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1762 |(s)|Protocol number to be set|0 to 65535|Unsigned BIN 16 bit|ANY16
1763 |(N)|Which communication port to set (0 means COM1, 1 means COM2 *1)|1|Unsigned BIN 16 bit|ANY16
1764
1765 **Device used**
1766
1767 (% class="table-bordered" %)
1768 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="10" %)**Devices**|**Offset modification**|(((
1769 **Pulse**
1770
1771 **extension**
1772 )))
1773 |**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|(% style="width:33px" %)**H**|**[D]**|**XXP**
1774 |(% rowspan="2" %)PROTOCOL|Parameter 1|●|●|●|●|●|●|●|●|●|(% style="width:33px" %)●|●|●
1775 |Parameter 2|●|●|●|●|●|●|●|●|●|(% style="width:33px" %)●|●|●
1776
1777 **{{id name="_Toc13079"/}}Features**
1778
1779 Set the communication protocol when used for run. The instruction above actually is to set a specific value for the parameter modification flag.
1780
1781 The calculation formula is: (parameter setting value + the offset of the start special device corresponding to the serial port + 10)*2
1782
1783 For example, setting the protocol to ModbusRTU master station (H20) is (0x20 +2593-2590 +10)*2, which is (32 +3+10) *2=90. This is to prevent the serial port parameters from being modified at will. .
1784
1785 In Modbus master protocol, the trigger of setting parameters is to change the value after an instruction is completed.
1786
1787 In Modbus slave protocol, the trigger of setting parameters is that to switch as long as it is not processing the received data.
1788
1789 For details, please refer to "PROTOCOL instruction description"
1790
1791 **3) Host computer settings**
1792
1793 The PLC parameter setting of host computer can set the corresponding serial port parameters.
1794
1795 (% style="text-align:center" %)
1796 [[image:10_html_4208a2ce93bb23e7.png||class="img-thumbnail"]]
1797
1798 Specialized protocol station number cannot be 0.
1799
1800 The station number under ModbusRTU and ModbusASCII protocol is 0: the protocol sets the master station.
1801
1802 The station number under ModbusRTU and ModbusASCII protocol is not 0: the protocol sets the slave station.
1803
1804 The serial port parameters are filled in according to the content in the form.
1805
1806 **✎Note: **RTU protocol cannot set data bit of 7-bit.
1807
1808 **4)Priority description of serial port parameters**
1809
1810 The priority of serial port parameter settings are listed as blow. The serial port parameters are saved by power failure currently.
1811
1812 Serial port parameter set instruction setting = Ladder program MOV instruction set the corresponding SD device > the download parameters of host computer > Previous power-off save data.
1813
1814 **{{id name="_Toc33979615"/}}(4) Basic ladder program**
1815
1816 (% style="text-align:center" %)
1817 [[image:10_html_a7e64b4f4526b73e.png||class="img-thumbnail"]]
1818
1819 (((
1820 Serial port parameter setting
1821
1822 Baud rate 115200, data bit 8, parity bit none, stop bit 1
1823
1824 Communication protocol setting: ModbusRTU master station protocol
1825
1826 Sending interval: 5ms
1827
1828 Receiving timeout: 100ms
1829
1830 Timeout retry times: 3 times
1831
1832 Station number 01H, function code 03H, slave address 10, length 05
1833
1834
1835 )))
1836
1837 **{{id name="_Toc33979616"/}}10.7.2.3 Send and receive process**
1838
1839 **{{id name="_Toc33979617"/}}(1) Modbus master station**
1840
1841 When programming, before each RS (Modbus mode) instruction, the assignment of each operand unit, such as the communication operation object address, operation type, operation register address, data number, sending or receiving unit, etc., is completed, once the execution starts, the system program will automatically calculate the CRC check, organize the communication frame, and complete the operation of sending data and receiving response.
1842
1843 If you use Modbus-ASC protocol communication (set SD2592 as H30), the HEX-ASC format conversion of sending and receiving data is automatically completed by the PLC system program. The RS (Modbus mode) instruction method and the Modbus-RTU protocol method are exactly the same.
1844
1845 In the plc program, if multiple RS (Modbus mode) instructions are driven, the system program will still execute the "sending, waiting for answer, receiving, verification, analysis and storage" of an RS instruction, and then perform the same process for the next RS instruction until all RS instructions are executed and then restarted. You don not need to care about the timing and process of its execution, which simplifies the PLC programming design. This is the advantage of Modbus instruction.
1846
1847 Modbus master function list
1848
1849 (% class="table-bordered" %)
1850 |**Function code**|**Function name**|**Details**
1851 |0x01|Coil readout|Coil readout (multiple points optional)
1852 |0x02|Input readout|Input and read (multiple points optional)
1853 |0x03|Holding register readout|Holding register readout(multiple points optional)
1854 |0x04|Input register readout|Input register readout (multiple points optional)
1855 |0x05|1 coil write|Coil writing (only 1 point)
1856 |0x06|1 register write|Holding register write (only 1 point)
1857 |0x0F|Batch coil write|Multi-point coil writing
1858 |0x10|Batch register write|Multi-point holding register write
1859
1860 (((
1861 Serial port parameter setting
1862
1863 Baud rate 115200, data bit 8, no parity bit, stop bit 1
1864
1865 Example:
1866 )))
1867
1868 (% style="text-align:center" %)
1869 [[image:10_html_a7e64b4f4526b73e.png||class="img-thumbnail"]]
1870
1871 (((
1872 Communication protocol setting: ModbusRTU master station protocol
1873
1874 Sending interval: 5ms
1875
1876 Receiving timeout: 100ms
1877
1878 Timeout retry times: 3 times
1879
1880 Station number 01H, function code 03H, slave address 10, length 05
1881
1882
1883 )))
1884
1885 As shown in the ladder program shown:
1886
1887 When M1 is turned ON, PLC will send data (hexadecimal) from COM2 of PLC: 01 03 00 0A 00 05 A5 C8
1888
1889 * 01: Slave address, the high 8 bits of (s);
1890 * 03: Modbus instruction code, the lower 8 bits of (s). It is to read the slave register;
1891 * 00 0A: The address of the slave register to be read, the value of (m);
1892 * 00 05: The number of registers to be read, the value of (d),
1893 * A5 C8: CRC check code.
1894
1895 **✎Note: **
1896
1897 When using 1 coil to write (0x05), the value used for writing 1 is 0xFF00, and the value used for writing 0 is 0x0000.
1898
1899 When using batch coil write (0x0F), pay attention to the high and low byte exchange. For example, when writing 1 length, the fourth parameter value is 1 (0x0001), which means 0 is sent. You need to write 256 (0x0100) to write 1 to the target address.
1900
1901 **{{id name="_Toc33979618"/}}(2) Modbus slave**
1902
1903 When the PLC series is used as a Modbus slave, it supports Modbus communication operation instructions such as 0x01, 0x03, 0x05, 0x06, 0x 0f, 0x10. The coils of the PLC that can be read and written include M, S, T, C, X (only Read) SM, Y, LC, HSC and other variables through these instructions. Register variables include D, T, C, R, SD, LC, HSC.
1904
1905 When the Modbus communication master accesses (reads or rewrites) the internal variables of the PLC slave, it must follow the following communication instruction frame definition and the variable address index method in order to carry out normal communication operations.
1906
1907 **{{id name="_Toc33979619"/}}1) instruction code 0x01 (01): read coil**
1908
1909 (% class="table-bordered" %)
1910 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1911 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1912 |2|0x01 (instruction code)|1 byte|Read coil
1913 |3|Coil start address|2 bytes|High bit in front, low bit in back, see coil addressing
1914 |4|Number of coils|2 bytes|High bit in front, low bit in back (N)
1915 |5|CRC check|2 bytes|Low bit in front, high bit in back
1916
1917 Response frame format: slave address + 0x01 + number of bytes + coil status + CRC check
1918
1919 (% class="table-bordered" %)
1920 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1921 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1922 |2|0x01 (instruction code)|1 byte|Read coil
1923 |3|Number of bytes|1 byte|Value: [(N+7)/8]
1924 |4|Coil state|[(N+7)/8] bytes|Every 8 coils are combined into one byte. If the last one is less than 8 bits, fill in 0 in the undefined part. The first 8 coils are in the first byte, and the coil with the smallest address is in the lowest bit. And so on
1925 |5|CRC check|2 bytes|High bit first, then low bit
1926
1927 Error response: refer to error response frame.
1928
1929 **{{id name="_Toc33979620"/}}2) instruction code 0x03 (03): read register**
1930
1931 Request frame format: slave address + 0x03 + register start address + number of registers + CRC check.
1932
1933 (% class="table-bordered" %)
1934 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1935 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1936 |2|0x03 (instruction code)|1 byte|Read register
1937 |3|Register start address|2 bytes|High bit in front, low bit in back, see register addressing
1938 |4|Number of registers|2 bytes|High bit in front, low bit in back (N)
1939 |5|CRC check|2 bytes|High bit in front, low bit in back
1940
1941 Response frame format: slave address + 0x03 + number of bytes + register value + CRC check.
1942
1943 (% class="table-bordered" %)
1944 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1945 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1946 |2|0x03 (instruction code)|1 byte|Read register
1947 |3|Number of bytes|1 byte|Value: N*2
1948 |4|Register value|N*2 bytes|Every two bytes represent a register value, with high bit in front, low bit in back. The smallest register address comes first
1949 |5|CRC check|2 bytes|High bit in front, low bit in back
1950
1951 Error response: See error response frame.
1952
1953 **{{id name="_Toc216324734"/}}3)** {{id name="_Toc267753989"/}}{{id name="_Toc33979621"/}}**instruction code 0x05 (05): write single coil**
1954
1955 Request frame format: slave address + 0x05 + coil address + coil status + CRC check.
1956
1957 (% class="table-bordered" %)
1958 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1959 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1960 |2|0x05 (instruction code)|1 byte|Write single coil
1961 |3|Coil address|2 bytes|High bit in front, low bit in back, see coil addressing
1962 |4|Coil state|2 bytes|High bit in front, low bit in back. Non-zero is valid
1963 |5|CRC check|2 bytes|High bit in front, low bit in back
1964
1965 Response frame format: slave address + 0x05 + coil address + coil status + CRC check.
1966
1967 (% class="table-bordered" %)
1968 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1969 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1970 |2|0x05 (instruction code)|1 byte|Write single coil
1971 |3|Coil address|2 bytes|High bit in front, low bit in back, see coil addressing
1972 |4|Coil state|2 bytes|High bit in front, low bit in back. Non-zero is valid
1973 |5|CRC check|2 bytes|High bit in front, low bit in back
1974
1975 {{id name="_Toc33979622"/}}{{id name="_Toc267753990"/}}{{id name="_Toc216324735"/}}Error response: see error response frame. The coil status 0xFF00 means ON, and 0x0000 means OFF.
1976
1977 **4) instruction code 0x06 (06): write a single register**
1978
1979 Request frame format: slave address + 0x06 + register address + register value + CRC check.
1980
1981 (% class="table-bordered" %)
1982 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1983 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1984 |2|0x06 (instruction code)|1 byte|Write single coil
1985 |3|Register|2 bytes|High bit in front, low bit in back, see coil addressing
1986 |4|Register value|2 bytes|High bit in front, low bit in back. Non-zero is valid
1987 |5|CRC check|2 bytes|High bit in front, low bit in back
1988
1989 Response frame format: slave address + 0x06 + register address + register value + CRC check.
1990
1991 (% class="table-bordered" %)
1992 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
1993 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
1994 |2|0x06 (instruction code)|1 byte|Write single coil
1995 |3|Register|2 bytes|High bit in front, low bit in back, see coil addressing
1996 |4|Register value|2 bytes|High bit in front, low bit in back. Non-zero is valid
1997 |5|CRC check|2 bytes|High bit in front, low bit in back
1998
1999 Error response: See error response frame.{{id name="_Toc33979623"/}}{{id name="_Toc216324736"/}}{{id name="_Toc267753991"/}}
2000
2001 **5) instruction code 0x 0f (15): write multiple coils**
2002
2003 Request frame format: slave address + 0x 0f + coil start address + coil number + byte number + coil status + CRC check.
2004
2005 (% class="table-bordered" %)
2006 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
2007 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
2008 |2|0x 0f (instruction code)|1 byte|Write multiple single coils
2009 |3|Coil start address|2 bytes|High bit in front, low bit in back, see coil addressing
2010 |4|Number of coils|2 bytes|High bit in front, low bit in back. The maximum of N is 1968
2011 |5|Number of bytes|1 byte|Value: [(N+7)/8]
2012 |6|Coil state|[(N+7)/8] bytes|Every 8 coils are combined into one byte. If the last one is less than 8 bits, fill in 0 in the undefined part. The first 8 coils are in the first byte, and the coil with the smallest address is in the lowest bit. And so on
2013 |7|CRC check|2 bytes|High bit in front, low bit in back
2014
2015 Response frame format: slave address + 0x 0f + coil start address + coil number + CRC check
2016
2017 (% class="table-bordered" %)
2018 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
2019 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
2020 |2|0x 0f (instruction code)|1 byte|Write multiple single coils
2021 |3|Coil start address|2 bytes|High bit in front, low bit in back, see coil addressing
2022 |4|Number of coils|2 bytes|High bit in front, low bit in back
2023 |5|CRC check|2 bytes|High bit in front, low bit in back
2024
2025 Error response: See error response frame.
2026
2027 **{{id name="_Toc33979624"/}}6)** {{id name="_Toc216324737"/}}{{id name="_Toc267753992"/}}**3.2.6 instruction code 0x10 (16): write multiple registers**
2028
2029 Request frame format: slave address + 0x10 + register start address + register number + byte number + register value + CRC check.
2030
2031 (% class="table-bordered" %)
2032 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
2033 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
2034 |2|0x10(instruction code)|1 byte|Write multiple registers
2035 |3|Register start address|2 bytes|High bit in front, low bit in back, see register addressing
2036 |4|Number of registers|2 bytes|High bit in front, low bit in back. The maximum of N is 120
2037 |5|Number of bytes|1 byte|Value: N*2
2038 |6|Register value|N*2 (N*4)|
2039 |7|CRC check|2 bytes|High bit in front, low bit in back
2040
2041 Response frame format: slave address + 0x10 + register start address + register number + CRC check.
2042
2043 (% class="table-bordered" %)
2044 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
2045 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
2046 |2|0x10 (instruction code)|1 byte|Write multiple registers
2047 |3|Register start address|2 bytes|High bit in front, low bit in back, see register addressing
2048 |4|Number of registers|2 bytes|High bit in front, low bit in back. The maximum of N is 120
2049 |5|CRC check|2 bytes|High bit in front, low bit in back
2050
2051 Error response: See error response frame.{{id name="_Toc33979625"/}}{{id name="_Toc216324738"/}}{{id name="_Toc267753993"/}}
2052
2053 **7) Error response frame**
2054
2055 Error response: slave address + (instruction code + 0x80) + Error code + CRC check.
2056
2057 (% class="table-bordered" %)
2058 |**Serial number**|**Data (byte) meaning**|**Number of bytes**|**Instruction**
2059 |1|Slave address|1 byte|Value 1 to 247, set by SD2544, SD2594
2060 |2|Instruction code+0x80|1 byte|Error instruction code
2061 |3|Code|1 byte|1 to 4
2062 |4|CRC check|2 bytes|High bit in front, low bit in back
2063
2064 (% class="table-bordered" %)
2065 |**Serial number**|**Error code**|**Instruction**
2066 |1|01|Unsupported function code
2067 |2|02|Wrong address or function code
2068 |3|03|Wrong length
2069 |4|04|Imperfect instruction
2070 |5|05|Address not allowed
2071
2072 **{{id name="_Toc33979626"/}}8) Slave address table**
2073
2074 (% class="table-bordered" %)
2075 |(% colspan="5" %)**Word address**
2076 |**Address type**|**Occupy**|**Address range**|**Decimal address**|**Total reserved address size**
2077 |T0 to T511|512 WORD|0x0000-0x01ff|0|1536
2078 |C0 to C255|256 WORD|0x0600-0x06ff|1536|1024
2079 |LC0 to LC255|512 WORD|0x0A00-0x0BFF|2560|1024
2080 |HSC0 to HSC15|32 WORD|0x0E00-0x0E1F|3584|512
2081 |D0 to D7999|8000 WORD|0x1000-0x2F3F|4096|16384
2082 |SD0 to SD4095|4096 WORD|0x5000-0x5FFF|20480|12288
2083 |R0 to R29999|30000 WORD|0x8000-0xF52F|32768|30000
2084
2085 (% class="table-bordered" %)
2086 |(% colspan="5" %)**Bit address**
2087 |**Address type**|**Occupy**|**Address range**|**Decimal address**|**Total reserved address size**
2088 |T0 to T511|512 bit|0x0000-0x01ff| |1536
2089 |C0 to C255|256 bit|0x0600-0x06ff|1536|1024
2090 |LC0 to LC255|256 bit|0x0A00-0x0AFF|2560|1024
2091 |HSC0 to HSC15|16 bit|0x0E00-0x0E0F|3584|512
2092 |M0 to M7999|8000 bit|0x1000-0x2F3F|4096|16384
2093 |SM0 to SM4095|4096 bit|0x5000-0x5FFF|20480|12288
2094 |Reserved| |0x8000-0xBFFF| |16383
2095 |S0 to S4095|4096 bit|0xC000-0xCFFF|49152|8192
2096 |X0 to X1777|1024 bit|0xE000-0xE3FF|57344|4096
2097 |Y0 to Y1777|1024 bit|0xF000-0xF3FF|61440|4096
2098
2099 **Error message**
2100
2101 Currently the Error code will be displayed on SD7 and SD0 and SD2611 and SD2612.
2102
2103 The Error codes that appear in the Modbus protocol are mainly as follows.
2104
2105 (% class="table-bordered" %)
2106 |(% style="width:101px" %)**Error code**|(% style="width:980px" %)**Content**
2107 |(% style="width:101px" %)4085H|(% style="width:980px" %)(s)(m)(d)(N) The read address is out of the device range (this error is only displayed on SD7 and SD0)
2108 |(% style="width:101px" %)3180H|(% style="width:980px" %)COM2 data reception error. There may be interference on the communication line, it is recommended to connect the ground wire.
2109 |(% style="width:101px" %)3181H|(% style="width:980px" %)COM2 data reception timed out. "Check the wiring, check whether the serial port parameter settings are compatible with master and slave, check whether there is interference. Check whether the slave station is too late to respond. For this reason, you can try to increase the sending interval SD2546."
2110 |(% style="width:101px" %)3182H|(% style="width:980px" %)COM2 CRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
2111 |(% style="width:101px" %)3183H|(% style="width:980px" %)COM2 LRC check error. There may be interference on the communication line, it is recommended to connect the ground wire.
2112 |(% style="width:101px" %)3184H|(% style="width:980px" %)The COM2 station number is incorrectly configured. Check the slave station number setting. And check whether there is any problem with the receiving and sending mechanism from the station.
2113 |(% style="width:101px" %)3185H|(% style="width:980px" %)COM2 send buffer overflow. Contact a technician if this error occurs
2114 |(% style="width:101px" %)3186H|(% style="width:980px" %)COM2 function code is wrong. Check whether the set function code is a function code supported by PLC
2115 |(% style="width:101px" %)3187H|(% style="width:980px" %)COM2 address is wrong. Check whether the slave station has this address (please refer to Modbus Abnormal 02)
2116 |(% style="width:101px" %)3188H|(% style="width:980px" %)The length of COM2 is wrong. Check whether the communication length exceeds the length range specified by the Modbus protocol, or whether it exceeds the specified length range of the custom protocol.
2117 |(% style="width:101px" %)3189H|(% style="width:980px" %)COM2 data error. "Check whether there are errors in the parameters of the instruction. Check whether the slave station supports the setting of this value. (Please refer to Modbus Abnormal 03)"
2118 |(% style="width:101px" %)318AH|(% style="width:980px" %)COM2 slave is busy. Slave station returns information: Slave station is busy (please refer to Modbus exception 06)
2119 |(% style="width:101px" %)318BH|(% style="width:980px" %)The COM2 slave station does not support function codes. Check whether the slave station supports this function code (please refer to Modbus exception 01)
2120 |(% style="width:101px" %)318CH|(% style="width:980px" %)The COM2 slave is faulty. Slave station returns information: Slave station is faulty, please check whether the slave station is faulty (please refer to Modbus Abnormal 04)
2121 |(% style="width:101px" %)318DH|(% style="width:980px" %)COM2 slave confirms. Slave station return information: slave station confirmation (please refer to Modbus abnormal 05)
2122 |(% style="width:101px" %)318EH|(% style="width:980px" %)COM2 current protocol does not support this instruction. RS instruction cannot be used when it is set to slave station protocol, please change the protocol or close the contact before RS instruction (this error is only displayed on SD7 and SD0)
2123 |(% style="width:101px" %)318FH|(% style="width:980px" %)COM2 sending timed out. Contact a technician if this error occurs
2124 |(% style="width:101px" %)3190H|(% style="width:980px" %)COM2 receiving data exceeds the buffer limit.
2125 |(% style="width:101px" %)31A0H|(% style="width:980px" %)COM2 is not available as a gateway. Returned information from the station: unavailable gateway (please refer to Modbus exception 0A)
2126 |(% style="width:101px" %)31A1H|(% style="width:980px" %)COM2 indicates that no response was obtained from the target device. Slave station returns information: the device is not in the network (please refer to Modbus exception 0B)
2127
2128 After resetting the protocol or communication parameters, the error will be cleared.
2129
2130 In addition, the communication completion/communication error/communication timeout flag will be set after the executed instruction.
2131
2132 == {{id name="_10.7 WECON MODBUS protocol description"/}}**PLCLINK/Fast interconnect** ==
2133
2134 PLCLINK function is used to simplify the fast connection between PLCs. The fast communication of the LX5V series PLC could be achieved only using the configuration parameters without using the communication instruction(RS).
2135
2136 The topological diagram is shown in the figure below.
2137
2138 (% style="text-align:center" %)
2139 [[image:image-20220614170612-1.jpeg]]
2140
2141 When using the PLCLINK function:
2142
2143 * Master station configuration: Select COM2 port and set the protocol to PLCLINK protocol.
2144 * Slave configuration: Select COM1 or COM2 and set the protocol to dedicated protocol.
2145
2146 (% class="wikigeneratedid" id="H28129Createatable" %)
2147 **(1) Create a table**
2148
2149 In [Project manager]-[Extended function]-[PLCLINK], right click [PLCLINK], and click it to create a table.
2150
2151 (% style="text-align:center" %)
2152 [[image:10_html_347d7923523ad9af.png||class="img-thumbnail"]]
2153
2154 Click it and a prompt box as below would pop up.
2155
2156 (% style="text-align:center" %)
2157 [[image:10_html_dbbb9b1ddaa56dce.png||class="img-thumbnail"]]
2158
2159 Click "Yes" will automatically change the protocol to PLCLINK, click "No" will not change the protocol.
2160
2161 The number of PLCLINK protocol is H60.
2162
2163 (% class="table-bordered" %)
2164 |**0H**|Wecon Modbus slave station
2165 |**2H**|ModbusRTU slave station
2166 |**3H**|ModbusASCII slave station
2167 |**10H**|user-defined protocol
2168 |**20H**|ModbusRTU main station
2169 |**30H**|ModbusASCII main station
2170 |**60H**|PLCLINK protocol
2171
2172 Click "Yes" will generate an empty table MAIN.
2173
2174 (% style="text-align:center" %)
2175 [[image:10_html_39ce9cf6a41c3901.png||class="img-thumbnail"]]
2176
2177 Double click MAIN will pop up the POLCLINK table as below.
2178
2179 (% style="text-align:center" %)
2180 [[image:10_html_14072bc2a32c267.png||class="img-thumbnail"]]
2181
2182 Currently only one PLCLINK table can be created. Creating a new table after creating one is disallowed.
2183
2184 (% style="text-align:center" %)
2185 [[image:10_html_f4bec5285beb7949.png||class="img-thumbnail"]]
2186
2187 (2) Write the table
2188
2189 Write station number in
2190
2191 After writing the station number in the new instruction station number in the table, click the new instruction to add the communication instruction.
2192
2193 The range of station number is 1 to 31. The maximum number of communication instruction is 255.
2194
2195 (% style="text-align:center" %)
2196 [[image:10_html_21d3b9789058efb3.png||class="img-thumbnail"]]
2197
2198 (% style="text-align:center" %)
2199 [[image:10_html_20232344eaa6cb2a.png||class="img-thumbnail"]]
2200
2201 Currently the station number is only selected by drop-down box.
2202
2203 (% style="text-align:center" %)
2204 [[image:10_html_f09857f93ae04f0a.png||class="img-thumbnail"]]
2205
2206 The devices of main station and slave station are selected by drop-down box.
2207
2208 (% style="text-align:center" %)
2209 [[image:10_html_99c7d435825defd1.png||class="img-thumbnail"]]
2210
2211 (% style="text-align:center" %)
2212 [[image:10_html_f62cce6501331b8d.png||class="img-thumbnail"]]
2213
2214 The transfer direction are read and write, and also selected by drop-down box.
2215
2216 (% style="text-align:center" %)
2217 [[image:10_html_7b3de12a134b4e95.png||class="img-thumbnail"]]
2218
2219 The device address range limitations are as below.
2220
2221 1. The device address could not exceed the current device range
2222 1. {{id name="OLE_LINK102"/}}In the device of bit written, the mantissa of points of X and Y must be zero, such as X0, X10, X20, Y0, Y10, Y20 and so on. The software PLC Editor 2 will adjust automatically.
2223 1. {{id name="OLE_LINK106"/}}The Points of bit device other than X and Y must be a multiple of 8,such as M0, M8, N16, T(bit) 16, C(bit) 24 and so on. The software PLC Editor 2 will adjust automatically.
2224 1. {{id name="OLE_LINK103"/}}Bit device must communicate with bit device , and word device must communicate with word device. Double word device can only communicate with double word device. This is to avoid length perception differences.
2225
2226 {{id name="OLE_LINK104"/}}The number limitations of slave station device are as below.
2227
2228 1. The number of bit device ranges from 8 to 2,032.
2229 1. {{id name="OLE_LINK105"/}}The number of word device ranges from 1 to 126.
2230 1. The number of double word device ranges from 1 to 63. HSC can only use a maximum of 16 due to the number limitation.
2231 1. The number of bit device must be a multiple of 8, such as 8, 16, 24, 32 and so on. The software PLC Editor 2 will adjust automatically.display the corresponding device address and range.
2232
2233 (3) Download
2234
2235 {{id name="OLE_LINK107"/}}Currently PLCLINK could only be downloaded with the program and could not downloaded separately.
2236
2237 (% style="text-align:center" %)
2238 [[image:10_html_a586bd0ca75cd8f.png||class="img-thumbnail"]]
2239
2240 Click on PLCLINK in monitoring mode to re-write part of the table into PLC, but the start device could not be modified.
2241
2242 (% style="text-align:center" %)
2243 [[image:10_html_92ca328b83e6ef12.png||class="img-thumbnail"]]
2244
2245 In monitoring mode, monitoring read and monitoring write could not be executed if the ladder program comparison is incorrect.
2246
2247 (4) Automatic check
2248
2249 Click “Check” in monitoring mode, the PLC that can communicate will be automatically searched and enabled. Stations that could not communicate will be closed. The Stations without instructions will not be checked. The PLCLINK table will be updated after the automatic check of the upper computer is finished.
2250
2251 (% style="text-align:center" %)
2252 [[image:10_html_d6ff78427b75140d.png||class="img-thumbnail"]]
2253
2254 Write 1 to in the table for addresses whose start address is offset 12 (for example, R200 is R212). The corresponding function is as below.
2255
2256 (% class="table-bordered" %)
2257 |**S1+12**|(((
2258 Auto check mode
2259
2260 (Reserved)
2261 )))|(((
2262 {{id name="OLE_LINK109"/}}0: No check; 1: Automatic check mode; 2: Automatic check in progress.
2263
2264 {{id name="OLE_LINK110"/}}{{id name="OLE_LINK111"/}}When enabled, all the station numbers will send data to determine whether the station number exists. The corresponding communication switch will be turned on if it exists. If not, the corresponding communication switch will be turned off.
2265 )))
2266
2267 No error will be reported during auto check after the auto check is enabled. After the check is complete, the corresponding station number will be automatically enabled and disabled.
2268
2269 (% class="table-bordered" %)
2270 |**S1+13**|Corresponding station number communication switch 1|(((
2271 The switch control of station 1 to 15
2272
2273 {{id name="OLE_LINK112"/}}Bit0: ON: Station number 0 (broadcast) normal communication
2274
2275 OFF: Station number 0 (broadcast) communication prohibited (broadcast prohibited)
2276
2277 Bit1: ON: Station number 1 normal communication; OFF: Station 1 communication prohibited
2278
2279 Bit2: ON: Station number 2 normal communication; OFF: Station 2 communication prohibited
2280 )))
2281 |**S1+14**|Corresponding station number communication switch 2|The switch control of station 16 to 31
2282
2283 Click [station number enable] to set the station enable according to the corresponding situations.
2284
2285 (% style="text-align:center" %)
2286 [[image:10_html_beda0fdc84802959.png||class="img-thumbnail"]]
2287
2288 (% style="text-align:center" %)
2289 [[image:10_html_f84703130b23d8f6.png||class="img-thumbnail"]]
2290
2291 **✎Note: **When in the automatic check state, forcibly turn off the automatic check state (write 0 in S1+12), an error may occur.
2292
2293 {{id name="OLE_LINK113"/}}(5) Main station parameter configuration
2294
2295 (% style="text-align:center" %)
2296 [[image:10_html_434fac0fa8c16597.png||class="img-thumbnail"]]
2297
2298 The protocol must be PLCLINK protocol, and the data bit can not be 7-bit data bit. Other parameters can be selected as required.
2299
2300 (6) Slave station configuration
2301
2302 For PLCLINK communication ports, select the dedicated protocol from the station protocol.
2303
2304 (% style="text-align:center" %)
2305 [[image:10_html_2641eb7c39f4f4aa.png||class="img-thumbnail"]]
2306
2307 The settings of Baud rate, data bit, stop bit, parity bit must be consistent with main station. The parameters above are consistent if not modified. The station number needs to be configured separately. The slave station number ranges from 1 to 31.
2308
2309 {{id name="OLE_LINK115"/}}(7) Close PLCLINK
2310
2311 In S1+11, The pause and start of PLCLINK are controlled by bit 8. If bit 8 is ON, PLCLINK would be closed. No error is reported when switching protocol after this function is disabled.
2312
2313 (% class="table-bordered" %)
2314 |**S1+11**|Operation state|(((
2315 Bit0=1,Port is occupied. This function obtains the right of data transaction transmission.
2316
2317 Bit2=1,One cycle has been executed.
2318
2319 {{id name="OLE_LINK114"/}}Bit4,Communication transmission output indication
2320
2321 Bit5,Communication error output indication (Exceeds the number of retry times)
2322
2323 Bit6,Communication completion output indication
2324
2325 Bit8,PLCLINK suspension (0: Normal operation, 1: Operation paused)
2326 )))
2327
2328 (8) Table contents
2329
2330 {{id name="OLE_LINK119"/}}Currently the communication table is downloaded to the device to operate. The details of the table are as follows.
2331
2332 (% class="table-bordered" %)
2333 |(% rowspan="2" %)**Address offset**|(% colspan="2" %){{id name="OLE_LINK116"/}}**Brief description**|(% rowspan="2" %)**Detailed description**
2334 |**High byte**|**Low byte**
2335 |S1+0|(% colspan="2" %)Header|{{id name="OLE_LINK117"/}}Header =70h, correct PLCLINK table. (modification prohibited)
2336 |S1+1|(% colspan="2" %)Number of communication instructions|1 to 255 (modification prohibited)
2337 |S1+2|(% colspan="2" %)Version|{{id name="OLE_LINK121"/}}{{id name="OLE_LINK118"/}}V1.100 (modification prohibited)
2338 |S1+3|(% colspan="2" %){{id name="OLE_LINK120"/}}The start address of communication table|modification prohibited
2339 |S1+4|(% colspan="2" %)Check bit of the number of header and communication|Simple check calculation for table header, number of communication instructions, version, and the start address of communication table ((modification prohibited))
2340 |S1+5|(% colspan="2" %)Which instruction currently is running|Display the current running command (read only)
2341 |S1+6|Station NO.1|Read/write direction|(% rowspan="5" %)The instruction content of current communication
2342 |S1+7|(% colspan="2" %)The data start address of station NO.1
2343 |S1+8|Station NO.2|Address type distinction
2344 |S1+9|(% colspan="2" %)The data start address of station NO.2
2345 |S1+10|(% colspan="2" %)Data length
2346 |S1+11|(% colspan="2" %)Operation state|(((
2347 Bit0=1,Port is occupied. This function obtains the right of data transaction transmission.
2348
2349 Bit2=1, One cycle has been executed.
2350
2351 Bit4, Communication transmission output indication
2352
2353 Bit5, Communication error output indication (Exceeds the number of retry times)
2354
2355 Bit6, Communication completion output indication
2356
2357 Bit8, PLCLINK suspension (0: Normal operation, 1: Operation paused)
2358 )))
2359 |S1+12|(% colspan="2" %)Auto check mode (Reserved)|(((
2360 0: No check; 1: Automatic check mode; 2: Automatic check in progress.
2361
2362 When enabled, all the station numbers will send data to determine whether the station number exists. The corresponding communication switch will be turned on if it exists. If not, the corresponding communication switch will be turned off.
2363 )))
2364 |S1+13|(% colspan="2" %)Corresponding station number communication switch 1|(((
2365 The switch control of station 1 to 15
2366
2367 Bit0: ON: Station NO. 0 (broadcast) normal communication
2368
2369 OFF: Station NO.0 (broadcast) communication prohibited (broadcast prohibited)
2370
2371 Bit1: ON: Station NO.1 normal communication;
2372
2373 OFF: Station NO.1 communication prohibited
2374
2375 Bit2: ON: Station NO.2 normal communication;
2376
2377 OFF: Station NO.2 communication prohibited
2378 )))
2379 |S1+14|(% colspan="2" %)Corresponding station number communication switch 2|The switch control of station 16 to 31
2380 |S1+15|(% colspan="2" %)Reserved|
2381 |S1+16|(% colspan="2" %)Reserved|
2382 |S1+17|(% colspan="2" %)Reserved|
2383 |S1+18|(% colspan="2" %)Reserved|
2384 |S1+19|(% colspan="2" %)Reserved|
2385 |S1+20|(% colspan="2" %)Reserved|
2386 |S1+21|Station NO.1|Read/write direction|(((
2387 • Station NO. 1 to 32, FF(FF represents main station)
2388
2389 • Function code:
2390
2391 ~=01H, read
2392
2393 ~=02H, write
2394 )))
2395 |S1+22|(% colspan="2" %)The data start address of station NO.1|• Valid word. Define operating the start address of slave station data
2396 |S1+23|Station NO.2|Address type distinction|(((
2397 •Station NO.0 to 32 (If it is 0, broadcast to all the slave stations on behalf of master station, and slave stations do not respond
2398
2399 •Distinguish the type of the starting device for storing data in the main station.
2400
2401 Main station address type distinction. 0: word address; 1: bit address
2402 )))
2403 |S1+24|(% colspan="2" %)The data start address of station NO.2|• Valid word. Define operating the start device of slave station data. Define the corresponding address by MUDBUS address of 5V.
2404 |S1+25|(% colspan="2" %)Data length|• Valid word. Range 1 to 126(bit data), 1 to 2,032(bit data)
2405 |S1+26|Station NO.1|Read/write direction|(% rowspan="5" %)(((
2406 The second data transmission description.
2407
2408 Main station address type distinction.
2409 )))
2410 |S1+27|(% colspan="2" %)The data start address of station NO.1
2411 |S1+28|Station NO.2|Address type distinction
2412 |S1+29|(% colspan="2" %)The data start address of station NO.2
2413 |S1+30|(% colspan="2" %)Data length
2414 |•|(% colspan="2" %) | 
2415 |•|(% colspan="2" %) | 
2416 |S1+20+ n×5|(% colspan="2" %)Reserved|• n is the total number of data transmission commands.
2417
2418 **{{id name="_Toc27709"/}}✎Note: **
2419
2420 1. It is forbidden to modify S0 to S4.
2421 1. It is not recommended to change the value except the function enable or station number enable. Otherwise, the operation or upload may be abnormal.
2422
2423 **{{id name="_Toc18822"/}}Error code**
2424
2425 (% class="table-bordered" %)
2426 |(% style="width:105px" %)**Error code**|(% style="width:976px" %)**Contents**
2427 |(% style="width:105px" %)31C0H|(% style="width:976px" %){{id name="OLE_LINK129"/}}Abnormal PLCLINK header. Re-download the program.
2428 |(% style="width:105px" %)31C1H|(% style="width:976px" %)PLCLINK function is not supported by COM port currently.
2429 |(% style="width:105px" %)31C2H|(% style="width:976px" %)PLCLINK table version is incompatible. Re-download the program.
2430 |(% style="width:105px" %)31C3H|(% style="width:976px" %)The number of PLCLINK command exceeds the range. The value ranges from 1 to 255 Currently.
2431 |(% style="width:105px" %)31C4H|(% style="width:976px" %){{id name="OLE_LINK133"/}}{{id name="OLE_LINK132"/}}The station number of PLCLINK table exceeds the range. Check the station number in the table.
2432 |(% style="width:105px" %)31C5H|(% style="width:976px" %)PLCLINK table exceeds the range of device. Check the corresponding device range of table.
2433 |(% style="width:105px" %)31C6H|(% style="width:976px" %)The device used by PLCLINK table command exceeds the range. Check the device used for each command in the table.
2434 |(% style="width:105px" %)3180H|(% style="width:976px" %)COM2 data reception error. There may be interference on the communication line. It is recommended to connect the ground wire.
2435 |(% style="width:105px" %)3181H|(% style="width:976px" %)COM2 data reception time. Check wiring, whether the parameters of the serial port setting is master-slave correspondence, whether there is interference, whether it is caused by the delay of the slave station. For this reason, try to increase the sending interval SD2546.
2436 |(% style="width:105px" %)3182H|(% style="width:976px" %)COM2 CRC check error. There may be interference on the communication line. It is recommended to connect the ground wire.
2437 |(% style="width:105px" %)3184H|(% style="width:976px" %)COM2 station number error. Check the setting of slave station number. Check whether there is a problem with the slave receiving and sending mechanism.
2438 |(% style="width:105px" %)3186H|(% style="width:976px" %){{id name="OLE_LINK135"/}}COM2 function code error. Check whether the function code is supported by PLC.
2439 |(% style="width:105px" %)3187H|(% style="width:976px" %)COM2 address error.
2440 |(% style="width:105px" %)3188H|(% style="width:976px" %){{id name="OLE_LINK136"/}}COM2 length error. Check whether the communication length exceeds the length range specified by Modbus or user-defined protocol.
2441 |(% style="width:105px" %)3189H|(% style="width:976px" %){{id name="OLE_LINK137"/}}{{id name="OLE_LINK138"/}}COM2 data error. Check whether the parameter of instruction is wrong. Check whether the setting of the value is supported by slave station. (Please refer to Modbus abnormal 03)
2442 |(% style="width:105px" %)318AH|(% style="width:976px" %){{id name="OLE_LINK139"/}}{{id name="OLE_LINK140"/}}COM2 slave station is busy. Slave station returns message: Slave station is busy. (Please refer to Modbus abnormal 06)
2443 |(% style="width:105px" %)318BH|(% style="width:976px" %){{id name="OLE_LINK141"/}}COM2 slave station does not support function codes. Check whether the function code is supported by slave station. (Please refer to Modbus abnormal 01)
2444 |(% style="width:105px" %)318CH|(% style="width:976px" %)COM2 slave station fault. Slave station returns message: Slave station is fault. Check whether the slave station is faulty. (Please refer to Modbus abnormal 04)
2445 |(% style="width:105px" %)318DH|(% style="width:976px" %)COM2 slave station confirmation. Slave station returns message: Slave station confirmation.(Please refer to Modbus abnormal 05)
2446 |(% style="width:105px" %)318EH|(% style="width:976px" %)COM2 does not support this instruction or function. When slave station protocol is set, the corresponding communication instruction or function of main station could not be used. Please change the protocol or close the contacts before the corresponding instruction, or the corresponding communication function.
2447 |(% style="width:105px" %)3190H|(% style="width:976px" %)The data received by COM2 exceeds the cache limit.
2448
2449 **{{id name="_Toc25970"/}}Example**
2450
2451 Create a PLCLINK table and automatically switch the Com2 protocol to PLCLINK.
2452
2453 (% style="text-align:center" %)
2454 [[image:10_html_c4962fb2076781b9.png||class="img-thumbnail"]]
2455
2456 {{id name="OLE_LINK143"/}}Open PLCLINK table, write the master station D10 to the slave station D10 device number 10, and read the slave station D10 to the master station D20 device number 10.
2457
2458 (% style="text-align:center" %)
2459 [[image:10_html_3244c013d7d800c3.png||class="img-thumbnail"]]
2460
2461 {{id name="OLE_LINK144"/}}Connect Com2 of master station PLC to COM1 of slave station, and set the slave station number to 1. After downloading, set the value of main station D10 to 1 and D11 to 8192 . Then, D20 will change to 1 and and D21 will change to 8192.
2462
2463 (% style="text-align:center" %)
2464 [[image:10_html_ae5ef70ce179ad5e.png||class="img-thumbnail"]]
2465
2466 **{{id name="_Toc27083"/}}The situation of connecting more than one**
2467
2468 When adding commands, the station number that corresponding more slave station number can add more station number communication connections
2469
2470 (% style="text-align:center" %)
2471 [[image:10_html_98f836562979721.png||class="img-thumbnail"]]
2472
2473 == {{id name="_Toc7760"/}}**Wecon Modbus protocol description** ==
2474
2475 The current Wecon Modbus protocol description (special protocol) is modified based on the ModbusRTU protocol.
2476
2477 Therefore, 7-bit data bits cannot be used in the serial port parameter part.
2478
2479 The protocol of COM0 and COM1 can only use WECON Modbus protocol at present and cannot be changed.
2480
2481 This protocol is fully compatible with Modbus RTU protocol, and the address is also the same as the default address of LX5V PLC's Modbus RTU protocol.
2482
2483 The extended function is mainly used to communicate with PLCEDITOR.