LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

beginner needs help with simple task

Hi folks,

I'm just getting started learning LabVIEW.  In the VI I'm making, I'm trying to count the number of times a button is pressed (see attachments).  When the button is in the True state, the Cycles Counted value is incremented.  But when the button is in the False state, how do I make the Cycles Counted value unchanged?

Thanks,
Eric


Download All
0 Kudos
Message 1 of 6
(3,041 Views)

Well you are close but you can do away with the for loop and just have the +1 in a case statement like you already have then put a while loop around the whole thing and use a shift register to keep the value. Also be sure to wire the false case all the way thru because as you have it right now when the case is false it outputs the default value which is zero. I will try to provide an example for you tomorrow.

You can find some good examples of this in the example finder.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 6
(3,013 Views)
Thanks for the help!  I tried to find something in the example finder, but I didn't know what words to search.  I used "counter" and "count", but I didn't find anything like what I am trying to do.

-Eric
0 Kudos
Message 3 of 6
(3,004 Views)

Here is a really simple VI. The count boolean is set to latched when pressed.

 

Message Edited by Jhoskins on 04-04-2007 08:40 AM




Joe.
"NOTHING IS EVER EASY"
Download All
0 Kudos
Message 4 of 6
(2,979 Views)
Thanks for the example.  Is it possible to turn that into a sub-VI?

-Eric
0 Kudos
Message 5 of 6
(2,960 Views)
When you use it as a subvi it will be inside a loop therefore it will only return control to you parent vi when it exits the loop.  One way to do this is in a parallel loop using events that are triggered on the button press
- James

Using LV 2012 on Windows 7 64 bit
0 Kudos
Message 6 of 6
(2,954 Views)