LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure in Timed Loop

Solved!
Go to solution

Quick question about timed loops\event structures

 

Is it a good or a bad idea to use Event structures in timed loops - as opposed to while loops.?  I guess I like the idea of timed loops - since you can set their priority - so if there is important stuff you need 100% priority in the background - but for ui you can set it to run slower\or run at a different priority level.

 

Just wanted to check there isn't a reason why i shouldn't be doing this - since all the examples don't do this.

 

JP

0 Kudos
Message 1 of 5
(3,387 Views)

It wouldn't make sense to put an event structure in a timed loop unless the event structure had a timeout. That will cause a switch to the UI thread. You probably don't want any code in your timed loop to run in the UI thread.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 5
(3,378 Views)
Solution
Accepted by topic author wideofthemark

I don't think this is a good idea. Your timed loop can stop completely waiting for an event. There is no benefit of placing the event structure in a timed loop. It is possible to assign priorities to other objects besides timed loops. For instance, you can assigned priorities to subVIs. I'm reasonably sure that the event structure can run at other priorities provided you are not doing any UI activities. Perhaps someone from NI can confirm this.

 

But the purpose of a timed loop is to have a deterministic periodic task. The event structure should be used for asynchronous events. The two are at odds with each other if they are in the same task.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 5
(3,371 Views)

@wideofthemark wrote:

Is it a good or a bad idea to use Event structures in timed loops


bad.  +1

0 Kudos
Message 4 of 5
(3,352 Views)

Thanks everyone for the advice.  I guess I understand things better now - I think you are right that it doesn't make sense to have the two things together - although I have to say it doesn't really seem to have made a significant difference to how anything is running at the moment in my code.

0 Kudos
Message 5 of 5
(3,304 Views)