![]() The PC can send the command “A” to the microcontroller.Let’s show a basic protocol of this kind: Now, if the microcontroller never sends data to the serial port unless the computer sends a command to it, and replies are always fast there is no problem. Code that updates the GUI should not be called from threads different from the main thread.If this happens, the GUI “freezes” and this annoys users who think the application has crashed and usually force-quit it. The thread that runs the GUI event loop should not block for long periods of time (say, more than a second).The additional problem that occurs when the application has a GUI is the result of two restrictions that GUI applications have: Since serial ports are used primarily to interface a computer with a microcontroller, we’ll focus on this case. This blog post focuses on a topic not covered in the article: using serial ports in Qt GUI applications. This is intended to be a small add-on to the article I’ve posted on my website which explains how to use boost’s asio library to interface with serial ports from C++ code. Update : Fixed a bug for compiling under visual studio 2010.
0 Comments
Leave a Reply. |