pySerial Windows write problem
Bob Greschke
bob at greschke.com
Thu Jul 28 23:55:35 EDT 2005
"Peter Hansen" <peter at engcorp.com> wrote in message >
> Actually, I'm curious why you don't do the same. I'd call it very unusual
> (in my experience) to have a program open and close a serial port
> repeatedly. Among other things, this means that the DSR/DTR lines are
> toggling high and low repeatedly, and that alone could cause undesirable
> behaviour in certain devices.
I guess I could. It's just that not releasing the port/not KNOWING that the
port has been closed at predictible times is our chief complaint about the
C++ program. As an aside, when I left work I left a version of the
while-loop program running, opening the port, writing to the equipment,
getting a response, and closing the port. It was up to about 180 sucessful
cycles (in a row -- it will stop if it fails). I think it's a hardware
problem. :)
> In none of my own serial-based programs (perhaps a few dozen such to date)
> have I ever opened and closed a port other than at startup and shutdown
> (just as your C++ program does). Unless you've got a good reason to do
> otherwise, if this solves your problem it's certainly the most direct
> approach to do so.
One of the serial ports (there are actually two) is used to read some NMEA
sentences from a GPS. It is only rarely read. If it is also opened when
the program starts and kept open would you just dump the buffer and then
read to get the most current info? What happens when the buffer fills up?
The "main" port is just commands sent, responses received kind of traffic.
I'd write a C extension to do the serial stuff, but I don't know a thing
about Windows programming.
Thanks!
More information about the Python-list
mailing list