11-03-2007 09:46 AM
11-05-2007 03:34 PM
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.