LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is an event structure right?

Hi,
 
   Is the event structure right for what I want to do?
   I have three buttons. When I click Button # 1 this will start a seconds counter (runs until Button # 3 is clicked) Button # 2 will put the current time in an indicator. Then button three is clicked to stop the seconds timer I started with Button # 1 (Button # 1 will have a timeout so it doesn't run forever. Around 1  - 5 minutes Max). So I need to know if a user event structure is going to work for this or is one of the other Labview structures more appropriate for this problem?
   If the event structure would work (I am thinking this would be a better approach for CPU management on an older 933MHz machine). If I am mistaken please let me know. Also if it (event structure) is usable a piece of code demonstrating how I would get it to work would be greatly appreciated.
 
Many thanks in advance!
Charlie
Everything is Free! Until you have to pay for it.
0 Kudos
Message 1 of 25
(3,901 Views)

Sounds like an event structure would be perfect. An event for each button, and a timeout event to service the timer--and you're done.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 25
(3,875 Views)
Here is some code that does what i think you need
0 Kudos
Message 3 of 25
(3,866 Views)

Thanks for the reply.

Charlie

Everything is Free! Until you have to pay for it.
0 Kudos
Message 4 of 25
(3,858 Views)
Hey BrianPack,
 
   This is close however, I need the timer in a loop (I am going to show seconds counter i.e. 1,2,3,4,5,6... etc.) and I need to have it rund until timeout or stop is clicked? If you could help me expand your code to accomodate that functionality it would really help.
 
Many thanks,
Charlie
Everything is Free! Until you have to pay for it.
0 Kudos
Message 5 of 25
(3,848 Views)
Charlie,
 
So you want the timer to keep running and updating until timeout or button push?

Brian
0 Kudos
Message 6 of 25
(3,844 Views)

Brian,

Exactly right....

Charlie

Everything is Free! Until you have to pay for it.
0 Kudos
Message 7 of 25
(3,840 Views)
I assumed you don't need button number 2 that you described then if the indicator is free-running.  Does this look about right?
 
Brian
 
Message 8 of 25
(3,834 Views)

Charlie,

Also, you may want to add a little wait (like 50 milliseconds) in the while loop inside case 1 to reduce cpu utilization if it is using to much cpu cycles.

Brian

0 Kudos
Message 9 of 25
(3,833 Views)

Actually I will be using the second button, because when I click it I want the time stamp put in a seperate indicator, but this is very close and I appreciate your help!

 

Thanks Very Much,

Charlie

 

P.S. I will add the 50ms to the while loop. Thanks!

Everything is Free! Until you have to pay for it.
0 Kudos
Message 10 of 25
(3,819 Views)