Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch digital counter to receive counts between samples not between edges

I'm working with PCI 6602 card. I have created 3 channels:
Ctr2 works in CI Cnt Edges mode (with Sample clock) and gets the samples.
Ctr3 works as a pulse generator.
Ctr4 works as a digital edge which ticks a timed loop where samples from Ctr2 are read (using Counter 1D U32 NSamp mode).
The problem is that the samples are gathered incrementaly and I want them to be gathered differentialy. Now to know how many samples were gathered during one generated pulse I have to copy the subset of the array with gathered samples and subtract it from original which takes time. Is there any way to avoid it?
0 Kudos
Message 1 of 2
(3,484 Views)

If I understand your question correctly, you can let the counter hardware do this for you by performing Period measurement using Units=Ticks.   Each edge of the sample clock signal will store the count value then reset that count back to 0. 

To configure this under DAQmx is a little quirky though.  Under edge-counting, you've wired your "channel" signal to the counter's default Source pin and you use your other counter to generate a sample clock signal.  Under period measurement, DAQmx tends to assume that the "channel" signal will be wired to the default Gate pin and act as an implicit sample clock.  It also expects a constant clock signal to be routed to the Source.  You'll have to override these defaults.

You can use a DAQmx Channel property node to specify that Ctr3InternalOutput should act as CounterInput-->Period-->InputTerminal (or something like that) and that your external signal PFIx should act as Counter-->Timebase-->Terminal.   (Sorry, I don't have LV handy so syntax is very approximate.  Hope it helps you get started at finding the right properties.)   This will let you count differentially, collecting # edges of your channel signal between successive edges of your 200 kHz sampling clock.

200 kHz continuous sampling for counter measurement is a bit on the aggressive side, by the way.  Not only will it be a bit tricky to keep samples moving across the PCI bus, but you'll probably have fairly significant quantization error at that rate.  If your channel signal is nominally, say, 2 MHz, you'll expect 10 counts per interval.  But the effects of quantization may well give you occasional 9's or 11's for a +/- 10% error per measurement.

What kind of external "channel" signal are you trying to characterize?  What's the reason for the high sampling rate of 200 kHz?

-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.
0 Kudos
Message 2 of 2
(3,467 Views)