Com port interrupts again

engsol engsolnorm at peak.org
Sat Jan 15 23:02:07 CET 2005


On Sat, 15 Jan 2005 19:38:19 +0000 (UTC), Chris Liechti <cliechti at gmx.net> wrote:

>engsol <engsolnorm at peak.org> wrote in 
>news:154gu09bghnq674s2nqot9si6d50igueq7 at 4ax.com:
>
>> I didn't fully think through my application before posting my
>> question. Async com port routines to handle com port interrups
>> only work well if one has access to the low level operating
>> system. In that case the receive buffer interrupt would cause
>> a jump to an interrupt service routine.. I don't believe that
>
>i would not go that route... the operating system provides sync and async 
>methods to access the serial port. it would make sense to use these before 
>hacking the operating system. (also see below)
>
>> Python provides that capabilty directly. The solution then would
>> be to write a C extention?
>
>ctypes can do many things without a C compiler. it's a very nice an 
>valuable extension, but i won't like to encurage to use it for this 
>particular problem.
>
>> The suggestions offered by respondents to my original post
>> were almost all of a "Use threads, and poll as needed" flavor.
>> You're right...I need to learn threads as applied to com ports.
>
>if you realy want to do async programming, have a look at twisted 
>(http://twistedmatrix.com). it does not only provide async access to the 
>serial port (trough pyserial + some code in twisted) it also delivers some 
>nice utility functions, classes etc, like the reactor, defereds, thread 
>pools (if you can't resist ;-) and many protocol handlers.
>
>chris

Chris, thanks for the pointer to twisted. I'm a bit snow bound, so it's a
good time to actually read some docs...:)
Norm B




More information about the Python-list mailing list