11-24-2014 09:43 AM
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..
11-24-2014 09:47 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-24-2014 09:54 AM
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.
11-24-2014 10:02 AM
Well, you actually have to pass in a valid reference to the control you want to respond to events on!
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!
11-24-2014 10:02 AM
11-24-2014 10:03 AM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-24-2014 10:07 AM - edited 11-24-2014 10:09 AM
In response to Dennis_Knutson (it is not possible to quote on this board?)
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.
11-24-2014 10:22 AM
11-24-2014 11:31 AM
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.