04-23-2009 08:58 AM
Tzench wrote:The main program is not a loop. I've known the problem about dataflow since the beginning, and I thought the action engine could be a way around it. Could it be, if I use the case-structure?
I've been working a little with references, but I cant get the Control Refnum in the subVI to understand what it is supposed to refer to. Can anyone help me with this?
Hi Tzench,
You are "jumping from the frying pan into the fire" by abandoning the AE approach and trying to go with the control reference approach. I suggest you stop and get a good understanding of what we have been saying about using the AE in you application.
If you really want to ignore the AE and use another approach the take some time to study Ton's Nugget on Dynamic Event Registration found here.
Just trying to help,
Ben
04-23-2009 09:45 AM
04-23-2009 11:38 AM
In your ‘GetStopSwitch.vi’ put a loop round your LV2 vi – (put a small time delay in as well) connect the output of your LV2 vi to the Stop terminal of the loop. Now in your SetStopSwitch vi, connect the Stop switch to your LV2 vi and it will all work.
Run your SetStopSwitch once with false, this will initialise the LV2 vi. Now run the GetStopSwitch vi. This will continue running until you run the SetStopSwitch vi with the switch turned on.
04-23-2009 12:34 PM
Two tips for your AE.
1. No need to branch the boolean inside each case of the case structure. Just wire the indicator to the right hand shift register.
2. Use an Enum as your control rather than a ring. By doing this, each case of the structure can be identified by the action name rather than an arbitrary number such as 0 and 1.
04-24-2009 01:48 AM
04-24-2009 02:28 AM
Sorry, LV2 is your 'StopSwitch.vi.' LV2 is short for LabVIEW 2 – it was a method of providing Global Variable functionality before there were Globals in the early versions of Labview (before my time). They are still prefered over the built in Globals, you can find much discussion in the forum on this.
Your code looks OK but when I tried it with your earlier two vi’s it would not run. There was a mismatch with the Get/Set constant, there was a red dot on the terminal to show this. Change all your Ring controls to Enum, as Ravens Fan suggests (constants and controls) and the three programs work fine.
04-24-2009 02:43 AM
I din't really understand how the loop in GetStopSwitch is supposed to work. The conditional terminal is wired to the output of StopSwitch, which will only be TRUE if the stop-button is pressed. If the stop-button is not pressed you are stuck in the loop until it is. This means the main program will do until you stop it.
At the moment neither feature works. The program does nothing until it does not stop.
04-24-2009 03:12 AM
04-24-2009 03:38 AM
04-24-2009 05:05 AM