233
0FH
Write multi-coil
MCLW
(1) Take 06H function code as example (single register write), and introduce data
format.
E.g.: upper computer write data to PLC H0002 (D2).
RTU mode:
Asking format
Response format
ID
01H
ID
01H
Function code
06H
Function code
06H
Register ID
00H
Register ID
00H
02H
02H
Data content
13H
Data contents
13H
88H
88H
CRC CHECK High 25H
CRC CHECK High
25H
CRC CHECK Low 5CH
CRC CHECK Low
5CH
Explanation
:
1. Address is PLC station no.
2. Function code is Modbus-RTU protocol read/write code.
3. Register address is the PLC modbus address, please see chapter 6-2-3.
4. Data content is the value in D2.
5. CRC CHECK High / CRC CHECK Low is high and low bit of CRC check value.
If 2 pieces of Xinje XD3 series PLC communicate with the other one, write K5000 to D2.
M0
REGW K1 H0002 K5000 K2
M0 is trigger condition (Rising edge). If communication fails, the instruction will try twice. If
the third time communication fails, then communication ends.
The relationship between REGW and Modbus RTU protocol (other instructions are the same)
REGW
Function code 06H
K1
Station no.
H0002
Modbus address
K5000
Data contents 1388H
K2
PLC serial port
The complete communication datum are: 01H 06H 00H 02H 13H 88H (system take CRC
checking automatically)
If monitor the serial port2 data by serial port debugging tool, the datum are: 01 06 00 02 13
88 25 5C
Note:
The instruction doesn’t distinguish decimal, hex, binary, octal etc. For example,
B10000, K16 and H10 are the same value, so the following instructions are the same.
REGW K1 B111110100 D1 K2
REGW K1 K500 D1 K2
REGW K1 H1F4 D1 K2
(2)
Function code 01H/02H: read coil/read input coil
Eg. Read coil address 6000H (Y0). At this time, Y0 and Y1 are ON.
Содержание XD Series
Страница 1: ...XD XL series PLC User manual Instruction WUXI XINJE ELECTRIC CO LTD Data No PD05 20201022 3 5 ...
Страница 210: ...209 ...
Страница 314: ...313 B Double click the middle part to modify ...