From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx programming single channel multiple trigger analog input

I am using your NI 6259 M-series board and Visual C++ 6.0 in Win 2000. I need to acquire a series of 4096 sample sets on a single channel at approximately 1 MHz. There is about 5 ms between sample sets. I get a digital trigger signal at the start of each set and I am using an external clock.

I am using DAQmx and NI-DAQ 7.3. (Is this the correct choice?)

It looks like I need something like the "retrigger" property that is in LabView, but I need to integrate this into my existing instrument package without LabView.

How do I acquire multiple sets of samples on a single channel using a string of triggers?

Ralph Levy
CTO
Quant Engineering
215-348-3514
ralphlevy@QuantEngineering.com
0 Kudos
Message 1 of 14
(4,623 Views)
Hello Ralph,

Retriggerable Analog Input is not supported on M-Series. To do this, you will need to either reconfigure your task after each trigger (which might be too slow) or use 2 counters to create a retriggerable pulse train that can act as an external clock.

The following Knowledge Base explains in detail how to set this up.

Let me know if you have any further questions.

Sean C.
Applications Engineer
National Instruments
Message 2 of 14
(4,597 Views)
Sean,

Thanks for the info. You referenced a Knowledge Base article but did not say which one.

Please give me a reference to the appropriate Knowledge Base article.

Thanks for help.

Ralph Levy
0 Kudos
Message 3 of 14
(4,593 Views)
Hi Ralph,

I apologize... Here is the link:
http://digital.ni.com/public.nsf/websearch/82DAECADE90CC56F8625659200675B2A?OpenDocument

There are multiple links in this Knowledge Base that might also be helpful to you.

Sean C.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 14
(4,589 Views)
Sean,

I have read through the references you pointed me to. I think I need to:

1) set up a counter for the number of samples I need to take for each trigger (DAQmx_Val_FiniteSamps, sampsPerChanToAcquire)

2) use my external clock as the Source for the counter

3) use my trigger pulse as the Gate signal on that counter

If I use DAQmxCfgSampClkTiming to set up the counter, how do I specify the Gate signal? Is there another way to set up the Gate signal? The NI-DAQmx C Reference has no results on a search for "gate".

I am using Visual C++ and the DAQmx C function library.

Ralph Levy
0 Kudos
Message 5 of 14
(4,579 Views)
Sean,

Do I use DAQmxCfgDigEdgeStartTrig() to set the Gate for a counter?

Ralph Levy
0 Kudos
Message 6 of 14
(4,576 Views)
Hello Ralph,

To use this method, you do not need an external clock. What you are doing is setting up a counter to perform a retriggerable finite pulse train.
DAQmxCreateCOPulseChanFreq()to set up the pulse train generation, frequency, duty cycle, etc...
DAQmxCfgImplicitTiming() to set up the number of finite samples to generate
DAQmxCfgDigEdgeStartTrig() to specify the trigger source
DAQmxSetStartTrigRetriggerable() to set the retriggerable property to TRUE.

You then use this pulse train as the external clock when setting up your Analog Input (AI).
DAQmxCreateAIVoltageChan() to set up channel
DAQmxCfgSampClkTiming() to set the clock to the counter output
DAQmxReadAnalogF64() to read the values.

With this method, everytime a trigger is received, a finite pulse train is generated which clocks your AI.

You do not need to specify a gate terminal. That is all taken care of internally.

Let me know if you have any further questions.

Sean C.
Applictions Engineer
National Instruments
0 Kudos
Message 7 of 14
(4,569 Views)
Sean,

Thanks.

In my application I need to use an external clock for the AI conversions since the frequency changes continuously. I also have a trigger that signals when I need to acquire a "set" of data (for example 4096 analog inputs at the external clock timing for each digital trigger pulse). Does this mean that I cannot use the DAQmxCreateCOPulseChanFreq()?

The Help files for M-Series and for NI-DAQmx C are not as helpful as I had hoped. The DAQmxSetStartTrigRetriggerable() function is not in either help file. I also searched for "retrigger" and got no hits. Is there a place I can get more info on available functions? Or do I need to mine the header files?

Ralph Levy
0 Kudos
Message 8 of 14
(4,566 Views)
Hi Ralph,

The reason we were using the DAQmxCreateCOPulseChanFreq() function is so that we could create a retriggerable finite pulse train to use as the sample clock. If you want to use an external clock, then there is no way to perform retriggerable AI.

Depending on how fast your acquisition is, you can set up a finite triggered AI task. Then reconfigure the task after each acquisition so that it is ready for the next trigger. With this method, you run the risk of missing a trigger while reconfiguring the task.

FYI... the DAQmxSetStartTrigRetriggerable() is located in the DAQmx C Reference Help under NI-DAQmx C Properties >> List of Trigger Properties. You can also find them by searching for "retriggerable."

I hope this helps,

Sean C.
0 Kudos
Message 9 of 14
(4,564 Views)
Sean,

Can I not use DAQmxCreateCOPulseChanTicks() to get an external clock into the sequence you suggested? It seems to allow an external timebase.


DAQmxCreateCOPulseChanTicks()to set up the pulse train generation, frequency, duty cycle, etc...
DAQmxCfgImplicitTiming() to set up the number of finite samples to generate
DAQmxCfgDigEdgeStartTrig() to specify the trigger source
DAQmxSetStartTrigRetriggerable() to set the retriggerable property to TRUE.

You then use this pulse train as the external clock when setting up your Analog Input (AI).
DAQmxCreateAIVoltageChan() to set up channel
DAQmxCfgSampClkTiming() to set the clock to the counter output
DAQmxReadAnalogF64() to read the values.


Ralph Levy
0 Kudos
Message 10 of 14
(4,563 Views)