LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keep a vi open after an event is finished...

Hi all,
I've got a problem with the event structure. I have a very simple vi with just three cases. This vi should be an overview where I can go to the different subvis. If these subvis are closed I want to return to the vi with the event structure. Therefore I first made a while loop, but this was always running and causing a cpu usage of 100%. So I tried the event structure and it worked quite good. The problem is now that if I press the button the subvi opens, but the event structure stops running. So if I go back tpo that vi it not running any more. I wanted to tell the event structure that after opening an event it should wait for the next event. But I don't know how to do that. Thx for your help...
Greets Thomas
0 Kudos
Message 1 of 5
(2,622 Views)
Hi,

I don't know if I really understand your problem, but the event structure is not a loop, so it won't wait for the next event. You need to have a while loop "around" your event structuer, so the program will come back after an event occur.

Hope this helps,
Paulo
Message 2 of 5
(2,618 Views)
Hi Thomas,

like PauloM said, you have to use a while loop around your cases.
To prevent of 100% cpu usage you have to place a "wait until next ms multiple" (or another wait block) inside the loop and connect a constant with a value of 100 (for 100ms for example).
If you run a while loop without a wait block, the cpu tries to run this loop as often as it could.
To understand better you can look at the while loop examples.

Greets
0 Kudos
Message 3 of 5
(2,605 Views)
Hi Watermann,

I thought that if we have an event structure in a while loop (mainly if the timeout is not wired) we wouldn't need the wait.
Does the event structure consumes resources while it is waiting for an event to happen?

Cheers,
Paulo
0 Kudos
Message 4 of 5
(2,597 Views)
Hi,
thx for your help. I think Paulo is right. I just made a while loop and now it is working with 0% CPU usage. That's exactly what I wanted.
Greets
0 Kudos
Message 5 of 5
(2,593 Views)