LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an event driven counter

Hey all,

 

I'm writing a program that displays/records/reduces information from a DAQ. The way I have it set up is the user enters the desired number of data points to be taken as well as a recording interval (in seconds). Fresh data is compiled once per loop iteration (actual writing to text file step is skipped when the record button is false).

 

When the user turns the "record" boolean to true, it stops skipping the writing to text sequence and actually starts writing data. From there, it needs to start counting each loop iteration until the points desired=points taken. When that happens, the "record" boolean will change to false, which will end the recording iterations (going back to skipping the writing step) and reset the loop counter, which leaves me with a text file of all compiled data points. There is also a progress bar that is kind of off to the side to tell the user how far along in the test he/she is.

 

My problem is that when the "Record" boolean is false, the loop continues counting, which throws off everything.

 

I've tried shift registers, different loop combinations, and a bunch of other things with no luck. I have a attached the current verison of the program - the loop count indicator on the front panel is just there to help me see what was happening. The second one is the bigger program I am trying to implement the counter into. Hope you guys can figure this out. Thanks in advance for any input and/or help.

 

 

Chris

Download All
0 Kudos
Message 1 of 3
(2,924 Views)

You just wired to the wrong node.

 

 

Here it is cleaned up a bit....

24424iA1D685B33B342CDB

 

 

Couple pointers:

Locals = bad.  You were safe here but I replaced it w/ a property node that the snippet tool converted by adding a ref to the control. (Note the red !? to ignore errors in the node)

 

Use Default if unwired = bad.  Again, in this instance it did what you wanted but.....Its a bad habit to get into

 

Counts should be integer data types- 1++ as an int is always 1 more than the last int.  As a dbl the value 1 isn't so exact.  you would pull your hair out fixing the stop logic at high counts.

 

Initialize shift registers (unless you want the last value saved)  a UnInitialized Shift register will maintain the last value as long as the vi is in memory.


"Should be" isn't "Is" -Jay
Message 2 of 3
(2,905 Views)

Thanks Jeff! That worked out perfectly.

 

-Chris

0 Kudos
Message 3 of 3
(2,868 Views)