09-30-2005 04:58 PM
10-04-2005 07:34 AM
VI_ATTR_ASRL_DTR_STATE
Resource Classes
Serial INSTR
Attribute Information
Read/Write
Global
ViInt16
VI_STATE_ASSERTED (1)
VI_STATE_UNASSERTED (0)
VI_STATE_UNKNOWN (–1)
N/A
Description
VI_ATTR_ASRL_DTR_STATE shows the current state of the Data Terminal Ready (DTR) input signal.
When the VI_ATTR_ASRL_FLOW_CNTRL attribute is set to
VI_ASRL_FLOW_DTR_DSR, this attribute is Read Only. Querying the value will
return VI_STATE_UNKNOWN.
Hope this helps,
10-04-2005 10:01 AM
I'm using a MAX487 connected to my Serial port. Thus, I must have control over DTR.
I inhereted this app from someone and I don't know what control he used. However, my question was how do I get DTR to track when the transmit buffer empties?
10-06-2005 08:26 AM
10-06-2005 09:40 AM - edited 10-06-2005 09:40 AM
Message Edited by Roberto Bozzolo on 10-06-2005 04:42 PM
10-06-2005 10:08 AM
I have an EXTERNAL MAX487 chip, not an NI card. So, it goes via PC serial port to MAX487 and on.
>Also, instead of calling GetOutQLen(), you could simply call Flush(), which only returns after all data has been sent out of the output queue.
Is this regardless of whether I'm using a NI board or not?
10-06-2005 10:43 AM
10-07-2005 03:28 AM
10-07-2005 09:53 AM
>have you tried using the ComSetEscape () function?
Yes, that is what I'm using to actually control the DTR signal and it does control it. HOwever, the problem is trying to time it with the serial out que. Programmatically, you turn it on, turn it off. The problem is that you never know exactly how long Windows will take to ship it all out. Similarly, using Delay() is equally unpredictable. It wanders around a considerable amount.
What I found is that using the Delay() minimum resolution of 0.0001 provides sufficient delay to send and force DTR low before my target responds. That was easy enough, but the difficulty is when my transmit string increases.
So, I simply added 300 mS for each 38.4K Baud byte to my delay and it seems to adapt well enough.
There is a timing issue that puzzles me where I can see DTR assert and de-assert well before my 3 byte string goes out the port (a Windows thing, no doubt). It eventually synch's up and runs OK for the most part. Is there no hard control of these things? No hardware level access available via CVI?
It isn't what I'd like, but it seems to work.
10-07-2005 10:42 AM
Yes, documentation about FlushOutQueue is not clear: you don't know if this function actually forces write to the port or if it clears the outq before message is sent...
Other possibilities I can think of (maybe you have already tried all these...) are:
- InstallComCallback with LWRS_TXEMPTY in the event mask: this should fire an event when tx queue is empty. Don't know exactly how it interfaces with windows environment, though...
- OpenComCOnfig with -1 as Output Queue Size: this should bypass the output FIFO and let CVI write directly to the com port. This has solves some misterious problems I had with missing messages: maybe you can take advantage of this option too.