Sending null byte to serial port in Windows using PySerial?

sundae sundae1888 at hotmail.com
Fri Nov 1 12:30:17 EST 2002


Hi all,

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)
 -- <some data transfer on the port> --
com.write(chr(0))

The device should reply a single byte upon receiving this byte, but I
never got anything in reply.

I looked at PySerial's code, which calls win32file.WriteFile() to
write to the serial port.  I also checked out USPP, which
unfortunately threw an exception when I called read().  I suppose it
wouldn't make a huge difference anyway, since USPP uses win32file for
the underlying communication as well.

Have I missed anything?  Should I use some other method to write the
null byte to the serial port?

Thank you very much for you help!



More information about the Python-list mailing list