Python Event Driven Serial Podcast
On Wed, 12 Jan 2005 17:45:48 -0500, Peter Hansen wrote: engsol wrote: Has anyone done a script that will rspond to the serial com port(s) receive buffer interrupt, as opposed to polling and timeouts? Win2000 is the main interest right now. Vmware Workstation 11 Serial Key Free Download Full Version Crack. What problem do you hope to avoid by not using 'polling and timeouts'?
(Note that if you specify a sizable read timeout, you're closer to being interrupt-driven than you are to what is traditionally called 'polling'.) -Peter Peter, Thanks for the reply. I'm working on a s/w test program using python code.
Com1 and com2 play a part. The problem is that the python code has a lot of work to do.and the results from the hardware under test can come from either com1 or com2.at any time.
It may be a few milliseconds, or several seconds, sometimes minutes, before a response is expected. I'm not sure what timeout value I'd use. Using threads, and re-loading the timeout values on the fly may be a solution, but I'm not experienced with threads.and was hoping to avoid them. On Wed, 12 Jan 2005 14:24:48 -0800, engsol wrote: Has anyone done a script that will rspond to the serial com port(s) receive buffer interrupt, as opposed to polling and timeouts? Win2000 is the main interest right now.
Jul 18, 2005 pyserial and com port interrupts. Python Forums on. Has anyone done a script that will rspond to the serial com port. You're closer to being interrupt-driven. What is Twisted? Twisted is an event-driven networking engine written in Python and licensed under the open source MIT license. Twisted runs on Python 2 and an ever.
Have you looked into letting the OS do it? I.e., reading from COM4: or whatever port in a thread maybe one byte at a time? Maybe you can get your end functionality without writing low levels stuff, depending;-) I haven't done this, but it seems an easy thing to try a few experiments with. The control panel should let you set baud rates and handshaking etc. I would think. Regards, Bengt Richter.
On Thu, 13 Jan 2005 03:11:23 GMT, Bengt Richter wrote: On Wed, 12 Jan 2005 14:24:48 -0800, engsol wrote: Has anyone done a script that will rspond to the serial com port(s) receive buffer interrupt, as opposed to polling and timeouts? Win2000 is the main interest right now. Have you looked into letting the OS do it? I.e., reading from COM4: or whatever port in a thread maybe one byte at a time? Maybe you can get your end functionality without writing low levels stuff, depending;-) I haven't done this, but it seems an easy thing to try a few experiments with. The control panel should let you set baud rates and handshaking etc. I would think.
PySerial[1] is more than capable of handling all the low level operations with little more than 's.baud = 9600'. The OP was more interested in how to write his program so he could react to com port input in a timely manner in the face of having blocking procedures elsewhere in his code. Regards, Stephen Thorne [1]. Engsol wrote: Has anyone done a script that will rspond to the serial com port(s) receive buffer interrupt, as opposed to polling and timeouts?
Win2000 is the main interest right now. Thanks Norm B Hello, I came across this problem as when I first used PySerial, I came from a java background which has the ability to register listeners to a serial comm instance and receive interrupts (although some implementations use polling behind the scenes anyway). I don't think that pyserial has this kind of thing so I used the following: def __checkSerial(self): self.__objLock.acquire() try: try: intNoChars = self.__objSerialPort.inWaiting() if (intNoChars >0): strReceivedString = self.__objSerialPort.read(intNoChars) #or you could fire an event self.newMessage(strReceivedString) except: #put any clean up code in here.