LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

2nd call of OpenComConfig() fails on 2nd port of FASTCOM 422/2 PCI card

In a FASTCOM 422/2 PCI card, two ports COM3 and COM4 exists and configured - tested with loopback between two HyperTerminal instances.  But creation of one application using CVI's serial libraries fail on 2nd instance of OpenComConfig().
status = OpenComConfig( 3, "COM3", 115200, 0, 8, 1, 32000, 3200 );
status = OpenComConfig( 4, "COM4", 115200, 0, 8, 1, 32000, 3200 );

The value of <status> is 0 (no error), but step into 2nd function, and status=-7 (invalid port). If I have one application open COM3 by itself, it works fine. If I have a different application poll COM4, it works fine. But if I put both funcitonalities under same application, OpenComConfig() fails and I cannot continue.
Any ideas?


Thanks.

0 Kudos
Message 1 of 5
(3,732 Views)
What version of CVI are you currently using?  In earlier versions of CVI, an error occurs when you try to open two sessions with the RS232 ports.


Mark W.
National Instruments

0 Kudos
Message 2 of 5
(3,717 Views)

Don't use COM3 or COM4 strings, just use simple port no like:

OpenComConfig(3, "", 115200, 0, 8, 1, 4096, 4096);

 
0 Kudos
Message 3 of 5
(3,712 Views)

I am using LabWindows/CVI version 6.0.

     status = OpenComConfig( 3, "", 115200, 0, 8, 1, 32000, 3200 );
     status2 = OpenComConfig( 4, "", 115200, 0, 8, 1, 32000, 3200 );

There seems to be no impact whether the "COM3" or "COM4" string names exist or not.  I put that there due to help documentation for OpenComConfig() call.  The value for <status2> is still "-7" (invalid port). 

If I change the 2nd call to OpenComConfig() from 4 to 3, the error does not exist (status2==0), but writing to port 4 does not work - ComWrt(4, ...) fails.

     status = OpenComConfig( 3, "", 115200, 0, 8, 1, 32000, 3200 );
     status2 = OpenComConfig( 3, "", 115200, 0, 8, 1, 32000, 3200 );

Different/related question: A co-worker told me that since COM3 and COM4 are configured for two ports from the same card, that two different CVI applications cannot handle it?  That OpenComConfig() takes hold of the handle for the card, so opening COM3 does not allow COM4 to be opened from a different CVI application?  That is why I wanted to get this program with merged two apps together work.  Thanks.

0 Kudos
Message 4 of 5
(3,693 Views)

The CVI functions (OpenComConfig, ComWrt, ComRd, etc) works fine with my FastCOM PCI-422/4.

You can use the serial.exe program to verify that. The program is in the samples folder. Even if you run multiple instances (for my board max 4) of the program (each for a different port) there are no problems reported and you can do a loopback testing on all ports at the same time.

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 5
(3,503 Views)