Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect end of serial transfer

I've got an RS232->RS485 converter board that is a lot like this one: http://www.e-lab.de/diverse/RS232-485sch.pdf
 
My board got a MAX485 that got its Drive-Enable input controlled by the state of the RTS line.
 
I tried to control the board using the modem line control properties of the NI VISA serial library. I can properly assert and unassert the RTS line, but the timing is wrong.
 
I can assert RTS and start a serial transfer at the same time, it will look good on the scope. But I have no way to wait for the serial transfer to finish so that i can un-assert the RTS line after my transfer is finished. If i would just unassert the RTS line after the serial write VI finished the RTS line would go un-asserted before the end of transfer - so i guess the transfer is actually running as an own thread.
 
So is there a way to detect if my transfer has already finished?
 
I could of course add a fixed wait time before I un-assert the RTS line, but then the RS485 slave would need to wait for quite a while before they could answer to the request sent by the PC (this is because accurate timing is not possible by inserting fixed wait times).
0 Kudos
Message 1 of 3
(3,446 Views)

I had the same problems with controlling direction of 232-485 adapter.  I created an auto direction control by setting up a 555 timer as a retriggerable one-shot.  Set the timeout to be 2X time to transmit 1byte.  About 2ms for 9600 baud.  Pretty simple to modify 555 circuit to alter timeout for various baud rates.

I've attached part of my schematic that shows how I used the 555.  The rest of your circuit is very similar mine.

0 Kudos
Message 2 of 3
(3,425 Views)
Thank you for your reply, but I have already worked around this problem by another method. I was trying all day to find out that i could just read back what was sent by the PC (receiver is always enabled).
 
thank you,
marius
0 Kudos
Message 3 of 3
(3,414 Views)