I'm currently facing the problem of utilizing my self-written Modbus RTU Server Stack. The stack itself works fine, but integrating it with my application has led me to a fundamental question.
Should a value set by the client be allowed to be overwritten by the server application, and should that overwritten value be read back by the client?
Let's take the following example: The Modbus server manages a holding register table with a value called "target speed" in km/h. The target speed is written by the client to a value of 10 km/h. The application of the Modbus Server is limited to a target speed of 8 km/h and therefore alters the value referenced in the holding register table to 8 km/h. Should the server be allowed to alter the speed? A possible alternative would be to publish the actual speed in an entry in an input register. Or is it perfectly fine to alter a value in a R/W register?
From the specification provided by modbus.org, I couldn't really find the expected behavior. There are function calls, e.g., 0x16, that hint at working with values defined by the application, but I don't think that the existence of that function code fully clarifies the intention.
By any chance, is there someone here with Modbus experience who knows the desired behavior?
There are no rules. Do whatever you want and document it.