Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Gated counting issue

I am having trouble with gated counting in my program.
First off I am using Labview 7.1 and NI-DAQ 6.9.2 with a PCI-MIO-16XE-10 and a PC-TIO-10.

The vis were written for us by an outside firm many years ago. They were unable to create a proper gated counter. Instead we count for 10 30ms bins and externally gate our PMT signal with an AND gate.

It appears that the program does not remove the first value in the buffer. So we see non-sense data in the first bin of our histogram. This problem was greatly accentuated when we upgraded to Labview 7.1. So, much infact we have reverted to the 6.1 version of the program. The issue is still there but does not occur as often.

I have been tasked with fixing the problem. Rather than just counting for an extra bin and removing the first, I would like to convert the system to a proper gating counter.

The system will ideally create a 4Khz trigger for our laser then remove the laser pulse with a 12 usec gate. Leaving us with a 238 usec counting window. We also have two shutter signals that fire for 300 msec each. I would like to be able to arm the counter. Then start and stop it with one of the shutter signals. The start of the shutter signal will be software controled. Then extract an array of the counting windows from the buffer.

The TIO-10 will do all the timing and the MIO will do the counting. We are not able to upgrade these systems at this time so we must use these boards.

Any input on examples of where I should start will be greatly appriciated.
0 Kudos
Message 1 of 4
(2,853 Views)
Sorry, I'm having trouble understanding the exact relationship of the signals. Let me go through one at a time:

1. "4 kHz trigger for our laser" -- a 4 kHz pulsetrain, right? Laser is triggered every 250 usec?

2a. "remove the laser pulse with a 12 usec gate" -- the laser is off for 12 usec?
2b. "leaving us with a 238 usec counting window" -- the counting operation is gated so it's enabled for 238 usec?

3. "two shutter signals that fire for 300 msec each" -- single pulses with On time of 300 msec?

4. "be able to arm the counter" -- what is it going to count?

5. "start and stop it with one of the shutter signals" -- which one? Either one, like a logical OR? Start and stop in the sense of performing a gated measurement that is only "enabled" during the 300 msec shutter time? Or like hardware start and stop triggers?

6. "extract an array of the counting windows from the buffer" -- I can't figure this one out. Buffered counting means the E-series board. Because you have a PC-TIO-10, you're stuck with traditional NI-DAQ 6.9.x. That in turn means that the E-series counters' Gate signal can be used like either a sample clock or an enable signal, but not both at once. So I guess I'm not quite understanding your app.

You mentioned that the outside firm didn't create a "proper gated counter" -- just what kind of behavior would you expect from a "proper gated counter?"

-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 4
(2,845 Views)
We are doing luminescence measurements with pulsed laser stimulation. We measure the luminescence with a photon counting package that outputs 1 9nsec TTL pulse per photon. The stimulation from the laser pulse blows through our filtration giving us about 6000 counts of false signal. We time a gating pulse to start with the laser pulse and last for 12usec, giving the PMT sufficient time to relax after being blinded by the laser. After the 12usec gate we count for 238usec.

1. It is a 4KHz pulse train with a .004 duty cycle

2a. The laser is Q-switched and pulse at the frequency we provide it.
2b. After the PMT has relaxed we count for 238usec before the next pulse

The gating is accomplished using an external circuit.

3. We use Delayed Pulse Generator Config.vi set up with a pulse width of 300msec no delay. When the sample is moved into the measurement position we start this pulse.

4. By arm the counter I mean set it up to the point where I provide it with a hardware start signal, the shutter pulse, and it comenses counting the TTL pulses from the PMT.

5. We only count the PMT signal during the 300msec of shutter open time.

6. Basicly I am uncertain in what form I would receive the data from the buffer. If I understand things correctly I should get an array with one element per gate period. Which in this case would be 1200.

I expect a proper gated counter to stop acquisition during the gate and resume afterward. I believe the E-series boards are capable of doing this without an exteral circuit. The outside firm was not able to accomplish this. Instead they programmed the system to use 10 counting bins of 30msec each and externally gate the PMT signal with a PCB. The circuit design is problematic, at high count rates the PCB seems to overlap the PMT pulses creating a saturation effect long before the limit of the MIO board and the PMT.
0 Kudos
Message 3 of 4
(2,843 Views)
Ok, it's been a while since I used a PC-TIO-10 and even then I didn't explore it all that much (mainly continuous pulsetrains and period measurement, which worked kinda weird). I'll try to work through a method that doesn't involve changing boards, but if you *could* change boards, you could then use new features in DAQmx which allow you to simultaneously perform logical-AND-style gating and buffered-sampling-style gating. With traditional NI-DAQ it's got to be one or the other.

Toward the end of your message, you mention expecting an array containing 1200 elements, one per gate period. This suggests that your MIO counter should buffer a count value on each edge of the 4 kHz pulsetrain that occurs while the 300 msec pulse is ON. Is this right?

It also sounds like it should only spend 238 usec of each 250 usec gate period actually counting the PMT pulses b/c the first 12 usec should be ignored. Is this right? You said that this gating is accomplished with an external circuit -- are you satisfied with this aspect of gating? For this reply, I'm assuming not.

Finally, your PMT pulses are 9 nsec duration. This is slightly less than the 10 nsec pulsewidth spec for edge counting on the MIO card, so you're skating on thin ice in any event.

With that combination of requirements, I'm also having trouble finding a solution that doesn't require an external logic circuit. It seems that you're looking to apply 3 different gating operations to a single counter measurement task.
1. Buffered-sample gating -- store a count value in a buffer once per falling edge of a 4 kHz pulsetrain.
2. Logical-AND gating -- only count during 238 usec of each 250 usec interval.
3. Logical-AND gating -- only count and store counts during a 300 msec interval while a pulse is HIGH

Under traditional NI-DAQ (which you're stuck with while using the PC-TIO-10), you can accomplish #3 in the pulse generation task, but you can't program for both #1 and #2. You'll need to accomplish #2 with some simple external logic circuitry -- AND's and NOT's. Here's what I'd do:

1. Logically AND the 4 kHz pulsetrain with the 300 msec pulse. Call this the gated laser trigger. You may be able to do this with just the PC-TIO-10 without any external circuit. You definitely can do it with an MIO counter. You would setup the 4 kHz pulsetrain to be "level-gated" by the 300 msec pulse.
2. Logically AND the 238 usec portion of the 4 kHz pulsetrain with the PMT pulses using an external circuit. This may require a logical NOT or two along with the AND. Call this the gated PMT.
3. Program the MIO counter to perform buffered period measurement. The falling edge of the gated laser trigger (#1 above) would be the "gate" (a.k.a. sampling clock) signal. The rising (maybe falling depending on how you do your logic) edges of the gated PMT pulses (#2 above) would be the source signal.
4. Behavior: Every 250 usec during a 300 msec timed interval, a count value will be stored in the buffer. The value of each count will be the # of gated PMT pulses that occurred during the 238 active usec of the most recent 250 usec interval.

Again note that ALL of the above could be done with a single 6601 board using DAQmx. 1 counter to generate a 300 msec pulse. 1 counter to generate a 4 kHz pulsetrain only during the 300 msec pulse's HIGH time. 1 counter to buffer counts with the gated 4 kHz pulsetrain acting as both a sampling clock and an active-low pause trigger.

-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).
Message 4 of 4
(2,830 Views)