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
(1,460 Views)

Type cast the ref to an I32?

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(1,454 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
(1,446 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
(1,442 Views)

Hi crossrulz,

 

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

0 Kudos
Message 5 of 11
(1,437 Views)

Hi Deep,

 

here you find it for older LabVIEW versions…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 6 of 11
(1,430 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
Averna BV
Message 7 of 11
(1,423 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
(1,418 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! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(1,389 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
(1,349 Views)