260
Take 06H function code(write single register)as example, and introduce data format(other
functions are similar to this)
:
E.g.
:
upper computer write data K5000(H1388) to PLC H0002 (D2).
ASCII mode
:
Description
:
1. address is PLC station number.
2. Function code is Modbus-ASCII protocol read/write code.
3. Register ID is the PLC modbus communication ID, please see chapter 7-2-2.
4. Data content is the value in D2.
5. LRC CHECK Low / CRC CHECK High is low and high bit of CRC check value.
If two pieces of Xinje XD3 PLC communicate with each other, write K5000 to D2.
M0 is trigger condition (rising edge). When Xinje PLC communicates by Modbus, if
communication fails, the instruction will try twice. If the third time communication fails, then
communication ends.
The relationship between REGW and ASCII protocol (other instructions are similar to this):
Complete data string: 3AH 30H
31H 30H 36H 30H 30H 30H
32H 31H 33H 38H 38H 35H 43H
(system take CRC checking automatically)
If monitor the serial port2 by serial port debugging tool, the datum are: 3AH 30H 31H 30H
36H 30H 30H 30H 32H 31H 33H 38H 38H 35H 43H 0DH 0AH
Note: The data does not distinguish decimal, binary, hexadecimal etc. For example, B10000,
K16 and H10 are the same value, so the following instructions are the same.
PLC communication serial port
tudonghoatoancau.com