The following pages explain how to communicate across the Ethernet network using the MODBUS/TCP protocol. This is an "open" de facto standard protocol that is widely employed in the industrial manufacturing environment to communicate with intelligent devices such as sensors and instruments. It has been implemented by hundreds of vendors on thousands of different products to communicate digital and analog I/O and register data between devices. In addition to factory applications, MODBUS/TCP is being utilized in building, infrastructure, transportation and energy applications.
MODBUS/TCP is layered on top of the Ethernet TCP protocol. The GPL Modbus Class is provided as a convenience to allow a GPL procedure to easily communicate with MODBUS/TCP devices without the need to implement this protocol. This section provides a summary of the Modbus Class and examples of how to use it. For additional details on specific methods, see the "GPL Dictionary" in the PreciseFlex Library.
For more information on the TCP protocol, see Network Communications. For information about the MODBUS/TCP protocol and standards, see the MODBUS-IDA website at http://www.modbus.org.
GPL operates as a Master and communicates to devices that are configured as MODBUS/TCP slaves. In this mode, GPL supports the following MODBUS/TCP functions in Table 19-47:
Function Code | Function Name | Description |
---|---|---|
1 |
Read coils |
Read one or more digital outputs. |
2 |
Read discrete inputs |
Read one or more digital inputs. |
3 |
Read holding registers |
Read one or more holding registers. |
4 |
Read input registers |
Read one or more input registers. |
5 |
Write single coil |
Write a single digital output. |
6 |
Write single register |
Write a single holding register. |
15 |
Write multiple coils |
Write multiple digital outputs. |
16 |
Write multiple registers |
Write multiple holding registers. |
43, MEI type 13 |
Read Device Identification |
Read string values identifying the device. |
In addition, a Guidance controller can be configured to operate as a MODBUS/TCP slave and accept commands from an 3rd party MODBUS/TCP master. Please see the Communications section of the Introduction to the Software chapter of the PreciseFlex Library for more information on this mode of operation.