LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialization of all ports from a 8-port RS422-card reports an error.

Hi to all,
I have a problem with the initialization of my serial eightfold RS422-I/O-Card (so I have ten COM-ports on my PC). The card is made by Meilhaus Germany. Because of the speed, I have to use the Windows Win32-SDK function:

hCom = CreateFile(pcCommPort, GENERIC_READ; 0, NULL, OPEN_EXISTING, 0, NULL).

If I initialize the first seven COM-ports of the RS422-card it works well, but the last one (pcCommPort = “COM10”) reports the value INVALID_HANDLE_VALUE. But the function GetLastError returns the error number “0”. What’s wrong?
The card itself is not the problem, on a second PC with the a second card, the same problem. There is no matter if I use CVI 5.5 or 7.0.
Is the tenth com-port the problem? Has anyone an idea?
0 Kudos
Message 1 of 3
(3,081 Views)
I have not used RS-422 cards before but I have put as many as 18 RS-232 ports into a machine before. Windows NT, 2000 and XP all support up to 256 com ports regradless of type (RS-232 or RS-422). I don't recall the com port limits for Win98 but I am certain it is greater than 10.

Have you tried this with a different card from another manufacturer? The cards I used before were Rocketport cards and they worked very well, that same manufacturer makes RS-422 versions of the same cards.

Another tactic you might try if you do not need the two RS-232 ports is to disable those. It may be worth a try.

I am unsure why you say you have to use the SDK function to access the port. You could use OpenComConfig() and pass it a non-standard baud rate. As long as the baud rate you pass it is accepted by the underlying driver for the card, OpenComConfig() does not really care. It does not do any error checking and it does not coerce the value to the "standard" baud rate values.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 3
(3,077 Views)
Thank you MJF.
I have solved my problem.
When I tried to instead of “COM10” “\\\\.\\COM10” the function works well.
0 Kudos
Message 3 of 3
(3,058 Views)