From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Refnum Example

Hi,

I'm looking for some basic examples using VI Refnum controls.
Basically I'm interested in Opening and closing VI's using its Refnum
instead of its path.

Thanks


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 1 of 5
(3,237 Views)
regislee@my-deja.com wrote:

> Hi,
>
> I'm looking for some basic examples using VI Refnum controls.
> Basically I'm interested in Opening and closing VI's using its Refnum
> instead of its path.
>
> Thanks
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

you can find some examples in labview/examples/viserver/dynload.llb

As far as I know you must still use the path to the VI to create the VI
refnum.
0 Kudos
Message 2 of 5
(3,237 Views)
In article <390F7244.43AB7001@usa.alcatel.com>,
"Kevin B. Kent" wrote:
> This is a multi-part message in MIME format.
> --------------DA2BD2026037D62EFDEB5A6E
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> regislee@my-deja.com wrote:
>
> > Hi,
> >
> > I'm looking for some basic examples using VI Refnum controls.
> > Basically I'm interested in Opening and closing VI's using its
Refnum
> > instead of its path.
> >
> > Thanks
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> you can find some examples in labview/examples/viserver/dynload.llb
>
> As far as I know you must still use the path to the VI to create the
VI refnum.


OK...once you've used the path once to
create the VI refnum, how do
you use the refnum access a certain VI?

For example. I have a main VI that calls and opens or closes 3 other
VI's using VI Server functions...So once I open a VI using the
following,

(pathnameA)---(OpenViReference)---(FrontPanel.Open=True)

how do I go about referencing the opened VI so as to manipulate it
(eg. to close the VI)? Right now, I'm close the VI's using:

(pathnameA)---(OpenViReference)---(FrontPanel.Open=False)---(CloseVIRef)

As you can see, I'm using the same pathname to close a VI that's
already opened and has a refnum associated to it. Does that mean I've
now created two refnums to the same VI?

This is what I've been trying to do:

(refnum to PathnameA)---(frontpanel.open=False)---(CloseVIRef)


Also, Using this method of Opening and closing VI's, I seem to be
getting errors when opening the VI's the second time around. (Error
1000 I believe. It mentions something about the VI not being in a
proper state)

BTW, when I tried runn
ing dynload.llb, many of the vi's are not
present on my machine. any suggestions?

Thanks,

Regis



Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 3 of 5
(3,237 Views)
......open a VI using the following,
>
> (pathnameA)---(OpenViReference)---(FrontPanel.Open=True)

I've found out that the above line is not entirely correct. The error
I was getting (see below) was due to the fact that I didn't place
(CloseVIRef) at the end of the code above....So now I open a VI using:

(pathnameA)---(OpenViReference)---(FrontPanel.Open=True)---(CloseVIRef)


> Also, Using this method of Opening and closing VI's, I seem to be
> getting errors when opening the VI's the second time around. (Error
> 1000 I believe. It mentions something about the VI not being in a
> proper state)



Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 4 of 5
(3,237 Views)
regislee@my-deja.com wrote:

> .....open a VI using the following,
> >
> > (pathnameA)---(OpenViReference)---(FrontPanel.Open=True)
>
> I've found out that the above line is not entirely correct. The error
> I was getting (see below) was due to the fact that I didn't place
> (CloseVIRef) at the end of the code above....So now I open a VI using:
>
> (pathnameA)---(OpenViReference)---(FrontPanel.Open=True)---(CloseVIRef)
>
> > Also, Using this method of Opening and closing VI's, I seem to be
> > getting errors when opening the VI's the second time around. (Error
> > 1000 I believe. It mentions something about the VI not being in a
> > proper state)
>

You can use the VI Refnum just like any other object in Labview.
You can pass the ref
num around with a wire and / or send it out
of the VI on the connector pane. Using your flow above:

(pathnameA)---(OpenViReference)---(FrontPanel.Open=True)--->
--- (Do some work somewhere)------(FrontPanel.Open=False)----- (CloseVIRef).

Once you open a refnum you must close it. If you open multiple refnums you
must
close them ALL.

If you have ever worked with VISA sessions, then this is the same thing.
Kevin
0 Kudos
Message 5 of 5
(3,237 Views)