03-16-2007 12:20 PM
03-16-2007 12:20 PM
03-16-2007 12:23 PM
03-16-2007 12:32 PM
The event loop will execute only once when an execution event happens. The while loop allows the event case to "reset" to look for another event.
Tom
03-16-2007 12:45 PM
@Nickerbocker wrote:
BTW: w/ does the event structure need to be inside of a while loop? I was looking at some examples and they have the event structure within a while loop which does not make sense to me. Do I have to poll my AO control in order to know when to execute the event structure?
No, an event structure does not need to be in a loop, but it would make little sense not to place it in a loop because it would only execute once per run. 😉
Create a while loop, place an event structure. Right-click on the event structure and select "edit events..." Select "AO setpoint...value changed". Now place your AO update inside that case. Use the event terminal to get the new value. Wire the error boolean output directly to the stop terminal of the loop.
(You should update AO once before the loop with the current setpoint, because the even will not run until the first time the value changes. Since you use the event terminal inside the loop, you can use the control terminal here. No locals needed).
Now right-click on the event and "create new event". Select "stop...value changed". Wire the new value to the existing output tunnel (from the error out n the other event) going to the loop stop terminal. (Look Ma, no local variables!).
Whenever the setpoint changes, the event fires and the AO updates. If the operation ends in an error, the loop stops. If stop is pressed in the other loop, the stop event fires and the loop stops. If none of these events happen, the loop is resting and you keep the same voltage on AO.
(You can also even remove all local variables and set the stop button to latch action!)
03-16-2007 12:57 PM
03-16-2007 01:03 PM
03-16-2007 01:19 PM
Easiest would be to just setup a queue. Write to it in one loop and read from it in the other.
@Nickerbocker wrote:
Can a FIFO only be used if I have the real-time module and only applicable to shared variables?
03-16-2007 05:45 PM
"It executes once and hangs at the event structure until something happens...right? "
Exactly ....
Unless you have a timeout event defined. In that case it executes if there are no other events in the time out period.
Ben
03-16-2007 05:48 PM