1. Overview of MODBUS communication
MODBUS protocol is divided into MODBUS protocol on serial link and MODBUS protocol based on TCP/IP protocol. The MODBUS protocol on the serial link has MODBUS ASCAII (string) and MODBUS RTU.
The MODBUS protocol library provided by 200SMART can support MODBUS RTU communication
MODBUS RTU is sent in hexadecimal value
MODBUS ASCAII is sent in the form of ASCAII code. It only needs one byte to send a piece of data in RTU mode, while sending with ASACII code requires two bytes. The sending time
There are many communication methods for PLC and inverter serial communication, but the commonly used and preferred is MODBUS communication method, which is widely used in actual industrial control; in this issue, we will share with you how the inverter and PLC pass MODBUS RTU Take control
2. Detailed explanation of MODBUS library instructions
There are two library instructions, one is the master library and the other is the slave library
The master station is the PLC as the MODBUS master station to actively read the data of other devices; the slave station is the PLC as the MODBUS slave station, and other devices read the data; what we share in this issue is the PLC as the master station and the inverter as the slave station
STEP7-MinWIN SMART software comes with MODBUS communication library instructions
3. Communication format (protocol) of MODBUS RTU
The communication protocol includes: station number, function code, data address, data content, check digit, and terminator
Check: N=None no check E=Even even check O=Odd odd check
Judge whether the number of 1s in the data bit is odd or even (choose even check, for example, if the number of 1s in 16#03 is even, the check bit is 1; if the number of 1s is odd, check The check bit is 0. When the odd check is selected, when the number of 1 is even, the check bit is 0; when the number of 1 is odd, the check bit is 1)
The function code specifies the read operation or write operation to the slave device, and also specifies the type of MODBUS register address. Common function codes are:
Fourth, the connection of PLC and inverter communication hardware
The terminals involved in communication on the inverter are marked with the network port of A/B RS585+/RS485- or RJ11; find the manual of the relevant inverter and check the wiring definition of the communication port. The following is the communication port wiring of the Delta VFD-M series inverter definition
V. Setting of inverter communication parameters
1. To realize the normal communication between the inverter or the instrument and the PLC, the interfaces and protocols of each other need to be consistent, in addition to the parameter settings must also be consistent
P00 set 03 (frequency command)
P01 set 03 (operation command)
P88 set 03 (communication address, between 0-254)
P89 is set to 02 (baud rate selection)
P92 is set to 04 (data format, 200SMART does not support 2 stop bits, so any parameter of 04/05 can only be selected)
P157 is set to 01 (the inverter defaults to MODBUS mode)
2. Check the address of the feedback parameters such as start and stop, frequency setting, operating frequency, voltage and current in the manual
Means to read the data of the two addresses of 2103 2104 in the addresses of 17 70 and 00 00
Parameter address definition of communication protocol:
Operation command address 2000H Frequency command address 2001H
Output frequency address 2103H Output current address 22104H
Output voltage address 2106H Inverter temperature address 210DH
6. Writing of MODBUS communication program
|