LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What do I need to communicate with a USB device?

    Hello all,

 

A beginner's question: i have a wavelengthmeter (something that detects and reads out the wavelength of laser) that uses USB 2.0 for communication (and power actualy). It came with a program that works perfectly fine..i can measure successfully.  it also came with LabVIEW demo VI...but it doesn't work. It's a simple library function calling of this dll file the wavelengthmeter came with. 

 

The result is -5 which is an error code for "Wavelength Meter Missing"...but it's not since the default program can detect and run perfectly fine.

 

What would be the problem? Do i need to initialize certain things like serial instruments? I've attached the VI and the DLL file...hope it will be any help

 

Thank you all!

 

 

0 Kudos
Message 1 of 8
(3,389 Views)

 Hi,

 

Thanks for the post!

 

Here is a great tutorail: 

 

USB Instrument Control Tutorial

http://zone.ni.com/devzone/cda/tut/p/id/4478

 

Im afraid your error is very specific to this wavelength meter. 

 

I would check you have the correct setup and software install in the documentation/readme you should have got with your labVIEW demo.

 

Let me know how you get on,

 

Kind Regards,

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 8
(3,375 Views)

Hello HIllman

 

i tried the measurement and automation program, but cannot detect any usb device. But  device is connected and wrok on the program it came with

 

i'l keep reading the tutorial and hopefully more hints can come.

 

 

0 Kudos
Message 3 of 8
(3,368 Views)

Hi,

 

Where did you look, it will be seen by MAX as an usb raw device - I would take a look in the Windows device manager to see what the name of the device is?

 

I would also recommend looking through the knowledge base articles,

 

Here is a good starter: 

 

Can VISA Read be used to read USB Interrupt Data?

http://digital.ni.com/public.nsf/allkb/D38E5A65DA54C9A2862571E900810FEA?OpenDocument

 

Please let me know how you get on,

 

Kind Regards, 

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 8
(3,364 Views)
Unless the vendor provides a VISA driver for it (which I doubt), you wil not see anything in MAX. Have you contacted the vendor? It sounds like you have a problem with their dll and not a problem with LabVIEW.
0 Kudos
Message 5 of 8
(3,358 Views)

so from what you are saying, is that I cannot simply plug a instrument to the usb port and expect it to work in labview? like serial rs232 instrument i can simply connect to com port and go visa read visa write blablabla and it works..so for usb i cannot just plug it, and call the dll function and hope for some number out ?

 

somehow i need to set up the visa driver myself? 

0 Kudos
Message 6 of 8
(3,332 Views)

It depends on the USB device. Some of them will actually emulate a serial port after the installation of the driver provided by the vendor. Some vendors will choose to use a different USB class and write a driver for that class. For example, a vendor could choose to use the HID (Human Interface Device) class. A common class for certain types of instruments is TMC (Test & Measurement Class). Since you got software from the vendor and that is working, part of the installation was a .inf file that tells windows about the device. You can read this file and get the information yourself. Whatever class this is and whatever driver it is using as shown in windows device manager, is probably what the Call Library Function Node in the example is using. The error message is being returned by their dll and their code. They should have an idea of what might be wrong. In theory, it should be just as easy as you describe.

 

The only time you would set up a VISA driver yourself is if you wanted to create a driver from scratch yourself and forget about whatever code you got from the vendor.

0 Kudos
Message 7 of 8
(3,320 Views)
Was access to the device blocked because you had both programs running at the same time??
0 Kudos
Message 8 of 8
(3,293 Views)