modbus_tcp_server
Overview
This example demonstrates how to use Modbus TCP protocol to communication.
FreeModbus supports bellow feature:
Read coil(0x01)
Read discrete inputs(0x02)
Read holding registers(0x03)
Read input registers(0x04)
Write single coil(0x05)
Write single holding register(0x06)
Write board LED status(0x0d)
Read board LED status(0x0e)
Write multiple coils(0x0f)
Write multiple holding registers(0x10)
Running the demo
If the test passes, serial port output:
Initializing PHY… [LINK STATE] netif=0, state=down [LINK STATE] netif=0, state=up, speed=100M_full
Modbus TCP Server example
FOR TASK ETH Get IP address from DHCP…
IPv4 Address : 10.91.20.33 IPv4 Subnet mask : 255.255.255.0 IPv4 Gateway : 10.91.20.254
Use the modbus client simulator to read holding registers(0x3) to test modbus function