05-22-2013 07:50 AM
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?
05-23-2013 10:34 AM
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!
05-23-2013 12:09 PM
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.
05-28-2013 01:13 AM
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.
05-28-2013 07:23 AM
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.
05-28-2013 07:31 AM
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.
05-28-2013 10:16 AM
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
05-28-2013 05:47 PM
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.
06-04-2013 12:52 PM
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.
06-05-2013 06:47 PM
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