CIRCUITSTATE / CSE_ModbusRTU

Arduino library for implementing Modbus RTU communication protocols using hardware/software serial ports.
MIT License
6 stars 1 forks source link

Holding registers #5

Open hembyggarn opened 7 months ago

hembyggarn commented 7 months ago

Hi! I found your library wery easy to use but since I´m not so used to ModbusRTU I was looking for a good example in how to read and write to other registers than the coil but I didn´t find any good ones. So, I´m trying.... :) I´m building a heating control system with several nodes. One of them shall read temperatures (float) and write them to the holding registers so the master can reach them. I´m obviously doing something wrong so I tried to create ten holding register and fill them all with the same data. When the master asks for them the slave send them but NOT the data I have put there. The strange thing is that if I write the same data in all of them the data that will be sent should all be the same. But NO. It is sending different data in each register. I don not know what to do. Best regards Hasse Skärmklipp

vishnumaiea commented 7 months ago

Hello @hembyggarn.

This could be due to a previously reported issue #4. Please use the latest development branch in your project and see if it fixes the problem.

vishnumaiea commented 7 months ago

Another thing you can check is the response of the writeHoldingRegister() function. If the write operation is successful, it should return 1; and -1 otherwise.

You can also post your test code here so that I check if there is anything wrong with your code.