08-25-2010 11:00 AM
Hi!
I am trying to gate two counters which count signals from two photon detectors. I basically need to turn each counter on for approx. 50 ns, then off for 950 ns and repeat this for some minutes. The TTL-signal needed to gate the counters is provided by external hardware logic.
I looked at the example vi. "Count Digital Events-Pause Trig.vi" and added the DAQmx Trigger property node options which set the options to enable the gating/pause functions to my previously working code (which did not have the gating functions). Now, when I run the vi, I get an error saying that the pause trigger does not work with the sample clock for the counter. So, basically I have two questions regarding my aim/code:
My system: NI PCIe 6259 card with two BNC2090A breakout boxes, Labview 9.0
1) First of all, how fast can I gate the counter? Can I expect this to work as described above (50ns resolution, 1 Mhz repetition) ?
2) What do I need to change to get my code to work? I found another thread on this forum with a similar problem and there the code seems to work on a X series hardware system. Here is the link: Pause trigger thread The code is pretty much the same in my eyes...is this not supported by my hardware PCIe 6259?
Attached you will find my vi. Its embedded in a stacked sequence structure. On the first page (=page 0) I added a comment in bold. This is where I define my first counter with the pause trigger options. The second counter underneath the first counter is the way I had all counters before and code worked there.
On page 2 (= page 1) in the stacked sequence structure I start the tasks. In the loop I do a 2d scan and generate two images (one for each detectors; confocal microscope).
It would be great if someone could look at my code and tell me what I am doing wrong or if the aim of this program will not be doable (1 Mhz fast gating of counter). Please point me to any resources I havent found so far regarding this problem. My Vi. will not run stand alone as it is part of a bigger master program. If needed I will try to rewrite it so you can run it stand-alone.
I hope I have provided sufficient information. If not, please tell me 🙂
Hope any one can help,
Thanks a lot for your time,
Christian
08-25-2010
02:31 PM
- last edited on
02-01-2024
09:09 AM
by
migration-bot
Hi Christian,
Great question. You can't use a Sample Clock and Pause Trigger on the 6259 at the same time (they both use the same pin on the counter chip). What you would want to do is configure a buffered Pulse Width Measurement (see diagram from M Series User Manual😞
It's not necessarily the most intuitive, but you would need to use the external gate signal as the pulse signal to be measured. You can measure this in terms of ticks of an external "timebase" (in this case, your photon counter). Configuring "Implicit" timing means that the value of every pulse will be latched in to a buffer.
However...
The on-board FIFO is essentially non-existant for counters on PCI M Series DAQ Devices. If you try to clock data in faster than can be pulled from the board sample-by-sample you will receive an error. For PCI M Series, we have benchmarked counter inputs at around 380 kHz maximum (system dependant). The PCIe M Series boards use a bridge to convert PCI to PCIe, if anything performance would be slightly worse on these boards (I don't have a benchmark handy for these).
Also, a 50 ns gate time doesn't give you much time to count photons. How many photons are you expecting to count in this interval? How wide are the TTL signals produced by each photon?
So, I see two problems with this:
Best Regards,
08-26-2010 05:41 AM
Hi John,
thank you very much for your fast reply!
I have some questions regarding your answer:
1) You benchmarked the counter input at 380 kHz. Does that mean, one cannot count faster than that? Or does it mean that one cannot read data from the counter faster than that?
I need to read out the counts with approx. 10 - max. 100 kHz.
2) In the 50ns time frame I only expect one photon or no photon to be counted. The width of the signal from the detector is approx. 40 ns.
3) Do all X series boards allow to use the sample clock and pause trigger at the same time (as in my code in the first post)? Maybe an upgrade to a small X series card would simplify my problem...
If I understood your post correctly, I could perform my task by using the buffered pulse width measurement method if I do not read out the counter faster than 1 Mhz (which I dont need to) and I only expect to differentiate between 1 photon and no photon in my 50 ns time frame, correct?
Thanks again for your help!!!!
Cheers,
Christian
08-26-2010
01:18 PM
- last edited on
02-01-2024
09:11 AM
by
migration-bot
Hi Christian,
You can count external signals up to 20 MHz. Also, you could count the 80 MHz timebase (its bandwidth isn't limited by the protection circuitry on the digital front-end). So the M Series counter can certainly count faster signals than 380 kHz. This benchmark represents the maximum rate that you can sample data from the count register.
All X Series boards do allow the use of both a sample clock and pause trigger. The reason is that they have a dedicated pin on their counter chip for a sample clock input (M Series and earlier boards used the Gate input for the sample clock). The gate input is used to implement the pause trigger. See the following image from the X Series User Manual:
The items circled in Red are unique to X Series boards and are not present on M Series. The FIFO allows us to sample X Series counters at a faster rate than other boards (10 MHz or so per counter).
The buffered Pulse Width Measurement approach depends on you sampling the count register at the falling edge of every gate signal. It sounded like your gate signal is 1 MHz, which would be too fast for M Series counters. If you slow the gate signal down to the 380 kHz range then this method should work on your M Series. The setup code would look something like this:
All X Series boards have the same counter features. They allow fast enough sampling to do the buffered pulse width measurement method, as well as provide for the simultaneous use of a pause trigger and sample clock. It might make more sense to get a low cost X Series to do your counter operations (the PCIe 6320 is the introductory X Series, while the PCIe 6353 would be more of a direct replacement for your 6259).
Best Regards,
08-27-2010 11:40 AM
Hi John,
thank you very much for the clarification. Indeed, my gate signal is 1 Mhz, so with my current setup (M Series card) it will not work. I will perform the task in hardware or buy an x series card.
Thanks again for your help!
Christian
02-07-2012 12:18 PM
Hi John,
I've tried using this buffered pulse width measurement method for an almost identical task, counting edges from an APD within a given gate period (more like 50ns in my case).
Although I'm using an X-series counter (PCIe-6363), so could use a gated edge count, the buffered pulse width measurement has the additional advantage of starting from 0 for each gate pulse, which is what I want to achieve.
However, I encounter an error when the count rate is low - if two gate pulses pass with no timer (APD) edges, the task throws an error and stops aquiring. Is it possible to modify this behaviour, so that I can have it count 0 for these cases, or am I stuck with this behaviour (in which case I will have to use the more cumbersome pause-trigger gate)?
This seemed like a good place to ask, but apologies if it'd be better off in another thread - let me know if this is the case.
Josh
02-07-2012 12:45 PM - edited 02-07-2012 12:49 PM
Hi Josh,
If you configure your device like the following it should work (just tested on a PCIe-6353):
In my case, PFI8 was connected to an encoder that I manually rotated to produce pulses, and PFI0 was connected to a button which would pulse low to reset the gate signal. I was able to report cases of 0 encoder pulses during the gate.
If you're configuring the hardware differently then you might encounter errors. Make sure you have Implicit Timing selected from the polymorphic VI and that you are using the same terminal names that I am for your signals (CI.CtrTimebaseSrc for the photons, and CI.PulseWidth.Term for the gate). If you had an external sample clock configured (instead of using imlpicit timing) then you might get errors if you receive two consecutive clock edges without a pulse width (which is actually the gate), but this probably isn't what you want to be doing anyway.
Best Regards,
02-08-2012 08:57 AM
Hi John,
Many thanks for your prompt response!
Apologies are in order - my code was configured pretty much exactly as your example, and it seems my problem was actually related tyo the fact that I was testing it on another machine using a legacy B-series PCI-6014 card.
When I transferred to the intended machine, using the PCIe-6363, everything worked as expected.
Using the PCI-6014, it seems that a zero value can only be measured if no previous measurements gave values >0. If a value >0 has been measured, any subsequent period of 0 length returns the same value as the last non-zero measurement, which is not very useful.
So, I would like to know:
Thanks again!
Josh
02-08-2012 02:01 PM - edited 02-08-2012 02:03 PM
Hi Josh,
It's good to know you were using different hardware, an inconsistency would have had me worried.
Here are the major families of DAQmx products that use counters and a description of how they behave in this situation:
STC-based: E Series, Legacy B Series, most S Series
The counter value is latched in on the source edge. So, if you have two different gate edges with no source edge in between, the value returned will be the same as the previous value. This was referred to by NI as "Duplicate Counting". Unfortunately, on the STC-based devices there is no way around it.
The behavior might be handled differently, but there is no way to report a value of 0 for a period that does not have any source edges. For example, my E Series card actually returns an error -200140 "Two consecutive active edges of the input signal occurred without a counter timebase edge". The fact that your B Series does not report an error consistent with E Series in this situation is probably an oversight.
STC II-based: M Series (except 621x), 9172, 6124, 6154
TIO: 660x, 6624
These family of products support the duplicate count prevention property. If it is enabled, you will receive samples of 0 like you would expect. If it is disabled, you should get the -200140 error that I mentioned earlier. I validated on an M Series but didn't try a TIO.
STC III-based: X Series, most cDAQ chassis
The duplicate count prevention property isn't actually supported on these products, but similar behavior is enabled by default. You would expect to get samples of 0.
Bus-powered M Series: 621x
I haven't yet validated this one--these products don't actually use the STC II like other M Series but rather an FPGA implementation of something between STC II and STC III. I think the behavior should be something similar to the other M Series but would have to validate.
Best Regards,
02-09-2012 11:06 AM
Hi John,
Ok, so everything is as expected then, that's a relief! And as I have the 6363 as my intended hardware for the final product, I have no problems any more.
I did see the -200140 error code on the 6014 previously (that was what got me into this in the first place), but it seemed to disappear at some point along my testing, and I'm not really sure at what point, so I'm afraid I can't offer any information on what I changed to have it not show up. Thanks so much for your help, and for taking the time to look into this in such detail!
Best
Josh