LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

close usb device using call library function node

I am trying to use a vi which get the wavelngth from a wavelength meter. The first thing that the vi do is open the usb port by using a "call library function node", then read the wavelength by using another "call library function node" until the user press the button "done". The problem that I have is that I need to close the device to be able to relaunch the vi without having to close it. I tried to put another "call library function node" for that at the end of the vi but it doesn't work. Can somebody help me ?
I attached the vi and the dll
0 Kudos
Message 1 of 12
(4,020 Views)
The VI you posted does not have another Call Library Function Node with a call to the CLCloseDevice function. Is that what you tried adding? Exactly what do you mean the 'it doesn't work'? Is there an error generated, LabVIEW crash, smoke coming out of the computer? If this USB device is emulating a serial port, you probably don't need to use the dll at all.
0 Kudos
Message 2 of 12
(4,007 Views)
Yes I tried to add another Call Library Function Node with a call to the CLCloseDevice function, but when I do it it is not working.I have attached a prinst screen of the error and the vi with the CLCloseDevice function.
0 Kudos
Message 3 of 12
(4,001 Views)
You usually get that error when you don't provide the correct calling parameters. You did not provide a .h file that describes this call. How did you decide or did you simply copy the Call Library Function Node that is used for the Open? If so, doing a copy is not correct. You have to look at the .h file.
0 Kudos
Message 4 of 12
(3,991 Views)
Attached is the h. file, and I think that I put the right parameter. I thoight that maybe the problem was coming from how I connected it to the rest of the vi.
0 Kudos
Message 5 of 12
(3,990 Views)
I used the import shared library tool in 8.2.1 and it created a VI with the same calling parameters that you have. Obviously, without the device, I can't run the VI. Try running a VI with just the open and close function. You would then have the device handle from the opne wired directly to the handle input of the close.
0 Kudos
Message 6 of 12
(3,975 Views)

Can you send me the vi that you created, so I can try it.

Thank you.

0 Kudos
Message 7 of 12
(3,969 Views)
After reading the .h do you think that I've put the right parameters for the call library function node ?
0 Kudos
Message 8 of 12
(3,967 Views)
I have no way to save the 8.2.1 VI to 7.1 but the way you've got the Call Library Node Function is identical to the way it's being called by the VI that the wizard created.
0 Kudos
Message 9 of 12
(3,955 Views)
Well I have also Labview 8.2 on my machine. I tried to do what you said, just a vi with an open function and a close one and it doesn't work. Do you think that the way that I linked the close function to rest of the vi is ok ?
0 Kudos
Message 10 of 12
(3,954 Views)