Continuation of a problem, PYModbus can't replicate Modpoll register read #1538
-
I am continuing a discussion of a problem from stackoverflow, I have a modbus register I can write to with pymodbus and modpoll, however I cannot read from that register with pymodbus, but I can read from it with modpoll. Discussions that were had on the stackoverflow can be found here Code is as follows
Output:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
As suggested on stack overflow; remove the |
Beta Was this translation helpful? Give feedback.
-
Looking at the log, your device does not respond, you are probably using a wrong framer. |
Beta Was this translation helpful? Give feedback.
-
rtu framer is the default but many times you need to use the ascii framer. Apart from that if your device never answers it can be a number of serial parameters that are wrong. |
Beta Was this translation helpful? Give feedback.
OK - Please edit the question to add that. I'd also suggest stating that
modpoll -m rtu -0 -1 -a 1 -b 9600 -p none -r 48 /dev/ttyUSB0
works.Now looking at your
modpoll
command you include-a 1
(Slave address) but looking at the debugging info the request is being sent to slave 0 ("0x0 0x3 0x0 0x30 0x0 0x1 0x85 0xd4") so that would explain the lack of response.From the docs the function definition is
read_holding_registers(address: int, count: int = 1, slave: int = 0, **kwargs: Any) → ModbusResponse
; in your code you sayunit=1
notslave=1
... (I did not pick this up because you said thewrite_register
works - I doubt it actually does).