Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx high speed counting - zero frequency?

I have an application where I need to count the number of TTL pulses being generated in a certain time interval by a photon counter.  The photon counter generates a pulse upon reception of a photon.
 
I'm using DAQmx high frequency with 2 counters and it works somewhat.  The problem is that when there are no events within the measurement time, the program quits with an error...  Error -200302 occurred at DAQmx Read (Counter 1D DBL 1Chan NSamp).vi:1.
 
It says that a possible reason is: Signal being measured is slower than the specified measurement time.
 
It's true that if I increase the measurement time, the error goes away, but I'd like to able to have zero frequency as a possibility. 
 
Here's my code... any help would be greatly appreciated.
 
 
0 Kudos
Message 1 of 4
(4,230 Views)

Hi dakeddie,

I don't know any LabView but am somewhat familar with DAQmx.

You stated initially that you were interested in edge counting but it sounds like you're either doing frequency or period measurement.  There are some subtle differences.  Frequency and period measurement use "implicit" timing, meaning that you get a new measurement sample whenever one is ready, as dictated by the measurement signal.  If this is what you're doing, you need to change the default timeout (10 sec) for data reading to a larger value, e.g. DAQmx_Val_WaitInfinitely (in Ansi C) waits forever.  On the other hand, edge counting uses "sample clock" timing, meaning you can read the measurement data whenever a clock edge is detected - at a periodic rate for example.  With edge counting you should always be reading the cumulative (total) number of edges since the task began, so I think the error you speak of shouldn't occur.  Of course, if this error is occuring in edge counting mode, you could increase the read timeout just as with frequency or period measurement.

 

 

0 Kudos
Message 2 of 4
(4,225 Views)

There have been a lot of threads here about photon counting and binning.  I would tend to suggest that you use a 1-counter buffered measurement rather than the 2-counter (unbuffered?) measurement.  Another key concept for you to look into is the boolean "Duplicate Count Prevention" property in DAQmx.   Here a links to a couple threads, and I'm sure there are more if you search with various combos of terms similar to photon, counting, binning, etc.

http://forums.ni.com/ni/board/message?board.id=40&message.id=2318&query.id=27323#M2318

http://forums.ni.com/ni/board/message?board.id=40&message.id=2498&query.id=27397#M2498

Hope this helps you get started...

-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 3 of 4
(4,219 Views)
Thanks Kevin, the Duplicate Count Prevention property worked great. 
0 Kudos
Message 4 of 4
(4,194 Views)