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 matt68,

What is the make/model of the device you are trying to use?  Did the manufacturer give you any information on how to access it?

Typically, if a device has been designed to be accessed programatically (as in, from a computer language), it will come with some sort of documentation or sample code (in C or Visual Basic) showing how to access it.  This is easily translateable to LabVIEW code, as LabVIEW has the ability to call DLLs written in text-based languages via the Call Library Function node, which I think is what Dennis was getting at.
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 11 of 39
(2,655 Views)

I need to call the setupapi.dll in the C:\Windows\System32 folder to run the SetupDIGetDeviceInterfaces.

This should open up a session with the device.So I could communicate with it.

I know I need to use the call library funtions. I'm unsure how to to this.

Could someone show me in labview how to do this.

I would greatly appriciate it.

I know there are steps after this were I need to call other funtions. But I having trouble with this one.

When I call this funtion does it query all the devices on the USB?

 

Thanks

0 Kudos
Message 12 of 39
(2,622 Views)
Hi matt68,

In LabVIEW, Go to Help»Find Examples and browse Communicating with External Applications»Using External Code»Integrading DLLs»Call DLL.vi for a good example of how to use the Call Library Function node.

As far as what that specific function does, I don't know.  Where did you find out about it?  I googled it but nothing came up (except for this forum thread).
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 13 of 39
(2,594 Views)

Hi thanks for the input. The call is part on the setupapi.dll in the windows system32 folder.

My problem is that I'm not sure how to con figure the parameters for the inputs and outputs.

I found some documentation see attched.

I tried making a wrapper dll  but it comes up with errors.

I made a simple vi which just adds one to the input. Then putting the vi in a prodject i was able to create a dll.

Then I used the library functoin to call the dll I made. All I had to do was select the dll and hit ok.

The input and output configured themsevles.Why when you call windows dll It doesn't do that I just don't now.

 

Thanks again.

 

0 Kudos
Message 14 of 39
(2,576 Views)
Hi matt68,

If the dll includes the type library, then the prototype will automatically be filled out for you.  It looks like this DLL wasn't built with a type library included, so you will need to define the prototype yourself (and probably create a wrapper).  What error are you receiving, exactly?

Here are some additional tidbits (and where I found them) that may help:
---
LabVIEW 8.5 Help - Configuring the Call Library Function Node:


"Note  If a type library is found, the parameters are updated to match the parameters found in the type library for the selected function."
---
How Do I Call a Dynamic Link Library (DLL) from LabVIEW?:


"If the function does not contain any complex data types and you have a header file (*.h), a great tool in LabVIEW can help you easily import the DLL (and it will create an entire library for the DLL).  You can find this option in Tools»Import»Shared Library (.dll)...  Continue with the wizard. "
--
Writing a Wrapper Function for an External Code Function:

Provides an example of a wrapper.
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 15 of 39
(2,554 Views)
Thanks for the info.
If you take the setupapi.dll located in the system32 folder and try to create a wrapper you will see the error.
 
The link below is were I found the setupapi header fie. I just saved it and used it as the header file.
Click on the setupapi header file on the right. It takes a few to load.
The the header code will show up inthe main window.The you can save it.
 
 
 
 
Thankks for you help
0 Kudos
Message 16 of 39
(2,546 Views)
Hi matt68,

I couldn't find the function you specified in the header.  The closest I found was "SetupDiGetDeviceInterfaceAlias".

In any case, you really need to write a wrapper to pull the data out of the DLL and convert the variables to something that LabVIEW can understand.
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 17 of 39
(2,522 Views)

Thanks for the input.

I tried making a wrapper before. See attached  for the error I get.

Thanks

0 Kudos
Message 18 of 39
(2,511 Views)
What I meant was, actually writing a wrapper in C/C++ to extract/input the specific data that you need in a format that is easy to work with in LabVIEW.
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 19 of 39
(2,483 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 or the code with me?

 

Thank you

Kirika

 

 

 



由 Kirika 在 06-17-2008 04:48 AM 上編輯的訊息
0 Kudos
Message 20 of 39
(2,304 Views)