The Comm thread is responsible for doing a couple of retries if a response to a packet isn't achieved. Additionally, it allows me to concentrate the error handling if a response isn't received in one place. Using a separate thread for communications allows me to have the option of either blocking or not blocking waiting for a response from the Wombat. Then all the applications I write use the same API. I like the threaded approach because it lets me write the code once for my interface class to the Wombat, and be done with it. It uses an 8 byte protocol: 8 bytes to the PIC, 8 bytes response. I typically write serial programs to interact with my Wombat PIC project. I have a lot of experience with other real-time operating systems, and this experience tends to bias my designs (hammer.looks like a nail.you know.). I will start by adding a disclaimer that I'm not an experienced windows programmer. What advantage is there in creating a separate thread that constantly polls COM1? Isn't the disadvantage of this thread-based polling approach that it will impact on every other application's performance?
0 Comments
Leave a Reply. |