-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ModBusSlave delivers bytes instead of words on FC03 How to fix ? #102
Comments
Hi, thanks for the issue, i added a help wanted label in case someone can help. |
Hello, //remove from final version
} You should not read the Serial1. the modbus library do this for you. If you read the Serial1, the bytes are removed from the Serial1 buffer. Here you read only bytes. (uint8_t): // Handle the function code Read Holding Registers (FC=03) and write back the values from the EEPROM (holding registers).
// Serial.print("FC "); Serial.print(fc); Serial.print(" Address "); Serial.print(address);
} check the things and try again. |
here is the next one: declare it as uint16_t
|
thank you for reviewing my code My reading and experience of the //remove from final version code is that serial1 will only be read directly I did previously experiment with changing the union { uint8_t MB_HoldReg[... to uint16_t I will have to do as you suggest and create a separate array for the modbus data |
I have ModbusSlave installed and running, but instead of delivering words from the buffer as words
it delivers bytes from the buffer as words
I just took code fragments from the examples and integrated into the application.
I fiddled around with changing various types to 16 from 8 but nothing resolved
rf95rk_reldg_RTD_server_Mega_10_IO_MB_FL_12.zip
Any suggestions, clues, or outright fixes most welcome.
I have tried to switch to other modbus libraries, but a few failed to even compile - getting stuck in the library code
The text was updated successfully, but these errors were encountered: