Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting a pair of mutually gated pulses, while simultaneously counting all three pulses

Hi all

 

I hope you can help me (I've been struggling with this problem for about a week 😞). I wouldn't say I'm completely new to LabVIEW, but I am quite new to data acquisiton of the type to come.

 

I have three single photon counting modules (Excelitas SPCM-AQRH) which generate pulses roughly 30ns in width. These are connected to a PCI-6602 module using a BNC-2121 (to PFI lines 38, 34 and 30, with the latter physically wired to a user defined BNC input terminal).

 

My goal is two-fold: to individually count the number of pulses coming from the three input signals with no gating on any of them (using the internal timebase 80MHz clock as a sample clock if need be), and simultaneously count the number of pulses on two of the signal lines, while using the third signal to gate the other two. So in total, I need to measure five quantities: the three individual count rates, plus two count rates gated by the third.

 

I have an old Legacy DAQ VI which more or less does the job, but it unfortunately accumulates the counts instead of giving me the counts per time step (I got it from a previous post-graduate student, and is also badly written). I'm also trying to rewrite this Legacy VI using the more contemporary DAQmx framework.

 

The main problem I'm having with my attempt (which I have posted) is that it appears I cannot use the third signal to simultaneously gate the first two signals, never mind count it on its own. I have come across a number of helpful forums (such as: https://forums.ni.com/t5/Counter-Timer/Help-with-photon-counter-data-acquisition-using-LabView-12/td... where it seems possible to both gate the signal and reset the count register for one input signal using a second one, but I don't know if I can do this twice, simultaneously, using the SAME signal as the gate/count register 'resetter'. If push comes to shove, I am okay with forgoing the individual channel counts (even though I'd greatly prefer not to forgo this functionality), but I do need to use the third signal to mutually gate the first two.

 

I realise that I could use shift registers in the Legacy VI I mentioned I have to simply subtract previous values (and hence not end up with cumulative count values), but 1) I'm trying to optimise my system to both sample and write the five count values on the order of ~1MHz (faster if at all possible) so subtracting previous values for every loop chows up processing power, and 2) the simple finite difference solution seems a little weak (surely there is a better way to do it?)

 

Attached is my attempt using NI-DAQmx, along with some screenshots.

 

Please let me know if you have any suggestions. I'd greatly appreciate it!

0 Kudos
Message 1 of 2
(2,001 Views)

Your exact needs aren't entirely clear to me, but even with only partial understanding I can tell you a few things:

 

- sync will almost certainly be important so you'll likely need to deal with "Arm Start" triggering

- high sample rates of ~1 MHz will probably be a problem for the 6602.  It will *definitely* be a problem with 5 channels worth of them b/c the 6602 only has 3 DMA channels and a very tiny on-board FIFO.  The other 2 channels would need to use interrupts, and won't be able to handle anything in the MHz realm.

- give *VERY STRONG* consideration to upgrading to a PCIe-6612.  It has a bigger FIFO and a lot more DMA channels.  I strongly suspect this will be a *NECESSARY* upgrade to do the things you describe.

- signal integrity and digital filtering may be issues to contend with.  With the 6602, brief spurious glitches on a period or sample clock signal would cause a FIFO error that rendered the task useless.  A 6612 would probably be less inclined to throw a fatal error, but it might then be more likely to deliver corrupted data.

- A lot of the RTSI stuff I see in the code is probably unnecessary and is likely a holdover from trying to do a literal translation of the legacy driver code.  One *can* still do that stuff explicitly, but under DAQmx it's rarely needed and is usually more trouble than help.

 

Sorry, that's all the time I've got right now.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(1,975 Views)