Xinje plc uses modbus RTU to communicate with the inverter

Xinje plc uses modbus rtu to communicate with Xinje inverter
0.1: Requirements: both plc and inverter support
modbus RTU 1: the difference between
modbus and rs485 modbus is a serial communication protocol, and rs485 is a hardware interface, most of the modbus It is carried out through the serial port 485, which is divided into full-duplex and half-duplex. The difference is that full-duplex is a twisted-pair cable, respectively A and B, and half-duplex is four-wire, respectively A+ A- and B+ B-
2: Modbus communication protocol is divided into several
types. There are three types of modbus communication protocols. They are modbus TCP, modbus RTU, and modbus ASCII.
Modbus protocol requires data verification. In addition to parity, the ASCII mode uses LRC calibration. RTU mode uses 16-bit CRC check, but TCP mode does not additionally stipulate that RTU and ASCII are used more frequently. They are slightly different in numerical data representation and protocol details. Among them, the most used is RTU. Also use modbus RTU3: modbus RTU
3.1 modbus RTU function is to read or write to single or multiple registers, in front of the register can add control 3.2 data frame 10 bits, 1 start bit, 8 data bits, 1 stop bit , No check, baud rate: 9600; 19200
3.3 format
1 2 3 4 5 6 7 8
01H 06H 20H 00H 00H 01H CRC1 CRC2
first byte ADR: slave address code (=001~254)
second byte 03H: read register value function code
3rd and 4th bytes: the start address of the register to be read should be read from the FCC connected instrument,
5th and 6th bytes: the number of registers to be read
The 7th and 8th bytes: CRC check can be calculated by the CRC check calculator, and the one sent from the machine to the correct one will reply the same………………………………………………………… …………………………… The above are some concepts related to modbusRTU. The
following is the communication plc of Xinje plc and Xinje inverter communication plc in this article is Xinje ’s XC2 frequency inverter is Xinje V5. It uses 485 full duplex to
set the communication parameters between PLC and inverter. The data length is 8 bits, even parity, 1 stop bit, and the baud rate is 19200bps.
Frequency setting channel of the inverter P0.01: 4; (Serial port setting)
Operation command channel selection P0.03: 2; (Serial port running command channel)
Communication configuration P3.09:064; (6:1 -8-1 format, no parity. 4:19200BPS)
Local address P3.10:001; Local address 1
program is as follows:
LDP X0 ADD D0 K1000 D0 frequency plus 10
LDP X1 SUB D0 K1000 D0 frequency minus 10
LDP X2 MOV K2 D100 Forward
LDP X3 MOV K7 D100 Stop
LDP X4 MOV K3 D100 Reverse
LD M8002 SET M0 Set M0
LD M0 OUT T0 K5 Timing for 5 milliseconds
LDP T0 REGW K1 H2001 D0 K2 Write data from PLC to inverter
RST M0 Reset M0
SET M1 Set M1
LD M1 OUT T1 K5 Time for 5 milliseconds
LDP T1 REGW K1 H2000 D100 K2 Write data from PLC to inverter
RST M1 Reset M0
SET M2 Set M2
LD M2 OUT T2 K5 Timing for 5 milliseconds
LDP T2 REGR K1 H2103 K6 D200 K2 Read data from inverter to PLC
RST M2 Reset M2
sET M0 M0 cycle is set to send
Note: CRC checksum in the plc plc can be counted out on his own what to ask because modbusRTU 5 ms timing is sent with a single instruction to send, then not a single instruction can only receive a
regw and regr About The command REGW is a register read command, REGW S1 S2 S3 D1 D2 Simply put:
S1 slave address
S2 parameter address (refer to the communication protocol parameter definition in the inverter manual)
S3 register number
D1 register address
D2 serial port number (generally It is K1~K3)
REGR is also the same, the difference is the other way around, read from the inverter and store it in the register

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_49259012/article/details/108554492