emModbus supports all three Modbus standard protocols covered by the official Modbus documentation:
|RTU||Original Modbus standard. Binary data is sent via serial connections such as RS-232 or similar.|
|ASCII||Similar to RTU. Instead of raw binary, data is encoded in ASCII.|
|Modbus/TCP||Binary data is encapsulated in a TCP frame and sent via network connections such as Ethernet. This variant can also be used with UDP instead of TCP and is then called Modbus/UDP.|
Message frame fields
Although the different message frames are each handled differently by the protocol, both RTU and ASCII frames consist of the same four specified fields. Field 2 and 3 constitute the Protocol Data Unit (PDU), which is included in the Modbus/TCP frame as well.
RTU message frame
When using RTU frames, each byte contained in a message is sent as binary data. The main advantage of this mode is its greater density, allowing better data throughput for the same baud rate compared to ASCII frames.
ASCII message frame
When using ASCII frames, each byte contained in a message is encoded and sent as two ASCII characters. This allows time intervals of up to one second to occur between characters without causing an error.
Modbus/TCP message frame
When using Modbus/TCP frames, an additional header called 'Modbus Application Header' precedes the Protocol Data Unit.
emModbus currently supports the following instructions:
|2||Read Discrete Input.|
|3||Read Holding Register.|
|4||Read Input Register.|
Modbus uses four primary data types:
|Coil||Single bit, alterable by an application program, read-write.|
|Discrete Input||Single bit, provided by an I/O system, read-only.|
|Holding Register||16-bit, alterable by an application program, read-write.|
|Input Register||16-bit, provided by an I/O system, read-only.|