Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting DAQ count to zero

Hello all,

 

I am creating a simple program that counts signals using a DAQ 6602 card, turned into counts per second.  I have everything working fine, but what I need to do is reset the counter to zero each time it loops through.  What I am currently using is a shift register to carry the value of the last iteration into the new one to subtract to give me the designated value.  What I'm worried about is that if I end up taking measurements over a long period of time, and the number of events measured per second is going to potentially be in the millions, is an overflow on the DAQ card.  So, what I am wondering is if there is any way to reset the counter to zero without stopping and restarting the card each time.  I tried this, but it seems to create too much of a delay to have it work efficiently.  I tried looking through some of the property nodes to find something, but I didn't have much luck finding anything.  Any help would be much appreciated.

 

Thanks,


Dan 

0 Kudos
Message 1 of 5
(9,304 Views)

Hi Dan,

 

One thing you could do is to configure a Period Measurement task:

 

 2010-05-12_174710.png

 

You could read back the period in terms of timebase ticks so this would be equivalent to edge counting with a HW-triggered reset. 

 

I'm not sure what your exact application is, but you could use one of the other counters to generate a fixed frequency pulse train and count the number of events that occur during each period of the signal.

 

 

Best Regards,

 

John

Message Edited by John P on 05-12-2010 05:53 PM
John Passiak
0 Kudos
Message 2 of 5
(9,302 Views)

I am using this to count ions, from pulses generated by a daly detector, for a mass spectrometer.  It doesn't need to be too fancy, really, but since I may be counting millions of ions at a time, if I let my program run for so long, I'm afraid it may overflow.

 

I am still sort of new at using LabVIEW, how would I go about doing what you have suggested?  If I am understanding what you are describing, this would allow me to have another counter to create my period of time to make measurements, then the buffer is erased after each iteration.  Is that correct?  Because that sounds like it could be a fix to what I am trying to do.

 

Right now, I'm using the DAQmx vi's.  I have the Create Channel and Start Task vi's outside of my while loop, with the Read vi inside, and Clear Task at the end, outside the loop.  This set up is very similar to the Counting Digital Events.vi example that came with the program, except I have included a user input for the period.

 

 

Dan 

Message Edited by dmatthew on 05-13-2010 01:03 PM
0 Kudos
Message 3 of 5
(9,283 Views)

Hi Dan,

 

I was thinking something like the attached code for the acquisition task.  It's not quite as straightforward as running a shipping example but it should get the job done.

 

 

HW_Triggered Count Reset.png

 

 

The source of the reset signal could be any number of things:

1.  Counter Output (HW Timed)

 

2.  Static Digital Output (SW Timed)

 

3.  Any External TTL Signal

 

 

Best Regards,

 

John

 

 

*Edit--the Implicit timing means that the data will be clocked-in after each reset--you can read the buffer back if you wish by calling DAQmx Read (you can manually set the buffer size with DAQmx Configure Input Buffer.vi).

Message Edited by John P on 05-13-2010 02:51 PM
John Passiak
Message 4 of 5
(9,271 Views)

I re-read your original post and it sounds like you want to measure counts per second.  If so, you could replace the Property Node inside the loop with DAQmx Read (1 sample).  You would use another counter to generate a 1 Hz signal to use as the "Reset" signal.  This signal is what latches the value of the counter to your software buffer (due the Implicit timing configuration).

 

For the counter output code, I would start with the shipping example called Gen Dig Pulse Train-Continuous.vi

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 5
(9,264 Views)