Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 5 months ago.
Change RTU settings at runtime (after init)
Hi,
I have a question about this nice modbus implementation. I would like to be able to change RTU settings of the modbus serial connection at runtime after initialization: baudrate, parity, number of stopbits.
I can't find the necessary functions to execute these changes.
Could you give me an indication where to look and/or how to proceed?
Thank you in advance!
Christopher
Question relating to:
1 Answer
8 years, 4 months ago.
G'day Christopher,
I don't think it is intended to be able to change baud rate and parity on-the-fly. The modbus protocol uses timers that are based on the baud rate, so changing baud rate after initialisation is not a good idea. You might just have to call "eMBClose" followed by "eMBInit" with your new baud rate and parity as parameters of that function.
Regards
Cam
Hello Cam,
Thank you for your answer and for the pointer in a solution direction. I'll give that solution a try and will let you know how it works out.
Fact is that I am designing a device that will be a modbus slave. The RTU config it will be used in will be different for every device, but I would like to have one biinary, and have the RTU config done at the moment of the installation of the device.
posted by 21 Mar 2016
Haven't really got an answer to the port configuration issue but I'm interested in discussing modbus issues as I looked at freemodbus a while back but couldn't really understand the documentation and variable naming conventions. I'm working on my own RTU-only handler.
posted by Oliver Broad 18 Mar 2016