LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instrument Handle Out as Global variable

Hi,

How do i create "Instrument Handle Out" of an IVI function as a global variable.

Regards,
Siddu
0 Kudos
Message 1 of 7
(4,168 Views)
I don't work with IVI, but this should work - Open the globals VI and add an IVI Logical Name control (I/O palette).
As a more generic solution, right click the output terminal and select Create>>Control. Find the control on the FP, copy it (ctrl+c) and paste it into your globals VI. In either case, it should now be a global variable.
You should take care when working with globals, because you can cause race conditions - for example, you probably have to open communication to your device and pass the value of the reference into the global before being able to use it. If you don't, you may start having problems, and it will be hard to locate them.

___________________
Try to take over the world!
Message 2 of 7
(4,160 Views)
Hi,

Logical Name is different from the Instrument Handle out. I could not find any control as "Instrument Handle Out" on the front panel controls.My whole purpose is to intialize all my resources in a single vi and pass the handles to the rest of my test programs instead of carrying out the intialization and cleanup sequences every time.

Regards,
Siddu
0 Kudos
Message 3 of 7
(4,157 Views)
OK, I see what you're saying, but did you try the second method I suggested? I do have some IVI VIs and that seems to work fine. You just need to be sure that you put the value into the global before reading it.
Another thing you may wish to look out for is trying to talk to the same instrument from 2 different VIs at the same time - I'm not sure what that will do. You may wish to use one VI for talking to the instrument and just call it from all your VIs - if it isn't reentrant, there should be no conflicts.

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(4,154 Views)
Hi,

I have tried creating a reference and working on to create a global variable. But i could not find any control related to "Instrument Handle Out" on the front panel of the global vi.

I do not have any multithreading programs. So i do not need any reentrant vi's for my application.

I just want to avoid initwithoptions, reset and the utility functions in every test program.

Regards,
Siddu
0 Kudos
Message 5 of 7
(4,151 Views)
You're not supposed to "find" the control. You're supposed to create it in your own VI and then copy and paste it in the global VI.
My other suggestion was a VI that manages the communication with the device. It has a while or for loop which runs once and an uninitialized shift register to remember what happened before. If needed, it reopens the communication. Every VI calling it will have to wait if another VI has already called it. My guess is that this is not needed, because the NI drivers already manage the IVI comm, so that there are no conflicts.

___________________
Try to take over the world!
Message 6 of 7
(4,149 Views)
Oops. I had some problem in the installation of IVI compliance package. So all the libraries were not loaded and when i tried to use them, i was getting all sorts of errors.

Thanks a lot for your help.

Regards,
Siddu
0 Kudos
Message 7 of 7
(4,140 Views)