10-27-2009 02:36 PM
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
10-27-2009 03:52 PM - edited 10-27-2009 03:52 PM
10-27-2009 04:17 PM
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
10-27-2009 04:20 PM - edited 10-27-2009 04:24 PM
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.
10-27-2009 04:28 PM
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 ?
10-27-2009 04:29 PM - edited 10-27-2009 04:32 PM
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.
10-27-2009 04:33 PM
10-27-2009 04:39 PM
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.
10-27-2009 04:47 PM
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?
10-27-2009 04:51 PM
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?