I have run into a peculiar problem while programming a ModbusTCP Server sketch. It’s just a test program for now that acts as a server/slave and as such takes any modbus requests that come in over the ethernet connection and prints changes in register/coil values to the serial monitor.
It works really well when I test it with a modbus master simulator that’s installed on a second computer. The odd thing: It isn’t supposed to?
When I configure all of my modbus inputs and outputs in void setup my serial prints tell me that the configuration failed every time. The documentation isn’t very informative on what to do when things fail either.
I have tried to mess with the parameters of the configration (entered the address in dec and hex, minimised and maximised the amount of Coils/Registers to configure and even entered a negative value) without success.
When I look at the example code for ModbusTCPServer (the one which works with the Wifi shield) the command looks exactly the same as what I entered. I actually based my code on this example and just exchanged the wifi parts with ethernet parts.
The sketch works so it isn’t an immediate issue but I’d like to have it resolved because these things have the bad habit of breaking when you’ve forgotten about them and that’s where the fun begins (not).
Thank your for your help!
ModbusTest.ino (3.71 KB)