Hi,
I use the pyserial to read data from a serial port.
My code is in window Xp and python 2.4. when I use Hyperteminal I can
read data without try and try again that it is not the case with
pyserial library.
anyone can help me ?
this is a part of my code:
self.ser = serial.Serial()
self.ser.baudra te = 9600
self.ser.port = 3
self.ser.timeou t= 10
self.ser.bytesi ze = serial.EIGHTBIT S
self.ser.stopbi ts = serial.STOPBITS _ONE
self.ser.xonxof f = 0
nbHisto = 144
for i in range(0,nbHisto ):
while 1:
print self.ser.flushI nput()
print self.ser.flushO utput()
cmd = "%xs\r" %(i+1)
self.ser.write( "%s" %cmd)
#print cmd
histo = self.ser.readli nes()
#print histo
if histo:
if histo=="\r\n":
pass
else:
histoAdresse = int(histo[0].strip('\r\n'))
print histoAdresse
try:
dateHisto_cur = listeFenetreNon Nul["%s"
%(histoAdresse)]
print dateHisto_cur
self.ecrireHist oDansFic(histo, histoAdresse,da teHisto_cur,his toAdresse,i)
break
except:
print "Adresse pas trouvee dans le
systeme %s" %(histoAdresse)
break
# End if
sleep(10)
# End while
#End for
self.ser.close( )