08-19-2008 04:33 PM
Hello, I am new to event structures and so far have been using them in conjunction with a while loop. Currently I have written simple programs that wait for a front panel control to change value before execution code inside the event structure. My question is, should I place a timer outside the event structure and inside the while loop to periodically check for the front panel control change? I want to save resources as much as possible, and am not exactly sure how draining it is to have the while loop outside constantly executing (if it is executing?) while the program waits for the event structure to execute. Perhaps there is a better appraoch to take? Thanks!
08-19-2008 04:39 PM
Hello,
It sounds like you are doing things correctly. You will see on the upper left of the event structure that there is a timeout variable that you can wire up. If you wire -1 (the default) the while loop will only execute when an event is triggered (you can verify this by throwing an indicator on the interation count of the while loop). In effect, the event structure acts like the wait function that you will asking about. Ask more questions if they come up!
08-19-2008 04:53 PM
08-20-2008 04:37 PM
Hi Newbie217,
If you want to know how long an event runs you can use the Tick Count function and place two--one before and one after the event. Please refer to the example VI, Event Tracking.vi to get a better idea of how this works. The Tick Count function does not have an absolute zero reference and so you need to find the difference between ticks to get the time elapsed.
Ipshita C.