LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Reference Number from an User Event Refnum?

Solved!
Go to solution

Hi all,

 

I have an User Event Refnum. I want to get the reference number of the User Event. When I connect a probe, I am able to see the reference number. But I am unable to get it as an output.

 

Any ideas regarding how to get the Reference Number as an output.

 

Any kind of help is highly appreciated.

Thanks in advance.

 

0 Kudos
Message 1 of 11
(3,370 Views)

Type cast the ref to an I32?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(3,364 Views)

I don't think typecasting is working.

I have used I32 and the result is coming in negative. But probe output is a positive value.

0 Kudos
Message 3 of 11
(3,356 Views)

You could also try the Coerce To Type function.

 

But out of pure curiosity, why do you need the reference number?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(3,352 Views)

Hi crossrulz,

 

I am unable to find the coerce to Type Function .I am using labVIEW 15.

0 Kudos
Message 5 of 11
(3,347 Views)

Hi Deep,

 

here you find it for older LabVIEW versions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,340 Views)
Solution
Accepted by topic author Deep33

@Deep33 wrote:

I don't think typecasting is working.

I have used I32 and the result is coming in negative. But probe output is a positive value.


Well that is because a refnum is simply a magic cookie whose actual value has little meaning except to the LabVIEW context in which it was created. And as such LabVIEW tends to prefer unsigned interpretation for such values. So why not typecasting it to an unsigned 32 bit value if you don't want a sign?

 

Still you haven't answered the reason you want that, the numeric value of a LabVIEW refnum is completely meaningless to anyone but LabVIEW itself and also only in the LabVIEW application context in which it was created. The probe window has to somehow display a value and that is why it shows the numeric value rather than a long string of binary data that the underlaying object may contain to which the refnum refers to. What the actual object data is is totally private to LabVIEW and very different for different refnum classes.

 

Also there is no way to get at the interna of such refnums as they are not really pointers but magic cookies that refer to the data in a magic, LabVIEW private way.

Rolf Kalbermatter
My Blog
Message 7 of 11
(3,333 Views)
Solution
Accepted by topic author Deep33

cast it as a U32, not an I32

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 8 of 11
(3,328 Views)

@paul_cardinale wrote:

cast it as a U32, not an I32


Yes of course, my bad. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(3,299 Views)

Thanks all. U32 is working.

 

Basically what we are doing is LabVIEW-C interaction.Suppose when we want to speak from C to LabVIEW, C will Generate an user event that is registered in LabVIEW. So to Generate the user event, C has to know the User Event Reference Number.

This is just a brief idea about what we are trying to achieve.

 

Anyways, Thanks every one for your help. 

0 Kudos
Message 10 of 11
(3,259 Views)