A
Alejandro
Hi:
I'm using pySerial to talk to a RS232 to RS485 converter. In order to
control the converter, I need to control the DTR line to enable/disable
de RS485 driver. In particular, I need to :
write a character to the serial port
set the DTR line to level 1 _after_ the last bit of the character is
send
So I tried this (ser is the serial port object):
ser.write(x)
ser.setDTR(1)
The problem with this is that the ser.write function returns before the
character is send, and thus, the DTR line is set too soon. (I checked
this behaivour with an osciloscope).
I thought that seting the writeTimeout parameter could help, but then I
realized that the write function wait "up to this time", so it doesn't
work.
Then I tried waiting some time with time.sleep() after ser.write, but
the shortest time for time.sleep is to big, and non deterministic, so I
think this is not an option.
Does anybody know how to do a ser.write() in a blocking way?
Regards,
Alejandro.
I'm using pySerial to talk to a RS232 to RS485 converter. In order to
control the converter, I need to control the DTR line to enable/disable
de RS485 driver. In particular, I need to :
write a character to the serial port
set the DTR line to level 1 _after_ the last bit of the character is
send
So I tried this (ser is the serial port object):
ser.write(x)
ser.setDTR(1)
The problem with this is that the ser.write function returns before the
character is send, and thus, the DTR line is set too soon. (I checked
this behaivour with an osciloscope).
I thought that seting the writeTimeout parameter could help, but then I
realized that the write function wait "up to this time", so it doesn't
work.
Then I tried waiting some time with time.sleep() after ser.write, but
the shortest time for time.sleep is to big, and non deterministic, so I
think this is not an option.
Does anybody know how to do a ser.write() in a blocking way?
Regards,
Alejandro.