Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use the buffered counting mode at a fixed frequency?

Hi-
   I'm using a PCI-6259 M-series board with the Nidaq MX drivers in Labview 7.  I am trying to use one counter to do buffered edge counting (eg. count how many pulses appear on one input in 400 successive time bins of 10 uS each following a digital start pulse).  That is, my inputs are:
     Start Pulse (from experiment)
     Count Pulse (from a photomultiplier tube in the experiment)
And I want to know:
    # of pulses from 0 to 10 uS after the Start Pulse
    # of pulses from 11 to 20 uS after the Start Pulse  (or, equally good, # of pulses from 0 to 20 uS....I can subtract later)
    ...
    # of pulses from 3991 to 4000 uS after the Start Pulse (or, # of pulses from 0 to 4000 uS...same thing)

   The Count Digital Events-Buffered-Finite-Ext Clk.vi sample appears to do half of this.  I can set this up CTR0 with the Count pulse (and possibly add the start pulse as an Arm Start....I can't use a Start Trigger, right?).  However, I need to generate a Sample Clock Source at 100 kHz (to trigger the card to buffer the counter value and start counting in the next bin).  So, I tried to set up CTR1 along the lines of Gen Dig Pulse Train-Finite-Dig Start.vi for generating a finite pulse train starting on a digital trigger, and connecting the output from CTR1 to the Sample Clock Source on CTR0.  However, I get an error -50103 saying the specified resource is reserved if I do both at the same time.  But, I can't see any resource conflicts...the pulse generation on CTR1 works fine alone, as well as the buffered counting on CTR0, and all the PFI pins are different.  Is there some reason I can't use both counters at the same time?

I think I can use the FREQOUT pin on the card to generate a Sample Clock Source at 100 kHz, since I think this is independent of CTR0 & CTR1.  However, I can't trigger the FREQOUT to always start when I get a Start Pulse (as I can if I trigger a Digital Pulse Train to start on a digital trigger...or can I?)...so my bins will move randomly by up to 10 uS.

   This is an unrelated topic, but is there a discussion of the relationship between the terminology in the manuals describing the cards (SOURCE, GATE, OUTPUT terminals) and the terminology in NidaqMX (Source Clock/SrcClk.Source, CI.CountEdges.Term, CO.Pulse.Term)?  Eg. is CTR0.GATE always the same thing as SrcClk.Source, or does it depend on the mode of operation?  If the M-series hardware manual says to connect something to the SOURCE input, how do I assign an alternate PFI pin to that SOURCE input in Labview?  Does it depend on the counter type, or is it always the same?
0 Kudos
Message 1 of 2
(3,276 Views)

Dave,

Hi, you brought up several questions / issues -- let me see if I can help with some of them:

   I can set this up CTR0 with the Count pulse (and possibly add the start pulse as an Arm Start....I can't use a Start Trigger, right?).

Yes, you could set up this way.  Also, as far as I know you're also correct that you need to configure for an "Arm Start" trigger using the DAQmx Trigger property node.  The "Arm Start" trigger is used for counter input (measurement) apps while the regular "Start Trigger" can be used for counter output (pulse generation) tasks.  I don't think I've experimented with recent versions of DAQmx though so it may have changed in 7.4 or 7.5

...I tried to set up CTR1 along the lines of Gen Dig Pulse Train-Finite-Dig Start.vi for generating a finite pulse train starting on a digital trigger, and connecting the output from CTR1 to the Sample Clock Source on CTR0.  However, I get an error -50103 saying the specified resource is reserved if I do both at the same time

I highlighted the problem -- the FINITE pulse train.  DAQmx uses CTR0 as a "helper" when you generate a finite pulse train on CTR1.  It would generate a single pulse whose width corresponds to the exact amount of time needed for CTR1 to generate its specified # of pulses.

For your specific app, I think you could generate a triggered continuous pulse train with CTR1 -- this wouldn't need to use CTR0 as a helper.  The Start Pulse would arm CTR0 at the same instant that CTR1 is started.   If you set up CTR0 to acquire on the trailing edge of CTR1's pulses, then you'll get the time bins you want.

A final slight mod would be to setup CTR0 for measuring buffered periods (set units == "Ticks") instead of counting edges.  In that mode, you wouldn't have to do the subtraction at the end.

   This is an unrelated topic, but is there a discussion of the relationship between the terminology in the manuals describing the cards (SOURCE, GATE, OUTPUT terminals) and the terminology in NidaqMX (Source Clock/SrcClk.Source, CI.CountEdges.Term, CO.Pulse.Term)?  Eg. is CTR0.GATE always the same thing as SrcClk.Source, or does it depend on the mode of operation? 

There's an NI app note and some discussion forum hits if you search the site for "daqmx terminology."

If the M-series hardware manual says to connect something to the SOURCE input, how do I assign an alternate PFI pin to that SOURCE input in Labview?  Does it depend on the counter type, or is it always the same?

Usually, that choice would be available under the DAQmx Channel property node.   There'll be some place to define where the input signal is coming from, generally with "Term" or "Terminal" as part of its name.   Sorry I can't be more specific as I'm not at my LV computer now.

Happy counting!

-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,270 Views)