Skip to content

Continuation of a problem, PYModbus can't replicate Modpoll register read #1538

Answered by MattBrittan
Hos73 asked this question in Q&A
Discussion options

You must be logged in to vote

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 say unit=1 not slave=1... (I did not pick this up because you said the write_register works - I doubt it actually does).

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@Hos73
Comment options

@MattBrittan
Comment options

Answer selected by Hos73
@Hos73
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@janiversen
Comment options

@janiversen
Comment options

@Hos73
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants