LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

usign a several event structure block inside a loop

Hello!
 
I've divided all my application in several event structure block. In this way each block runs only when a variable of this block has changed. All this blocks are inside a loop, that run continously. When I start to simulate there's no probem, but after an event strucuture runs (the first one), the panel front turns to lock.
 
All the envent structure block has no tick "Lock front pantel until the event case for this event completes".
 
I don't know what it happens?
Someone knows what i have to do?
 
Thank you very much!
 
Larson
 
0 Kudos
Message 1 of 8
(3,514 Views)
It sounds like you are using several event structures in parallell inside one while loop. That is asking for trouble.. I think you are experiencing that the while loop doesn't loop, because one or more of the event structures inside the loop do not time out and the one event structure that did execute becomes inactive.
The solution is to stack as many events as possible in one event stucture. If you can't do that, you can have the event structures time out regularly (say every 100 ms) or use multiple while loops as well.
Hope this helps.
0 Kudos
Message 2 of 8
(3,510 Views)

Hello again,

several event structures run in parallel, i cannot join more code in the same event structure. All of this event structure has a 100ms timeout and no one has ticked the option "lock the front panel until the.....". It doesn't care the first block runs,,,,,,,after this action,,,,,the front panel turns block.

 

Do you think it's a good solution to make a while loop for each event structure??

 

Thanks

0 Kudos
Message 3 of 8
(3,507 Views)
You do know you can stack events in a structure, I assume.
I think you may find the problem quickly when you use "highlight execution."  Do you have only one while loop? It sounds like you may have the a situation where the event while loop terminates (by error or something), but the vi does't terminate, because of another loop. Also you may have an infinite loop somewhere in your code, maybe in one of the events as it executes. Wire the while loop iteration node to see whether the loop actually runs 10 times a second (which it should if all events time out at 100 ms).
0 Kudos
Message 4 of 8
(3,502 Views)
Larson:  Why can't you add more events to the same event structure?  Use one event structure and add several events.  This is the proper way to use the event structure.  Just right click on the structure's border, select Add Event Case, and choose the control and action you want for the event.  An event structure is like a case structure in that you can have many cases inside one structure.  Your code in each case is completely independent of other cases.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 8
(3,481 Views)

Hello Tbob,

I think it's a good idea to make only one event structure but it's possible to run at time two cases......i have some code that have to run at time......or it's better to stack this code in the same event case??

 

Thank you again

 

Larson 

0 Kudos
Message 6 of 8
(3,466 Views)
Also you can consider having multiple events in one event case, although it is a feature I don't use often myself. Again: do try to stick with one event structure if you can.
0 Kudos
Message 7 of 8
(3,459 Views)

ok!

 

I'll try to do it! Thank you very much!

 

Larson

0 Kudos
Message 8 of 8
(3,450 Views)