cwalter-at / freemodbus

BSD licensed MODBUS RTU/ASCII and TCP slave
720 stars 379 forks source link

RTU and TCP outputs only show the least significant byte of the registers #32

Open jimhumphriesFMI opened 2 years ago

jimhumphriesFMI commented 2 years ago

Hi, I am running this software on an STM32F407 running as a modbus slave device. Everything works fine except when i poll data from the device and read the holding registers via either RTU or TCP I only receive the least significant byte of the register even though the modbus master specifies to read INT16 data. Any idea why it is not transmitting the upper byte of the register? I inherited this project from a previous developer so I do not want to start modifying it until I know if there is a simple solution or not.

karlp commented 2 years ago

This is an error in your own implementation, possibly in the callbacks implementing functions, or on your own receiving end. Plenty of us are using this quite happily with full 16bit registers.