LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Are CTS and RI RS232 status lines readable in CVI5.01 on W2K?

I'm trying to read the CTS and RI status lines of the Com port in CVI 5.01 running on windows 2000.

Since there's no direct function, I've tried using the INP function to read the modem status line directly. While the "delta CTS" bit toggles correctly, the actual CTS value bit does not seem to change.

Are these bits masked out of the driver at the low level?

I've tried(unsuccessfully) to open the com port using the SDK OpenFile call to see if I could read the bits via GetCommModemStatus.

Any ideas?
0 Kudos
Message 1 of 2
(3,140 Views)
I think the CVI function for you is "GetComLineStatus" that yields the modem control register values. This function is available in CVI 5.5 for Windows but I do not know if version 5.01 provides it.

Otherwise you can use the Win32 SDK function "GetModemStatus" after opening the COM port using the "CreateFile" function
(not "OpenFile": it was used in Win 3.x).
For instance you can open the COM1 port with the following command:
hComPort = CreateFile ("\\\\.\\COM1",GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING, 0, NULL);

This is for non overlapped I/O operations.
hComPort is of type HANDLE.
Do not forget to close the "hComPort" handle (with the "CloseHandle" function) at the end of the program or when you do not need to use the COM port any more.
However have a l
ook at the SDK documentation for all the details.

In CVI 5.01 I do not know if you can use the Win32 SDK functions to manage the COM port operation after opening it using CVI (OpenCom or OpenComConfig).
In version 5.5 you can get the system port handle (i.e. the value returned by "CreateFile" when it opens the COM port) with the "GetSystemComHandle" function. In this way you can mix CVI and native Win32 function calls.

Bye
Giovanni
Message 2 of 2
(3,140 Views)