Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

counter roll-over creates "spike"

Hi,

I have two 6024E cards which I am using to count pulses from 3 particle counters using DEV1 GPCTR0 and GPCTR1 and DEV2 GPCTR0. I am using a hardware timed loop. The problem is when the counters reach 2^24 a "spike" occurs in the data because of the shift registers I use and the subtraction needed to get the "counts per period". Can someone suggest a way to prevent this "spike" at roll-over time? Another shift register? Monitor counts?

Thank a lot,

Dwane
0 Kudos
Message 1 of 5
(3,733 Views)
Sorry, can't look at the vi now -- my network PC is far from my LabVIEW PC.
 
1. What data is most important to you: counts per interval?  Or cumulative counts?
If counts per interval matters most, and you have a hw signal available to hw-buffer the measurement, then you could configure for buffered period measurement.  Then the hardware measures only the counts per interval, sort of like performing the subtraction for you.  If when you also need cumulative count data, it's fairly simple to perform a cumulative sum.  If the sum can overflow a 32-bit datatype, then convert to floating point for the summation.
 
2. If cumulative counts matter most, you'll need a little software logic to detect and deglitch those spikes.  Basically, anytime the current value is less than the prior value you would suspect a rollover.  In such a case, add 2**24 to the current value before subtracting.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 5
(3,723 Views)

Hello all-

You could also use some logic in your software to overcome the "spikes" in data you are seeing.  I have attached an example that shows one method to accomplish this.  Basically the counts are subtracted if count[n] is greater than count[n-1], but if count[n-1] is greater than count[n] (indicating a rollover) then the total number of counts is calculated by a bit of arithmetic.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 3 of 5
(3,711 Views)
Hi everyone,

Excellent. The logic is just what I was looking for. I was concerned with counts per interval/period. Thank you both for your input.

your,
Dwane
0 Kudos
Message 4 of 5
(3,706 Views)

Hey dewey21-

Glad we could help out- best of luck with the rest of your app.Smiley Happy

Tom W
National Instruments
0 Kudos
Message 5 of 5
(3,702 Views)