serial communication
Blaine Lee
blee at tellurian-inc.com
Fri Sep 29 12:27:38 EDT 2000
I am having trouble understanding how to control a serial port. I am
communicating with a couple different devices on serial ports. One of
the devices uses a protocal that does not end with a lf, therfore I
think I am having a problem with buffering.
On a side note, I cannot find documentation for termios on my Debian
linux system. Would it help if I found it?
I have tried the following, but it locks up at the term.read. I can
verify that there is data coming back, if I comment out the term.read
then do a 'cat /dev/ttyS0&' before starting this program.
import os
pendpath = "/dev/ttyS0"
os.system("stty -F " + pendpath + " 38400 raw -crtscts")
term=open(pendpath,"w+")
#misc configuration strings sent to device
while 1:
term.write("\002Af\003\n") # request keyboard next buffer item
str = term.read()
print str
i=i-1
term.close()
Thanks
Blaine
More information about the Python-list
mailing list