LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Confused about Event structure..

Hi,
I am a new LV developer. I have a problem with my Event structure. Basically, I have multiple check boxes which are  driving the Disable property of other numeric indicators.  They worked fine before I included an Event structure. In the Event stucture I am processing the event from the stop button which works fine.  This is the only event I am processing in  the Event structure. But I noticed that my check boxes stoped driving the Disable properties, an other numeric controls stopped driving their respective meters. I am very confused about that and could not figure out the reason why my event structure affects other controls which are not included  for processing in that Event structure.  I have included the block diagram.  Please help. Thanks.


Ruslan S.





Message Edited by RSibagatullin on 05-23-2008 04:04 PM
Download All
0 Kudos
Message 1 of 16
(3,321 Views)
You might want to edit your post to include the block diagram or post a new comment with it.
 
A quick thing you might want to check is do you have the event structure set to time out?  If not, there is probably your problem, the event structure is being entered, but is never being triggered since it only will trigger on Stop button.
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 2 of 16
(3,315 Views)
Thanks. I added  200 ms  to time out and everything started to work properly.  Could you explain a little bit  more why it started to work and what was my problem? I don't quite understand what does timeout really mean. Thanks.

0 Kudos
Message 3 of 16
(3,297 Views)
Basically, the Event structure is a 'Wait until something happens' case statement.  So when the program flow reaches it, it will wait until a registered event occurs.   Registered events are those events you have cases for, in your case (pun not intended) the only registered event you had was the Stop button being pressed.  Since the other buttons, checkmarks, and numerics were not registered with the event structure, it ignored them, and kept on waiting.  LabView btw, did not ignore them, but can't read them until the Event structure stops pausing and the program flow reaches the control to read it.  When you added the timeout value to the event structure you are telling it, 'If nothing happens in <x> miliseconds, stop waiting and move on to the next item in the program flow.'.  You are in essence, creating a Clock Event in the event structure that fires every <x> miliseconds after the Event structure is reached.
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 4 of 16
(3,289 Views)
oh  ok. Got it. Thanks.

0 Kudos
Message 5 of 16
(3,286 Views)

Ruslan,

From looking at your block diagram, it looks like you have all your controls outside any kind of program control. Labview needs to be speicficaly told when data will be modified or it will choose randomly what happens first, second, etc. Right now your code will happen in a random order, and will only read whatever value was there when you pressed the Run Button. When Labview gets to the Event Structure, it will wait for an Event Case to be triggered, process the Event, then the program will stop (regardless of what Event was triggered). My suggestion would be to place a While Loop down, put the Event Structure in the While Loop and wire the Timeout Terminal to some value (in miliseconds), then put all your other code in the Timeout case of the Event Structure. This will keep the program running until the While Loop is stopped and will read/update all controls/displays every time the Event Structure times out waiting for an event.

 

0 Kudos
Message 6 of 16
(3,284 Views)
It would make an awful lot of sense to put all of your front panel controls in their own event. When you have them outside, you are polling them and that's just a waste of cpu.
0 Kudos
Message 7 of 16
(3,280 Views)
Dennis,
Do you mean  to allocate one event structure for each checkbox? I thought I read somewhere not to use simultaneusly more then one event structure per program. As if right now I just make a right click and ad one new even in the the same one  event structure.

0 Kudos
Message 8 of 16
(3,256 Views)
No, not a separate event structure for each control. A separate event in the single event structure that you have.
0 Kudos
Message 9 of 16
(3,247 Views)
Steven,
I was not able to include my whole code because it occupies already more then one screen thats why I was unable to show that I have one big while loop which contains my Event strcuture.
For everyone,
By the way I read on this website that the code has  to be not bigger then one  screen size otherwise it has to be broken down in subVI's. My question is how do I break up my code if I am only building the user interface at this point (see pictures)? Can I break up into subVI's the GUI?
Thanks.



0 Kudos
Message 10 of 16
(3,243 Views)