Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

triggered acquisition using synchroized loops

Hello,

 

I am new to NI based data acquisition programming. I am using NI PCI 6110 for data acquisition and the problem I face is the following:. I wish to acquire signal from a detector which gives pulses of 100ns duration with a repetition rate of 1 MHz. I have a sychonized trigger of 1 MHZ which I want to use as timing reference. Since the max. sampling rate I am using is 8MHz, I expect at least one sample within the pulse of the detector, which I want to take out. In other words, for each trigger pulse, I want to grab out the first sample which would have the information about the corresponding pulse. I tried to make a program with DAQMX VIs adding "configure channel"+ "timing"+ "trigger"+"initiate task"+"read measurement" VIs. If I put the read vi as "analog single channel single sample" mode, it gives minimum of two samples per channel. Since I want to read many triggered events, I put it in a loop (tried both for and while), and run the read.vi for each loop iteration. The problem is

 

(1) The loop is very slow. I could not get measurement for each triggered event i.e. 1MHz rate. The max rate I could get is few KHz only, despite the fact that I have only the read.vi inside the loop.

(2) I have o idea, even with this speed, how to synchroize the loop with trigger so that the loop can run only when the trigger is received. The wait vis I know are of ms waiting time, whereas I need microsecond or smaller waiting time. 

 

Is there any method to fast access say, n number of sample points corresponding to each trigger event from NI PCI 6110 and then record and display them ????

 

Thak you in advance.

0 Kudos
Message 1 of 8
(4,358 Views)

How do you get 8MSPS when the spec is telling me 5MSPS max?

 

Have you thougth about a producer consumer architecture?

One loop is reading continously and pipe the result into the consumer loop that identify the pulses ?

 

Things can be made faster if you read  and process I16 values instead of floating point. Scaling could be the last step.

 

And:

Posting your code helps us to help you 😉

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 8
(4,351 Views)

Some more:

 

Stop thinking about processing , storing and displaying each pulse @1MHz updaterate.

 

You monitor migth have 100Hz update rate and your eye??

 

Using UI (user interface/ display) items in a 'fast' loop slow down everything.

 

Search the NI pages for 'data streaming' , 'memory management' , 'excecution speed' , ...

 

And capture 1 ms  of data as an wfrm and post it here, together with the characteristics you what to measure. 

 

Maybe you end up with 4 loops (threads) running: Data aqusition, preprocessing, storing and display.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 8
(4,349 Views)

Hi,

 

Thank you for the quick reply and my apologies for not attaching the program. As it was my first program and I was a bit shy of posting it. 

 

Now I have attched it below. The pulse fed to the card was having 800kHz rep rate with 180ns duration, +/-2Vpp amplitude, so that with max. sampling, I can get two samples: one within the pulse and the other away from the pulse.  Now I wanted to store n such points (samples) each from one trigger pulse. Of course, I do not wish to process and display it together with acquisition. So first I want the card to take say 100000 such points and then give it to me, so that I could further pocess and display them. The thing is, I do not want to skip any point during this n point acquisition.

 

I also used a for loop keeping the read vi only (no display inside), and monitored the iteration speed, which was very slow. I do not know other ways of accessing multiple points using trigger. 

 

Thank you for your advise about producer consumer system. I would go through it and try to make some program.

 

Cheers

 

 

Download All
0 Kudos
Message 4 of 8
(4,342 Views)

OK, 100k pulses at 800kHz rate @ 5MSPS gives 625000 samples in 125ms.  You should be able to stream that into your PC memory, the DAQ driver should handle all this already.

You have one pulse every 6.25 sample, so why do you want to trigger for each?  Have you checked the trigger rearm time? trigger delay?   

 

IF you what to get something in sync with your repetition rate at highest possible sample rate, I would use a (external) PLL  to create an external sample clock in the 4MHz-5MHz range. (Don't know if you card supports the injection of an external sample clock)

 

Spoiler

(well, I would use a PXI system with a timer card that would do that job, and a somewhat faster digitizer 😉 )

 

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 8
(4,327 Views)

I found a producer consumer program in some previous NI discussions and modified it to see its speed (attached here). The speed with which it acquires data is 2.5kHz (I measured it by trackking the time Vs. loop iterations), which is way smaller than 800kHz (trigger speed), meaning many pulses are skipped during the measurement.  I found that the iteration speed of "for loop" without any data operations is around 10MHz whereas by putting any data acquisition vi inside it (for instance read vi),  the speed reduces up to few kHz??? Can any one suggest how one can read data from an externally triggered PCI card with 1MHz speed ??? ( the data storage and processing can be done later to save acquisition time)

0 Kudos
Message 6 of 8
(4,325 Views)

The answer to the question, why we need trigger is the following:

 

Since we are using 800kHz rep rate pulses, the exact rate could be any value between 795khz to 805kHz. The pulses are around 200ns duration, so in principle, as you said, only oe sample out of 6.25 samples would be having the information about the pulse (say voltage). So the location of this sample can be given by the trigger pulse, which we would adjust with the trigger delay optio in such a way the the first sample could give the position of the peak of the pulse. This is the reason, I wat to take out the sample exactly after triggeringm and the nu,ber of sample I would take would correspod to the rep rate/ trigger rate.

 

I do not know, by acquiring 625000 samples in 125ms in one go and then taking every 7th sample as the representative of the 200ns signal would be a solution???

 

One Query:  If I understand correctly,  each time when the card is triggered, the timing vi takes the "no of samples" prescribed to it (such as 2 in my program). Since in between two trigger pulses (800khz), we have only 6.25 samples (5MSPS), does it mean we can not obtain more than 6 samples per trigger???? If it is so, when I put a value of 1000 for "no of samples" why it displays 1000 samples???

0 Kudos
Message 7 of 8
(4,321 Views)

 

If you want to make energy spectra out of your pulses there is also the option to add a lowpass filter to spread the pulse.

 

 

Instead of triggering I would go the sync samplerate way. Two ways to choose:

 

Output the samplerate clock of the PCI6110, divide it by 8 (or 5...7) external (standard logic ICs)  and trigger your source.

 

or

 

as already mentioned: multiply your pulse trigger source frequency by 5 to 8 with a PLL (again standard IC are available) and use that signal as the source of your sample clock.

 

 

However it depend on your signal, signal chain and what you want to measure.

So: What do you want to measure??

To post some useful data

Capture ~ 10000 points at 5MSPS , output that in an array indicator, right click 'EDIT-Make current values default' save that vi and post it here. 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 8 of 8
(4,300 Views)