LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically called VI's meet VISA sessions / programming books

Hi all,

i am beggining to try to understand the capabilities of dynamically
calling VI's and have run into a little problem.

i am using a main program to control a signal generator by dynamically
calling other VI's. The "init.vi" is first called dynamically and opens
a VISA session and saves it into a GLOBAL variable. The main program,
can then call any other function dynamically, "frequency.vi" for example
will use the GLOBAL VISA session to set the siggen frequency. However,
this doesn't work. The 'init.vi' seems to pass normally, but when the
'frequency.vi' is called, it claims the VISA session is invalid (error
-1073807346). If the VISA session were to be opened in the main
program
tho and stored in the GLOBAL, "frequency.vi" will execute
without a problem.

Can anyone explain this strange behavior? Why does the VISA session
become invalid? Is it because when the dynamically called "init.vi"
exits, it unallocates any VISA sessions it has opened? Is there any way
to implement a similiar structure which will keep the VISA session
valid?

Where can i find more information on this topic?

Also, i am interested in your opinion on the books,

"LabVIEW Power Programming" by Gary Johnson.
"Advanced LabVIEW Labs" by John Essick.

What topics are they best suited for? Is there good reusable examples
and code in them? Are there other good, advanced LabVIEW programming
books, anyone could recomend?

Any help would be greatly appreciated,
joel
0 Kudos
Message 1 of 2
(2,514 Views)
Joel asked (paraphrased):
If a VISA session is opened in a dynamically loaded VI and stored in a global,
why does it become invalid when the dynamically loaded VI finishes? Is it
because when the dynamically called "init.vi" exits, it unallocates any VISA
sessions it has opened?

Yes.

Is there any way to implement a similiar structure which will keep the VISA
session open?

Maybe. Though I haven't tried it, there is a preferences selection for when
LabVIEW releases the VISA RefNum. Edit -> Preferences -> Miscellaneous ->
Automatically close VISA session . Make sure it is not selected. I am not
sure if this works for a built application or not.

I hope that this helps,
Bob Young
0 Kudos
Message 2 of 2
(2,514 Views)