Sending null byte to serial port in Windows using PySerial?
Chris Liechti
cliechti at gmx.net
Fri Nov 1 16:15:15 EST 2002
sundae1888 at hotmail.com (sundae) wrote in
news:49f4e27a.0211010930.56788863 at posting.google.com:
> I'm having troubles sending the null byte (0x00) to the serial port in
> Windows using PySerial on ActivePython 2.2.1 build 222. Currently I'm
> doing something like this:
>
> com = serial.Serial("COM1", 9600, timeout=1)
sidenote: i sugest to use numbers i.e. 0 <-> "COM1" that makes it easier if
you want to run the prog on other platforms or with jython.
> com.write(chr(0))
well i'm reading and writing null characters en masse. so no problem. the
port is configured for binary data transmition on all platforms.
> The device should reply a single byte upon receiving this byte, but I
> never got anything in reply.
well i suspect that something is wrong with your setup. you're sure your
device is connected to the right port and listening with the same baudrate?
you're reading from the port as you expect, you use a timeout. does the
read function return before your device answers?
chris
--
Chris <cliechti at gmx.net>
More information about the Python-list
mailing list