LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with register event callback in use of instrument control

now, i use the register event callback to register a value change of a boolean control on the front panel, and wire the cluster's ref of the instrument control parameters to the user parameter input, then create the callback vi. In the callback vi, i select the pump-control subvi, and pass the user parameter to the subvi. The problem is that,  when i press the boolean control, the instrument (here is pump) can act, but immediately, the code crashes.

I use labview 8.6

Download All
0 Kudos
Message 1 of 5
(2,713 Views)

I think you are getting terminology confused.

 

Register Event Callback is for handling calls to .Net or ActiveX objects (look at context help for the function.)  You have neither, and I think that is why you are crashing.

 

Since you are working with a LabVIEW object, you want to use Register for Events node.  Search the forums and help for "Dynamic Events".

0 Kudos
Message 2 of 5
(2,706 Views)

thanks for your reply!

yes, though it's useful for handling calls to .Net or ActiveX objects, i have see other examples with neither of them and the code doesn't crash.

And, as you said, if i use Register for event node, do i need to use Call By Reference Node to call my subvi?

0 Kudos
Message 3 of 5
(2,696 Views)

You would wire the event registration wire that comes out of the Register for Events node into an event structure.  You will need to right click on the event structure and check off "Show Dynamic Event Terminals" and it into that.  Then you can create a new Event Case that uses the dynamic event.  You can place your subVI in that event in whatever way you want.  (Just drop the subVI in or do a Call by Reference there, or whatever.)  Look in the Example Finder for "Dynamically Register for Events.vi".

0 Kudos
Message 4 of 5
(2,686 Views)

yes, i'll try it,thank you

0 Kudos
Message 5 of 5
(2,660 Views)