LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

i need to comunicate with a lab brick signal generator via USB HID

Hi All

 

I also encountered the same problem recently.  I need to programmatically control Lab Brick digital attenuator which is also a HID compliance device.

I've tried the same way matt68 tried.  Using VISA driver wizard but also couldn't open VISA session at MAX as matt68 did. (The error is exactly the same

as "max1.gif" attached at the top of this thread.

 

Then I tried to use call library function node to call HID.dll directly but all the function call require a void parameter and I don't know why.

The same problem happened when call setupapi.dll.  I attached a pic "call dll viod.jpg" to show my situation.

 

So my questions are

1.  How did I end up with void function prototype when calling DLLs?

2.  Have anyone succeed to call HID and wrap it to a DLL (maybe not labview dll)?  Would you mind sharing the experience with

 

 

 

0 Kudos
Message 21 of 39
(2,726 Views)

Hi All

 

I also encountered the same problem recently.  I need to programmatically control Lab Brick digital attenuator which is also a HID compliance device.

I've tried the same way matt68 tried.  Using VISA driver wizard but also couldn't open VISA session at MAX as matt68 did. (The error is exactly the same

as "max1.gif" attached at the top of this thread.

 

Then I tried to use call library function node to call HID.dll directly but all the function call require a void parameter and I don't know why.

The same problem happened when call setupapi.dll.  I attached a pic "call dll viod.jpg" to show my situation.

 

So my questions are

1.  How did I end up with void function prototype when calling DLLs?

2.  Have anyone succeed to call HID and wrap it to a DLL (maybe not labview dll)?  Would you mind sharing the experience with me?

 

Thank

 

 

 

0 Kudos
Message 22 of 39
(2,726 Views)
I just Googled "HidD_GetAttributes" and found a number of links takling about how to use this.

LabVIEW is not detecting the prototype appropriately.

The MSDN entry for this dll shows that this DLL takes in two parameters and returns a boolean.  The parameters that this requires are not LabVIEW datatypes (ie: numerics or strings) so you will need to understand what these parameters are and probably write a wrapper.

The NI Developer's Zone had a simple example of how to construct a wrapper:

Writing a Wrapper Function for an External Code Function
Eric V
National Instruments
Applications Engineer
Certified LabVIEW Associate Developer


"I'm a Ramblin' Wreck from Georgia Tech and a helluva (NI Applications) Engineer!"
0 Kudos
Message 23 of 39
(2,706 Views)

Thank you, Eric.

The information is helpful and I amm studying the example at the link you provided.

 

Kirika

0 Kudos
Message 24 of 39
(2,686 Views)
You're very welcome.  Robot Happy
Eric V
National Instruments
Applications Engineer
Certified LabVIEW Associate Developer


"I'm a Ramblin' Wreck from Georgia Tech and a helluva (NI Applications) Engineer!"
0 Kudos
Message 25 of 39
(2,674 Views)

Hello all. Trying to find USB devices without creating a USB raw driver is a headache to say the least.

 

I had someone create a dll which  calls the Setupapi dll. I call his dll  with a library node and selected the funtions i needed to comunicate,

.

What I what to do is call the setupapi.dll directly to find all devices connect to USB ports. See below link.

 

http://www.eggheadcafe.com/software/aspnet/32984513/setupdienumdeviceinterfac.aspx  This link explains the process. My problem is I don't know what the parameters are for each call.

 

I don't know C++. I was looking at the header file and I can't make hwads or talls of it. l need  documatation that would show the the parametrs of each call using the library node.

 

For example when I call setupapi and funtion SetupDiGetClassDevsExW, is the output just a string which returns all devices. Do I need input parameters?

 

Your help would be appriciated.

 

Thanks

 

 

0 Kudos
Message 26 of 39
(2,502 Views)

 found this link http://zone.ni.com/reference/en-XX/help/370051H-01/cvi/calling_windows_sdk_functions/ These are the some of the dll's I need to call.

The first thing I need to do;
-call the SetupDiGetClassDevs which is in the setupapi,dll. see link http://msdn.microsoft.com/en-us/library/ms792959.aspx
SetupDiGetClassDevs returns a handle to a device information set that contains all installed devices that matched the supplied parameters.

Depending what I set for parameters i can get imformation on all devices connected to all ports.

My problem is don't know how the parameters are configured.

HDEVINFO
  SetupDiGetClassDevs(
    IN LPGUID  ClassGuid,  OPTIONAL   (how do I configure each of the parmteters in labview)
    IN PCTSTR  Enumerator,  OPTIONAL
    IN HWND  hwndParent,  OPTIONAL
    IN DWORD  Flags
    );

There are more call I need to make ,but need to get this imformation first.

 

 

Thanks

0 Kudos
Message 27 of 39
(2,471 Views)

Matt,

 

I do not actually have the Windows Driver Kit installed myself right now, but here are a few links that may help to get you started:

 

Where Can I Get Help Calling Windows API Functions from LabVIEW?:

http://digital.ni.com/public.nsf/allkb/09057CC08746FD47862566E800619B12

 

Windows API Function Utilities (32-bit) for LabVIEW:

http://sine.ni.com/devzone/cda/epd/p/id/4935

 

An example for calling the Win32 API from the LabVIEW 8.5 Help:

http://zone.ni.com/reference/en-XX/help/371361D-01/lvexcodeconcepts/ex_3_call_the_win32_api/

 

An example for calling the Win32 API from the LabVIEW 8.6 Help:

http://zone.ni.com/reference/en-XX/help/371361E-01/lvexcodeconcepts/ex_3_call_the_win32_api/

 

 

Eric

National Instruments
Applications Engineer

0 Kudos
Message 28 of 39
(2,392 Views)
Hi all, I am a beginner in Labview, and I was using Labview 8.2 Full Version. I saw that Matt was created a USB Raw driver using the wizard. And, Eric had show a link -- USB Instrument Control Tutorial. The link show us that how to create a USB Raw driver by using Driver Development Wizard. I would like to send a sound wave that generated by Labview to my USB Audio Mixer via USB port. Beside that, USB is the only input for my USB Audio Mixer. I had follow the step to create 1 USB Raw for my USB Audio Mixer. But, MAX cannot detect my USB device. There was an error (Code 10) show out at the Hardware Device Manager. I had some print screen about this. Anyone know what's wrong is it? Please tell me the problems and show me the way to fix this case. Thanks!
0 Kudos
Message 29 of 39
(2,375 Views)

Takeshi O,

 

Do you have a hardware driver for your USB device from the manufacturer?  I can look into what may be causing your error in device manager if needed, but this sounds like a case where a driver should already exist, and you may be able to play audio through the USB audio mixer just like you would through an internal sound card.  If you do have a driver from the manufacturer, try installing it and then try using a sound output VI example, such as Sound Player.vi in the example finder. 

 

The example finder can be found by opening LabVIEW, opening the help menu at the top and selecting "Find Examples".  Once this is open select the 'Search' tab in the, and searching for "sound".  From there scroll down towards the end of the list and you should find the "Sound player.vi" example.  Open this example and try running it with a selected .wav file and trying different Audio device ID's to find you USB Audio Mixer device.

 

Let us know if this helps or not!

 

Eric K

Applications Engineering

National Instruments

0 Kudos
Message 30 of 39
(2,342 Views)