LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically calling IVI driver VIs

Hi,

SITUATION: I am developing an application in LabVIEW 6.1 that can use different signal generator models (>2). So depending on which of them is available in the system, I have to call different VIs. Moreover, I would like to be able to update the application without modifying the internal code if I want to add a new generator model.

I am trying to solve this problem with dynamic calls. I have developed a set of �generic VIs� for a �generic signal generator�. These VIs have an input called �model�, that controls which VIs will be really used to perform the operation (if model=5411, the VIs of the NI5411 driver will be used, if model=BK1051 the VIs of the Burel&Kjaer 1051 signal generator driver will be used, etc). Dep
ending on the generator�s model selected these VIs make a dynamic call to that signal generator specific VIs. Some signal generators have an IVI driver, but others don�t (example: NI5411 uses NI_FGEN, but BK1051 uses a standard VISA driver- GPIB bus).


PROBLEM: I have problems when I try to make dynamic calls to VIs of the NI-FGEN driver. When I call the �Initialize VI� everything goes right, the signal generator resets and no error is reported. But then, any other call that I try to make after this, generates an error. I have packed a simple example (a call to Initialize and then to Close) with the needed files, but it happens with any other function that I try to use after calling the Initialize VI. Can�t I make dynamic calls to an IVI driver? If, so, how can I solve this problem?

I also include a JPEG file with the LabVIEW error output.

Can anyone help me on this? I don�t know how to solve this problem. Thanks a lot.
Download All
0 Kudos
Message 1 of 2
(2,612 Views)
Hi Garcas,

I believe your problem is that you close the VI reference to the dynamic VI in the "Open sesion.vi" and "Close sesion.vi". When you do that, the dynamic VI gets unloaded from memory and LabVIEW garbage collects the instrument handle and thereby makes it invalid and there is an error in "Close sesion".

The solution is to keep all the VI server reference open until you have closed the the instrument handle (in other words keep the dynamic VIs in memory).

You may test if this is the problem in a quick and dirty way, just remove the "Close VI reference" in "Open sesion.vi" and "Close sesion.vi". If it works then you have found the problem and may implement a better solution where you close the VI references in a more controlled way.

The be
st advice that I can give you is to create a GOOP class to keep track of all the reference and then close them all at the end in the Destroy method (destructor). This solution would definitly be my way of solving the problem.

Regards,

Mattias Ericsson
Endevo
www.endevo.com
0 Kudos
Message 2 of 2
(2,612 Views)