05-12-2010 05:18 PM
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
05-12-2010 05:52 PM - edited 05-12-2010 05:53 PM
Hi Dan,
One thing you could do is to configure a Period Measurement task:
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
05-13-2010 01:02 PM - edited 05-13-2010 01:03 PM
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
05-13-2010 02:48 PM - edited 05-13-2010 02:51 PM
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.
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).
05-13-2010 03:07 PM
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,