Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

How to set a start and a stop digital trigger by conting the number of the trigger signals

Go to solution

Dear All,


It is a DAQ application that I don't know how to set the triggers. The trigger signal is a sequence of rectangular pulse. A plot of X-Y is needed. The X interval between the trigger signals are the same. So, I need to count the trigger signals to know the value of X. And the Y value is analogue signal. If the trigger interval corresponds to dx, My measure ment range will start at the rising of the m-th trigger signal with X=m*dx, then it will stop at the rising edge of the n-th trigger signal with X=n*dx.


But I don't know hot to do this trigger+counter. The attachment shows a schematic depiction of the measurement. Can anyone help?


Thanks In Advance.




0 Kudos
Message 1 of 17
Accepted by topic author jzhj01

Configure the counter to measure pulses in finite or continuous mode depending on ur requirement.


Use timing source as the trigger pulses &  configure rate atleast 100 times rate of trigger. Then compare count value of counter to "m & n" & generate the pulse on any PFI lines or port pins.

I assume that u know m&n values.


The other way is to configure the conter to count the no. of rising edges. Then compare this no of edges with "m & n" & generate the pulse on any PFI lines or port pins.

0 Kudos
Message 2 of 17

I might be mistaken of your application, but it sounds like all you need is to use the external signal as a Sample Clock for an Analog Input Task.  You could then throw away the extra samples in software.  If throwing away samples in software is impractical, you could use a counter to generate a start trigger after N Pulses have occurred which would enable the AI Task.


Best Regards,

John Passiak
0 Kudos
Message 3 of 17


Hi, Kelvin and John,


My application is a scan:

    Source: X-value is the linearly sweeping parameter from X_a to X_b. Trigger rectangular pulses with voltage between 0-5V are generated during the scan. The referrence X-values can be obtained by counting the rising edges of the trigger.

    Detector: Y-values,


The trigger can be used as a sample clock: at each rise edge of the trigger, a Y-value is obtained. But I need more Y values than X values. The X values can be the ones at the rising of the trigger signals. Then the X-value array can be interpolated and extended to the same size of Y-value array. The Y value should be contineously sampled during the desired range of X. The number of Y-values is much more than that of X-values to show the fine structure of the scanning.


The DAQ applications are quite new to me. The suggestions are very helpful. I am now trying to use the counter to generate a pulse. Maybe it is easier to get all the data and throw away the unwanted.


Thank you.




Message 4 of 17

Hi, John,


I have tried to not use the triggers but throwing the unwanted data in software. The attached is a figure of the Labview codes. Can you help me to have a look? I haven't try it on a really DAQ card, and am worried that it is the wrong way to use DAQmx functions.






0 Kudos
Message 5 of 17

Hi Jiangjun,


One issue with the screenshot that you posted is that the CI task will require a clock source.  In your case this should be set to the AI Sample Clock.


I think I understand what you're trying to do now, the attached code should implement what you're looking for.  I went ahead and used a second counter to start the sampling so you shouldn't have to throw away data in software.



Best Regards,

John Passiak
Message 6 of 17

Hi, John,


Thanks for the code. It is exactly what I need. It is really time consuming to learn the meaning of "properties". Now I believe I can move forward soon. Thanks a lot.




0 Kudos
Message 7 of 17

Hi, John,


I am now trying to buy one DAQ cards for this application. It is mainly about the speed. Can you recommend one?


1)Beside X and Y, we also need 1 to 2 refference chanels. -- This means that we should use 8AI DAQ cards, right?


2)My application: X value -- from 0 to 5 in 1 second. And I want get more than 50,000 Y values at the same time. And X can be extended to a very fine step of 0.0001.

2a)Because all the value are obtained at the same time -- So, it is better for me to use "Simultaneous Sampling Multifunction DAQ"? -- In your code, you are using another one.

2b)Because 50,000 samples at 1 second means that I should choose DAQ card with rate > 50,000/channel/second?

2c)I need save the data. This will need additional time. and Additional codes may need time to run during the data acquisition loop. So, "50,000/Channel/Second" only means the Card can reach this speed but in practice we have to use faster Ones and also need a fast computer?


What about these two...

If these are OK especially the cheaper one is good enough, That's best.






0 Kudos
Message 8 of 17

Hi Jiangjun,


Simultaneous sampling DAQ cards have one analog to digital converter for each input channel they have, so the signals are read at the exact same time.  Non-simultaneous sampling DAQ cards, also known as multiplexing DAQ cards, have one analog to digital converter, and multiplex through all of the input channels to convert them to digital values.  However, this happens extremely quickly, and the time between channels is extremely small (in the order of microseconds to tens of microseconts).  For more information see the knowledgebase Difference Between the Sample Clock (Scan Clock) and the Convert Clock (Channel Clock) and its related links.


Therefore, if you're OK with a multiplexed DAQ card and need it to be PCI, I would recommend the M series PCI-6220 or PCI-6250, which has about twice the accuracy of the 6154 and is cheaper.  The 6220 and 6250 do not have any analog output, if you need AO also, use the PCI-6221 or PCI-6251.


Both of these cards can sample up to 625kS/s on one channel, or 500kS/s aggregate (meaning 500kS/s divided amongst the number of channels you're reading.  In your case, you need four 4 channels: X,Y, 2 reference, so you could acquire at up to 500kS/s /4ch = 125kS/s on each channels, over twice of your 50kS/s specification.


If you can use a PCIe card (meaning you need to have a computer with a PCI-express slot), look at the new X-series PCIe-6320 or PCIe-6341.  Both of which will be able to acquire over 50kS/s on four channels.



Computer speeds are important and needs to be able to run LV without a problem, but the cards acquire independently from your computer.  The cards have onboard timing engines and buffers so the computers can read back chunks of data from the card.  The card will read 50,000 points per second on each channel, and the computer can read back 5,000 points from each channel every 10th of a second, which is usually a good ballpark for a place to start.  


Eric S.
AE Specialist | Global Support
National Instruments
Message 9 of 17

Hi, Eric,


Thanks for your recommendation.


I am choosing between PCI66251 and the Simultaneous sampling DAQ cards.


Someone tells me that if I have four signal channels by using DAQ cards (differential voltage), I need use the ones with at least 8AI. Is it true for  choosing Simultaneous sampling DAQ cards.





0 Kudos
Message 10 of 17