LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a value to an event structure in a subvi

I have created a control block for a programmable powersupply. If a value is changed on the Labview interface an event is triggered and a command with the value is send. I want to put this in a subvi, so that  when a new value is send to the subvi it then sends the command. I found an example here to deal with events in subvi's: http://digital.ni.com/public.nsf/allkb/A882E27D1D7A949386256E0D0066B91A?OpenDocument

But sending the value allong is not covered. The 'Newval' option in the event seems not to be working..

0 Kudos
Message 1 of 9
(3,395 Views)

Post your code because what you are trying to do could be interpreted a couple ways.

 

Depending on what you are asking you might be able to get away with just using the Value Signal event.

0 Kudos
Message 2 of 9
(3,391 Views)

I also get an error if I try to use the subvi in a main vi. 'Error 1027 occurred at Register For Events in PowerSupplyControl (SubVI) v2.vi->Untitled 13'

 

The main vi should send a new value to the subvi. The subvi should detect the value change, generate an event and send the new value to the power supply.

 

 

0 Kudos
Message 3 of 9
(3,382 Views)

Well, you actually have to pass in a valid reference to the control you want to respond to events on!

Capture.PNG

Your control reference inputs are NOT EVEN ON the connector pane!  Therefore their values are "invalid reference".  It won't work out quite right that way! Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 9
(3,372 Views)
Why aren't you simply detecting the value change in the main and passing the value to the subVI? Your approach seems way to complicated.
0 Kudos
Message 5 of 9
(3,371 Views)

I would suggest an Action Engine.  Here you can use the event structure in your top level, and then call this VIG when events happen.  What you are trying to do likely won't work well because you are registering for an event change, then have a timeout.  You will only see new events on that control ref from after the register to when the timeout happens, so you have a 100ms window which is going to be a problem. 

0 Kudos
Message 6 of 9
(3,366 Views)

In response to

Well I have 5 power supplies and I want to monitor the current output. So I have a subvi which runs on its own and reads the current in the timeout.

0 Kudos
Message 7 of 9
(3,359 Views)
Your response does not seem to have anything at all to do with your question about a control value change event.
0 Kudos
Message 8 of 9
(3,337 Views)

I looks to me that your subVI should have a loop in it.  It should be completely in parallel with your main control.  I would recommend using a queue to send the commands to this parallel process and then use User Events to update your GUI.  You main VI would have the event structure to respond to the value updates and send the commands to the new loop.  It would also be registered for your user events in order to update the indicators.


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
Message 9 of 9
(3,322 Views)