LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visa wizard to implement USB

I'm trying to create a VISA driver to communicate with a USB device.

 

Background: I used the equipment provider's ".inf" and ".sys" files to install the device. (The inf file requests the sys file).

I then wrote a VC++ dll.

Then, I created a LabView Application that calls functions in the dll.

 

This all works.

 

However, in order to connect to the USB port, I am currently using an app called "DEVCON". (I think I found this on the Microsoft knowledgebase).

 

I would like to use the VISA Wizard to open up the USB Port, and then run my application communicating with the device, then close the USB port (or discard the handles).

 

I guess I am trying to figure out what I need to do to use VISA with this application rather than DEVCON

 

keith

0 Kudos
Message 1 of 18
(3,695 Views)
This may or may not work using the NI VISA USB drivers. It really depends on the specific device that you are communicating with. The easiest way to do this would be to use the NI Driver Wizard to generate a inf file for you. You will need to know the device's vendor ID (VID) and product ID (PID). The manufacturer and product strings can be anything. You can get these using a tool called usbview (Google and download the tool). This will generate the inf file for you that will associate this device with the NI VISA driver. This will satisfy Window's need for the sys files. I have done this to add printers to the system. I did need to run a separate VI that called a Windows function to complete the association in the registry. This may or may not be needed. Again, this is dependent on the type of device you are using. For printers Windows was automatically associating the device with USB Printers and not the NI drivers. If you need this extra step let me know and I will post the code and dll for that.
Message Edited by Mark Yedinak on 10-27-2009 03:52 PM


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 18
(3,684 Views)

Mark:

I've tried using the wizard to build the inf file, however I kept getting an "error 1097" when my application was trying to use the dll to open the port.

The dll call is to my C++ dll, which uses an "Open Port" function that the manufacturer supplied through a "tlb" component.

Here is the code :

__declspec(dllexport) HRESULT __cdecl OpenPort ( unsigned char DeviceID )
{
 return ( m_pBrickInput->OpenDevice ( DeviceID ) );
}

I have a simple Call Library Function Node that calls this OpenDevice Function with a DeviceID of "0". However, it is returning the error 1097 when I try to use the Wizard's inf file. I suspect that the "USBDataBrick.sys" file is necessary to make the association with the Library calls and the USB Port.

Here are the OEM inf file

and the Wizard inf file

 

 

 

Download All
0 Kudos
Message 3 of 18
(3,671 Views)

Can you use VISA calls directly? Did you write the dll for other applications to use or are you using it in LabVIEW? If you are doing it solely in LabVIEW then try to use straight VISA calls.

 

When I have done this in the past I use direct VISA calls to communicate with the device. That means calling VISA Open, as well as the read and write VIs. Of course this means that I am solely responsible for knowing how the data should look.

Message Edited by Mark Yedinak on 10-27-2009 04:22 PM
Message Edited by Mark Yedinak on 10-27-2009 04:24 PM


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 18
(3,665 Views)

I'm using the dll in my LabView application only.

I would like to use the VISA calls directly, however, the USB Port does not show up in MAX, until I use the VISA wizard.

Is there some other way to let MAX know that there is a USB Port out there and point to the OEM-supplied inf file ?

0 Kudos
Message 5 of 18
(3,657 Views)

You use one or the other driver, not both. In other words, if you want to use VISA, then you cannot load the original inf/sys file and your dll. The VISA functions for USB are on the Instrument I/O>VISA>VISA Advanced>Bus/Interface Specific>VISA USB.

 

If you go the VISA route, search out all of the Nuggets from Intaris.

Message Edited by Dennis Knutson on 10-27-2009 03:32 PM
0 Kudos
Message 6 of 18
(3,654 Views)
The USB VISA resource is not available.
I believe this is the core issue. Outside of using the VISA Wizard, how can I get the resource to show up in my list?
Should I be doing this in MAX ?
0 Kudos
Message 7 of 18
(3,649 Views)

You just said "the USB Port does not show up in MAX, until I use the VISA wizard." So, does the device show up in MAX when you use the VISA inf file or not? If it does, then you have done the first step. The rest is rewriting your code for a VISA interface.

0 Kudos
Message 8 of 18
(3,641 Views)

Well, (**exasperated sigh**), I have accomplished step 1, apparently. Are there any examples of Steps 2..100?:manmad:

 

ok, that was me venting.

 

So, the DLL that I wrote, must now be re-written to accept VISA? If so, how is this done?

 

0 Kudos
Message 9 of 18
(3,637 Views)

As I said, the best source I have seen for using VISA USB functions is the several nuggets written by Intaris. The link I gave you was for the first one.

 

Curious why you want to use VISA. Is it just so the device shows up in MAX?

0 Kudos
Message 10 of 18
(3,634 Views)