LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

USB COMPORT OPEN/CLOSE

i have a usb device the when connected to a PC opens three ports.  One of which is used for direct communication.  If I install another device of the same type windows enumerates additional three ports.  the usb device needs to be shut down manually in windows so it will free up the ports.  How can I use CVI to detect the specific device and always use the same comport?  I need to production test thousands of these devices.  I tried using ni-visa to create a driver so the device will show up in MAX but I could not use max to communicate with the device.  Any suggestions?

0 Kudos
Message 1 of 11
(4,794 Views)

Hi Joncombat,

 

If the device will not show up in MAX, it will not work with CVI.  Can you tell me a little bit more about the device and what ports it is opening?  Are these COM ports?  If you can get the device to show up in MAX, you can assign it a specific name that you can reference for that device in CVI.  Please let us know a little more about the device and we will do our best to help!

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 2 of 11
(4,773 Views)

I'm connecting a usb GSM radio.  It comes up as three ports in windows.  One of them is an actual comport I can send commands to using a hyperterminal.  If I remove the module and plug another to the PC, windows assigns additional comports to this new module.  The USB device needs to be shutdown manually in order to free up the unused ports.  I need CVI to detect the device so I can production test these units.  I also need to have windows safely shutdown the port to I can test the next device using the same comport number. 

0 Kudos
Message 3 of 11
(4,767 Views)

Hi Joncombat,

 

If Windows is assigning new COM ports to the device each time it is plugged in, you may need to look into determining whether or not Windows can be stopped from doing this.  If the COM port keeps changing, then the CVI code will need to update to reflect the new COM port each time.  I would also assume that you are using NI-VISA to communicate with your device in CVI.  NI-VISA does not have methods for recognizing devices; it only communicates across a COM port with send/recieve commands.  Take a look into seeing if Windows can recognize a device based on it's device ID to assign a consistent COM port to it.  It would require some kind of configuration on each computer you need to interact with.

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 4 of 11
(4,738 Views)

Is there a way to detect usb devices on the PC using CVI?  If so, can the devices be closed using windows sdk commands (to safely remove them)?  If I can close the windows device using CVI when a new device is connected it should be assigned the same comport.

 

0 Kudos
Message 5 of 11
(4,731 Views)

You will need to uninstall the current device to release the COM port number so that it could be used by a new device. You can use the Windows Setup API (part of the Windows SDK) to do this - there's a Microsoft article here you might find useful.

--
Martin
Certified CVI Developer
0 Kudos
Message 6 of 11
(4,728 Views)

are there any simple cvi examples on using the sdk commands?  How can I verify I have the sdk features installed on my pc?  I am using cvi 2010

0 Kudos
Message 7 of 11
(4,719 Views)

If you have a "sdk" folder under the main LabWindows/CVI installation folder, then you have the SDK library installed for CVI.  Otherwise, you have to install it from the original LabWindows/CVI CD. 

 

At the same time, this post (http://forums.ni.com/t5/LabWindows-CVI/Check-com-port/m-p/220169#M16292) might be of much help, too.

0 Kudos
Message 8 of 11
(4,709 Views)

I have it installed.  Where are the SDK commands documented? On NI side or MSDN?  I am trying to find a simple sdk example to see if I can detect the usb comport and then close it.

0 Kudos
Message 9 of 11
(4,673 Views)

Hi Joncombat,

 

I found a document that might be helpful in locating the documentation and examples for the Win32 API SDK in LabWindows/CVI.  Please take a look at the following documentation and let me know if you have any further questions!

 

Using the Interface to the Win32 API in LabWindows/CVI

| Zach J. | Systems Engineer, HIL and Test Cells | National Instruments |
0 Kudos
Message 10 of 11
(4,648 Views)