What is Modbus?
Modbus is a client/server (formerly master/slave) based communication protocol that has become the de facto standard in the industry. One reason for this is that it is an open protocol.
Using Modbus, a client (e.g. a rapidM2M C3xx) and several servers can be connected. Due to the broad support of the Modbus standard, a wide range of devices can be considered for the server role. The range of applications extends from the connection of simple sensors to communication with drive and motor controllers to data exchange with complex measurement and control systems.
Basically, there are two versions: One for the serial interface (RS232 and RS485) and one for Ethernet.
Three different operating modes are distinguished for data transmission:
- Modbus RTU: transmits data in binary form, therefore good data throughput but not human readable
- Modbus ASCII: transmits data ASCII-coded, therefore directly readable by humans, but lower throughput
- Modbus TCP: similar to RTU, transmission in TCP/IP packets
What can the Microtronics Library do?
During the development of the Modbus Master library, emphasis was placed on universal use and the simplest possible integration into own projects.
The library functions and handling are identical on all supported hardware platforms. The implementation of the hardware-specific features happens automatically in the background, invisible to the user, and thus ensures particular comfort.
The library currently supports the master (=client) mode for serial interfaces (RS232 and RS485). The data transmission can optionally be in the more efficient Modbus-RTU or alternatively in Modbus-ASCII format.
The following function codes for read or write access are currently supported:
|Function code||Object type|
|01 Read Coil Status||Read individual “Coil” input|
|02 Read Input Status||Read individual input “Discrete Input|
|03 Read Holding Registers||(analogue) Read “Holding Register” inputs|
|04 Read Input Registers||(analogue) Read “Input Register” inputs|
|05 Write Single Coil||Write single output “Coil|
|06 Write Single Register||Write single (analogue) output “Holding Register|
|15 Write Multiple Coils||Write multiple outputs “Coils|
|16 Write Multiple Coils||Write multiple (analogue) outputs “Holding Registers|
The library can be easily integrated and used in your own projects. However, the complete source code is also available in the rapidM2M Studio.
The Modbus Master library is currently supported by the following hardware platforms with the corresponding interface ports:
- myDatalogEasy IoT /myDatalogEasy IoTmini
- 1x RS485
- 1x RS232
- rapidM2M C3xx
- rapidM2M M22x /rapidM2M M23x
- 2xRS232 (UART0/1) 1)
- 2xRS485 (SPI) 1)
- rapidM2M PoC RS485
- rapidM2M PoC RS232
1)Additional external wiring necessary