In my blog post, Why, In 2017, Are We Still Using Modbus? I outlined the common ways PLCs communicate with 3rd party devices using Modbus.
In another blog called “3 Easy Steps to Share Data Between Modicon Quantum PLCs Using Schneider Electric Unity Pro XL”. we describe how to communicate using Modbus TCP and IO Scanner.
In this blog I will show how to communicate using Modbus RTU from a serial port, or an Ethernet port (through an Ethernet Gateway), using communication block(s) inside the PLC code.
Configure the PLC serial hardware port to match the 3rd party device. In this example I am using the RS-232 port on the PLC and going through an RS-232 to half-duplex RS-485 converter to an ABB VFD and a Trane Chiller. This example assumes that both require the same number of data and stop bits, parity, and baud rate. It is possible to skip the converter and go straight RS-485 from the PLC port, but using a converter can eliminate some headaches at startup. I find that RS-232 is simpler for the PLC to handle and the converter can handle the switching of the transmit and receive signals on the half-duplex RS-485 network. As in all serial communication, the number of data and stop bits, the parity, and the baud rate match what the 3rd party device manufacturer requires.
See steps 1 and 2 of Jon McClain’s blog.
The code will be the same as above, except the “ADDM()” command will be different. If you are reading or writing the same register to Chiller 2 as in the above code, but using the PLC Ethernet port to Modbus RTU RS-485 on the other side of an Ethernet Gateway, your read and write commands would be this:
READ_VAR(ADDM('PLC{192.168.10.92}2'),'%MW',5,1,READ_GEST,READ_DATA);
- Or -
WRITE_VAR(ADDM('PLC{192.168.10.92}2'),'%MW',5,1, WRITE_DATA,WRITE_GEST);
About the Author
Julie has left Hallam-ICS to pursue other endeavors, but her contributions to the company continue to be valued.
About Hallam-ICS
Hallam-ICS is an engineering and automation company that designs MEP systems for facilities and plants, engineers control and automation solutions, and ensures safety and regulatory compliance through arc flash studies, commissioning, and validation. Our offices are located in Massachusetts, Connecticut, New York, Vermont and North Carolina and our projects take us world-wide.