Closed ueberBrot closed 4 years ago
Dear ueberBrot,
I've left this project some time ago, as you may have appreciated. I've never used more than 16 registers in the same telegram. Indeed there is a limitation in the telegram constructor:
This is at line 137 in "ModbusRtu.h" file. You should extend this value.
Try this!
Cheers,
Hey,
I have the following problem: I want send 200 registers from a modbus master to a slave. Both are arduinos. I can't send more than 27 registers. When I send more i get the Errorcode
255
which meanstimeout
. I know that the modbus message is limited to 253 bytes (256 bytes - server address (1 byte) - CRC (2 bytes)). Listed here: MODBUS APPLICATION PROTOCOL SPECIFICATION page.5My setup:
I use two Arduino Mega 2560. One as a master and the other as the slave. If that works I want to use more than one slave. They are connected via Serial1 master TX1 (pin18) to slave RX1 (pin19) and master RX1 (pin19) to slave TX1 (pin18).
The modbus library I'm using is ModbusRtu.h.
Because i want to ultimately communicate with more than one slave device I use RS-485. To send the message as a broadcasat but thats not relevant now because first I want to send to one slave to test it out.
I know that the array is much bigger as the registers I want to send. Thats because I wanted to know when the the timeout happens. Sending 27 registers works fine and the slave recieves all of the 27. But when sending more than 27 registers I get the timeout and nothing will be send.
Master code
Slave code
Questions
Help is very appreciated.
Cheers ueberBrot
Link to Arduino Stackexchange