On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich 
<prometheus...@gmail.com> wrote:
I've been working on a program that will talk to an embedded device
over the serial port, using some basic binary communications with
messages 4-10 bytes long or so.  Most of the nuts and bolts problems
I've been able to solve, and have learned a little about the threading
library to avoid blocking all action while waiting for responses
(which can take 50 ms to 10 s).  Ultimately, this program will test
the device on the COM port by sending it messages and collecting
responses for 10k-100k cycles; a cycle being:
1. tell it to switch a relay,
2. get it's response from the event,
3. ask it for some measurements,
4. get measurements,
5. repeat.
Later I would like to develop a GUI as well, but not a big issue now
(another reason to use threads? not sure).

Twisted includes serial port support and will let you integrate with a
GUI toolkit.  Since Twisted encourages you to write programs which deal
with things asynchronously in a single thread, if you use it, your
concerns about data exchange, locking, and timing should be addressed
as a simple consequence of your overall program structure.

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to