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: 

How to get the refnum (i.e. in hex) of a reentrant VI for calling it by reference

Solved!
Go to solution
Hi,
 
When I compare 2 refnums (using the Equal function), both coming from a reentrant VI, the result depends on the rest of the execution.
See attached file:  LV question1.jpg
The probes say the refnums are different but the round Led  says they are equal !!!
How can I get the probe's value ?
 
If I add a copy of the code, and only modify the next step of the seconf refnum, and run the VI continuosly, the round Led blinks (on and off) meaning there appear some race conditions not solved. How to do it ?
See attached files:   LV question2.jpg  and source code in LV 8:  LV.zip  (where Main.vi calls the subVI SupportFile_Reentrant.vi).
 
Thank you,
Guillermo
Download All
Message 1 of 14
(4,229 Views)
I am not sure if I quite understanding you completly but I think I have run into this problem before.  What I would suggest is to reinitialize your LED on the front panel to its dimmed default mode by clicking the 'reinitialize to default' under the edit tab.  Run the program once.  Did it light up?  What i think you will notice now is that the LED is still lit up so if you run the program again, it's always going to be lit up.  What you want to do is have a way to restore the LED to it's default value (dimmed i'm guessing?) after the program is finished executing.  You can do this using a property node and setting the parameter to 'reinit to default' i believe it is called.  See attatched file for reference.  hope this helps!
0 Kudos
Message 2 of 14
(4,210 Views)
You can type cast them to I32s and compare the refnum values as numeric values. Those will be distinct.
Jarrod S.
National Instruments
0 Kudos
Message 3 of 14
(4,207 Views)

Adding to what Jarrod said,

Page 58 of the LV Upgrade notes says.

 

The

Comparison functions have the following improvements and

changes:

• The Equal? and Not Equal? comparison functions can determine

whether two VI Server references refer to the same object.

Jarrod,

Should the type cast be to a U64 in LV8?

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 14
(4,202 Views)
Solution
Accepted by topic author GuillermoP

As far as I know, references are still based on U32 values in 8.0.  I'm speculating, but perhaps that will change once 64-bit OSes become ubiquitous.

-D

Message 5 of 14
(4,190 Views)

The max value for a reference seems to be xFFFFFFFF, so I believe U32 is the datatype for LabVIEW 8 refnums. U64s can't be typecast into refnums or you get all zeros.

[Darren beat me to it. 🙂 ]

Message Edited by Jarrod S. on 07-27-2006 03:14 PM

Jarrod S.
National Instruments
Message 6 of 14
(4,188 Views)
OK,

there is a workaround, but a workaround implies a bug!

So my question is, is this a bug or not. At least the result is not consistent!

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 7 of 14
(4,176 Views)
One other question, does 'open vi reference' always returns a new reference, cause right now I get a different reference (in Hex) for the same VI..

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 14
(4,167 Views)

Type casting with U32 solved the problem, thanks!

In fact, I found a different way that is to compare not the VI refnums but a Control refnum on the Front Panel of the reentrant VI.

Thus, continuing on this topic (and the opened discussion about being or not a bug), find attached a LV 8 file (LV2.zip with Main2.vi and SupportFile_Reentrant2.vi). Here, if I do NOT type cast the VI reference to the VI refnums, the Equal? result will be different. However, if I compare a Control refnum created into the subVI, it DOES work (without any need of type cast).

Regards,

Guillermo

0 Kudos
Message 9 of 14
(4,160 Views)

hi,

 

can U save Ur VIs for LV 7.1 & repost pls... ?

Regards,

Partha.

- Partha ( CLD until Oct 2024 🙂 )
Message 10 of 14
(4,136 Views)