alejoseb / Modbus-STM32-HAL-FreeRTOS

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
GNU Lesser General Public License v2.1
576 stars 191 forks source link

How to write code multiple holding register #70

Closed KomKGT closed 1 year ago

KomKGT commented 1 year ago

Hello @alejoseb your library is well but I stuck about write code multiple holding register ,Can you give me an example Thank you.I add my code in picture image it not work. What's wrong in my Code?

alejoseb commented 1 year ago

Hi, Check this example https://github.com/alejoseb/Modbus-STM32-HAL-FreeRTOS/blob/e9c16cf5a3e8fceb9ff06124b63ecf8fef9dc66c/Examples/ModbusF429/Core/Src/freertos.c#L120

It is for reading multiple registers, but the idea for writing is exactly the same

KomKGT commented 1 year ago

Thank you sir. I got it image This is my code it's work.

alejoseb commented 1 year ago

I don't quite understand what you did, but I am glad it works for you.