10-22-2010 11:46 PM
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
10-23-2010 12:10 AM
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".
10-23-2010 01:48 AM
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?
10-23-2010 09:47 AM
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".
10-24-2010 07:46 PM
yes, i'll try it,thank you