04-07-2016 12:35 PM
@RavensFan wrote:I wouldn't go that far.
Yeah I think we more or less agree. When done right multiple event structures (in separate loops) can be a fine tool. But if I see a random VI with two event structures in it, historically there is a 90% chance it is doing something wrong. So just giving a blanket statement like "Don't do it" fixes those 90% issues, and in the 10% cases we end up having conversations like this.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
04-07-2016 12:44 PM
So how do you handle thesituation where it take to event to make something happen. as an example , this ps require you to push the shift key then let say local which toggle the ps channel being displayed. I tried with 2 different keys in the evenrt structure but that dont work.
04-07-2016 12:51 PM - edited 04-07-2016 01:05 PM
@RavensFan wrote:You have an event structure inside of an event structure. Bad, bad, bad.
Why is there a timeout event? Why is there a 1000ms wait in the upper left? Why can't the VI be stopped?
Basically, you are queueing up an infinite number of events in the inner event structure until shift is changed. At which point, the oldest event can execute until shift is changed again. Each of the inner event is still set to lock the front panel, so you cannot change "shift" and the event queue can never be emptied. Even if you unlock all events, things will not work right.
For example, if OVP is changed, both the inner and outer event structure queues up the event, but the inner one cannot react and thus will lock the panel forever.
What you need to do is use a single event structure. You can keep the shift state in a shift register and modify the triggered execution accordingly.
You can even eliminate the outer case structure by placing the display code inside the timout event. Set the timeout to infinity (-1) in the timeout event and to a small value inside all the other events (also via a shift register, of course).
Also, all you latch action booleans belong inside their respective event case so they properly reset to the default state once the event has been triggered. You currently have them aligned ouside any structure, so they get read only once when the program starts. This means the latch action will never work, i.e. they will never reset.
04-07-2016 01:00 PM
ok got it . Thanks everyone for the feed back.