LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

cts

What is the best way to handle the CTS signal with CVI ?. I've tried to use InstallComCallback() but it seems not to work.
0 Kudos
Message 1 of 5
(3,510 Views)
InstallComCallback should work. The callback should be called when the CTS line changes state if you set the event mask to LWRS_CTS.

The other way to do it would be through polling with GetComLineStatus checking for the CTS line to be on.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,510 Views)
It's exactly what I do....but I've noticed that when I clear the CTS, GetComLineStatus called from the callback says that CTS is not cleared !.

Is there a trouble inside the Windows driver ? Is the driver waiting a empty output queue before setting/clearing the CTS ?.

Best regards.
0 Kudos
Message 3 of 5
(3,510 Views)
Hi,

I wasn't able to reproduce the problem. I used the CVI shipping example for the serial callback: commcallback.c. And made some simple modifications to detect the CTS state.

Change the mask of InstallComCallback (line 62) to include the LWRS_CTS flag.

Addes some code in the Event_Char_Detect_Func (line 101) callback function:

if(eventMask & LWRS_CTS)
{
if(GetComLineStatus(portNo) & kRS_CTS_ON)
Fmt (outMessage, "%s","CTS asserted");
else
Fmt (outMessage, "%s","CTS unasserted");
MessagePopup ("CTS change detected", outMessage);
}

This works perfectly. I'm using Windows 2000 SP3.

Hope this helps.

DiegoF
National Instruments.
0 Kudos
Message 4 of 5
(3,510 Views)
Thank you.

I've just found the problem. Windows driver did not write directly the character. So when I write :
a)ComWrite()
b)ComSetEscape ( iPort, CLRRTS);
the second call occurs before all the characters are really written. So the franing is bad.
0 Kudos
Message 5 of 5
(3,510 Views)