Closed realrushen closed 8 months ago
Pull requests are welcome, especially since you know what the problem is.
But as far as I can see handle_write_allowed sets access=True if write is to be allowed, so I am not sure what value you want to be different.
As you can see in your register dump.
Holding register 1-7 is write-able Input register 0 is write-able the rest is readonly.
I think you too, have not read the documentation, that explains the difference between the memory model with starts with 0 and the addressing model which start with 1.
Closing this, since your register dump, shows it works exactly as defined. Feel free to show a write that produces a wrong result.
btw your comment "because server is only starting with [1, 27]" is wrong, you should be defining 0-27.
btw your comment "because server is only starting with [1, 27]" is wrong, you should be defining 0-27.
Yeas this is my main misunderstanding, that cause all problems. Thanks for explanation.
I think you too, have not read the documentation, that explains the difference between the memory model with starts with 0 and the addressing model which start with 1.
I really read the documentation and did my best to understand it. But example config (from don't define register 0 that really confuse me. 0 is only in "repeat" block that inconsistent with register defining blocks.
btw what is real life use case of write block? I think its redundant because modbus specification defines write allowing holding registers and coils and they must be writable by default. Maybe we should remove it?
Well what is the first index in an array, that is 0, so naturally the memory block start with 0, while the modbus addressing start with 1.
The modbus speficication states that only holding registers and coils are writeable, but not that the MUST be writeable, hence the section.
We are thinking about reworking the configuration, into a more linear mode, because it is less complicated and more inline with how devices document the registers, but unless someone volunteers to work on it, it will take a while.
Versions
Pymodbus Specific
Description
I'm running same configuration for ModbusSimulatorContext as in #1960 issue that can be checked below.
I can read up to 8 holding registers, but i can't write them.
This is what i found when debugging that issue: loop_validate on line 530
This problem exist because Setup.handle_write_allowed() setting self.runtime.access attribute to wrong items.
Configuration