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.

Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger AI and AO of PXI-4461 using C Commands

I have a PXI-4461 DSA card in a PXIe-1065 (along with a bunch of other cards). I am programming the aquistion with this card using the C-commands. I can not start the AI and AO programatically at the exact same time so there is always a delay in one of these.

 

What I can do:

I can generate a dynamic output signal and play it out either/both AO channels using DAQmxCreateAOVoltageChan, DAQmxWriteAnalogF64, and DAQmxStartTask. I can also measure dynamic "input" signals in either/both AI channels using DAQmxCreateAIVoltageChan, and DAQmxReadAnalogF64.

 

What I cannot do:

I can not run both the AO and AI over the same exact time frame (I.E. I cannot start the AO and AI at the same instance). As soon as I start the AO task (DAQmxStartTask), the output plays. As soon as I read the AI (DAQmxReadAnalogF64), that measurement is made, but I cannot tell them both to start at the same time. I must be missing some step because this is the natural way a DSA measurement is made (i.e. play a signal into a system and measure the response of that system at the same exact time).

 

In another application with some of our other cards (specifically multiple PXI-6733 for 16 AO signals and a PXI-6122 4-channel AI) I can set the DAQmxCfgSampClkTiming of all the AO tasks to to the clock souce of the AI card then start all of the AO tasks. When the tasks are started the output will not "play" until I send the DAQmxReadAnalogF64 to the AI task (since the system is using the clock source of the AI card). This just does not work with a PXI-4461. I have read the documentation on the DSA cards but I just don't get it.

 

Thanks.

0 Kudos
Message 1 of 4
(6,585 Views)

Are your AI and AO measurements occuring, just with some partial delay? Is there a picture of your data that you could provide as well?

Rob W.
0 Kudos
Message 2 of 4
(6,550 Views)

Rob, The AO and AI measurements are occuring, but there is a partial delay. For the purpose of this discussion, I have the AO0 connected to AI0 and AO1 connected to AI1, all on the same PXI-4461. The included figure shows what is going on. This figure shows the voltage (both output and input) measured as a function of clock sample. The sample rate is set to 204800 Hz. The blue line, labeled as "Play File" is the data sent into the AO0 channel using DAQmxWriteAnalogF64. The green line, labeled as "Measured Output" is the data read in on the AI0 channel using DAQmxReadAnalogF64. 

 

At first glance it seems strange that the output leads the input but keep the following in mind. The way the play file is started here is with a call to DAQmxStartTask immediately before the call to the DAQmxReadAnalogF64. The blue curve is then the ideal play file. The output starts playing then the input starts measuring, so once the input starts, there are actually some samples that are lost at the beginning. When the ideal play file and the measured output are plotted on the same plot as a function fo samples, it looks like the input is actually leading the output, but it is not.

 

This here is the true problem. I need the play file to start when the DAQmxReadAnalogF64 is called, not when the DAQmxStartTask  is called (and I'll mention autostart is set to zero).

 

 

0 Kudos
Message 3 of 4
(6,503 Views)

I do believe this may be the culprit. Take a look at this articles linked below. 

 

ADC Filter Delay of DSA Devices:

http://digital.ni.com/public.nsf/allkb/F989B25FF6CA55C386256CD20056E27D

 

PXI-446X Spec document: (See page 5 for your specific question)

http://digital.ni.com/manuals.nsf/websearch/0A30E9AB873ED45586257508004D645F

 

Simply, you will have to account for the 63 sample delay/offset that occurs with these cards. Its based off the circuitry and internals of how our DSA devices operate. Based on the screenshots you supplied, this seems to be why you have a slight delay.

 

 

Rob W.
0 Kudos
Message 4 of 4
(6,490 Views)