LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can you reset the counter on a USB-6009 within a timed loop

I have a USB-6009 and want to reset the counter after every read within a timed loop so that I can read the frequency of a pulse train.   Currently the counter only resets on startup and then continually counts up.
0 Kudos
Message 1 of 6
(3,295 Views)

Hi Michael-

The only method to reset the count value using your USB-6009 is to stop and restart the task.  This will reinitialize the counter value to the initial count value you have specified previously.  If the overhead of stopping and restarting the counter is unacceptable for your application you may consider simply maintaining the counter value from the previous iteration (by a shift register or other method) and simply subtract the two counts from one another.

Hopefully this helps-

Tom W
National Instruments
Message 2 of 6
(3,289 Views)
The overhead is too large and I tried subracting current from previous but you cannot use register save in a timed loop.  Local / global variables do not work either. I have yet to find any way of successfully saving the results of the last itteration. 
0 Kudos
Message 3 of 6
(3,281 Views)

Hi Michael-

I do not have any problem with using shift registers in timed loops.  What version of LabVIEW are you using?  Can you please elaborate on why neither shift registers or local variables meet your needs?  I have attached a VI that saves a previous iteration and then computes and displays the difference.  Let me know if you have problems running it.

Thanks-

Tom W
National Instruments
Message 4 of 6
(3,273 Views)
Thanks for your help.  You are right.  I was not using the shift registers correctly (reading all the documentation helps).  It works now.
0 Kudos
Message 5 of 6
(3,256 Views)
Hi Michael-
 
Glad to hear it- please let us know in the Multifunction DAQ Forums if you have any additional questions.  ThanksSmiley Happy
Tom W
National Instruments
0 Kudos
Message 6 of 6
(3,241 Views)