08-30-2012 12:54 PM
Hi folks,
I am using a pulsed laser source and I am doing triggered DAQ of the laser pulses. I am using the NI PCI-6251and the NI SCB-68. The Laser and the DAQ are triggered with 2 KHz (1% duty cycle). I connected the trigger signal to the APFI0 input of the SCB-68 and I am using the "Start analog edge" function. The Laser is producing 300 pulses per wavelength sequence. The DAQ is working so far, but it seems that every 2nd or 3rd laser pulse is not detected. There are about 100 pulses per wavelenght sequence instaed of 300.
Any ideas?
Thanks
08-31-2012 11:13 AM
Hi,
Are you trying to count the 300 pulses when your input signal is high (1% of the time)? If I understand you correctly, that high time will be 5 microseconds (1/2000)*(0.01). You then want to count 300 pulses within that 5 microseconds? Could you provide a bit more explanation of how your system is set up, what you are using to read in the laser pulse, and the configuration on your DAQ? Are you triggering a counter to read in the pulses?
Regards,
09-04-2012 04:51 PM
Hey,
right, the high time of the trigger signal is about 5 microseconds. During the high time I am trying to read in the 300 pulses. For reading in I am using a position sensitive detector and a transimpedance amplifier.The trigger source is a function generator which is connected to the Laser and the APFI 0 input on the SCB-68 as well. The DAQ is triggered with the "DAQmx Start Trigger Vi" (input APFI 0, analog edge, raising slope). After triggering each pulse is detected in a one loop cycle...
09-04-2012 05:14 PM
What is your sampling rate and how many samples do you read each time?
300 pulses in 5 us means that each pulse has a period of <17 ns. Since the fastest sample period of the PCI-6251 is 800 ns you cannot possibly be capturing all the pulses.
Post your code with some typical data saved as default. (We do not have your hardware.)
Lynn
09-05-2012 11:18 AM
Oh, there is a little mistake in the post I made prior to this. Each trigger pulse is triggering one laser pulse. So there is one Laser pulse to detect within 500 microseconds the next trigger pulse comes.
Attached you find a screenshot of the Labview programm.
09-05-2012 11:32 AM
I am reading out 2 channels with a sampling rate of 633 kS/s per channel. Each laser pulse "consists" of 200 data points. The final number of laser pulses are being detected can be set up manually by the number of loop cycles.
09-05-2012 06:13 PM
By committing your task outside the loop and putting the start-read-stop sequence inside, you've pretty well maxed out on making your DAQmx task calls efficient. You might get a marginal gain by wiring the front panel timeout control from outside the loop, but probably not much. Here's a link to some benchmarking done by another forum member back when he was with NI.
It doesn't look likely that you'll be able to improve the driver call speeds to be ready for a new trigger every 500 usec. Further, it sounds like you will use up 200/633k = more than 300 usec on post-trigger sampling, leaving less than 200 usec for the task stop & restart.
You'll probably need to approach this another way. My thoughts veer toward using one or both of the board's counters to help out your AI task so that you don't need to stop and restart it. It'd be nicer to use the counter(s) to *create* the needed timing signals but I don't have hw around to tinker and prove out any proof-of-concept. Another approach is to *measure* timing signals so you can identify which AI samples belong with each triggering event. Either way, you'd start the AI task just once for the entire data set you collect.
-Kevin P
09-06-2012 02:17 PM
I tried to take only 10, 50, 100 data points per pulse, but the total number of pulses detected remained the same. So 200 usec for task stop & restart should be fine.
I tested the speed of the loop without the "DAQmx read-vi" (about 1us for 2000 cycles), should be fast enough.
If the "DAQmx read-vi" is inside the loop, 2000 cycles/pulses take about 4s. With a pulse repetition rate of 2000 Hz the total time should be about 1s.
09-06-2012 05:45 PM
The benchmarking test I linked topped out at about 1.1 msec execution time per iteration. The poster is *extremely* knowledgeable about NI's hardware (working internally for NI until somewhat recently) and he attributed virtually all of the 1.1 msec to overhead in the DAQmx stop and start calls due to the needed state transitions.
Your results make some sense when you consider them carefully in light of those benchmarking results. Essentially, your total loop time is a sum of (DAQmx call overhead time) + (sampling time) + (time waiting for trigger event). So that's about 1100 usec + 300 usec + (0-500) usec. Since the triggering intervals are spaced by 500 usec, they will tend to sync the loop up to multiples of 500 usec for execution. If your system manages 1100 usec overhead + 300 usec sampling, you might get a total loop interval of 1500 used. If you run just a bit slower than the previously benchmarked system, you might get 1250 usec overhead + 300 usec sampling which would push you to a loop interval of 2000 usec. Thus 2000 reps could require about 4 sec.
I just took a couple min to do some benchmarking of my own. 2000 loops of just start and stop with no read took ~2150 msec. Adding a 200 sample read (633 kHz sample rate) pushed it to ~2900 msec. Most of that is due to the sampling time of 200 samples / 600 kHz. Using a 5 sample read left me around 2225 msec. All of this was tested without configuring a trigger so there's no trigger wait time in there.
So in short, no, 200 usec for task stop and restart will *not* be fine. I'm pretty convinced you can't expect to get there from here with that approach, not if you want data for every 2 kHz trigger event.
-Kevin P