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: 

Continuous AI acquisition, triggering an AO waveform

Maybe off the wall here, but I didn't see a good way to do it (and my way sucks)...
 
Ideally:
I want to continously sample analog inputs (AI0-4 RSE, AI5 Differential [working on the diff. part too]), and set a trigger so that X ms after AI3 > 4V, a waveform will be generated on AO0 (continously),  Y ms after AI4 > 6V, I want a one-shot waveform on AO1.  After Z ms of AI3 < 2V, the waveform on AO0 will be stopped, not affecting AO1's output in any way.
 
AI's sampling at 1MS/s, AO's are generating at 10KHz, and the AO waveform is ~ 100 samples long (if that)
X, Y, and Z may be up to 20,000 (20 seconds later)
(Items italicized are pickable selection boxes)
My AO's are digital (for now), but I want to synchronize/trigger them off AI's so my current AO waveform is just a series of 0/5 pulses.
What I do now (as Traditional DAQ; I haven't redone it in DAQmx yet):
Start the AI acqusitions and AO at a "quiescent value".  After each read from the AI buffers, I use LabView's Threshold vi to find "when the trigger was met", and store that as T0.  When T0+X < AO buffer size, I AO Write and AO Start the waveforms (with left-side padding in an attempt to synchronize the tasks) on the appropriate channels.
 
AI Buffer size= 8K, AO buffer size=1K (though my AO waveform is ~180 samples long).
 
I get up to 300ms of jitter doing it this way, and the AO's aren't truely separate (stopping AO0 glitches AO1).
 
I think I can reduce the jitter by altering the loop timing once I receive the trigger, but I would really be interested if DAQmx (High Speed M series) could do this triggering in hardware (or maybe some combo of storing T0+X on the card and...)...
 
0 Kudos
Message 1 of 6
(3,258 Views)

Wow, that's quite an application! I'm pretty sure everything you want to do is possible, but it would require multiple DAQ devices and some pretty creative programming.

First off, to make analog output hardware-timed from an analog input trigger, you will need to use the Analog Comparison Event. The High-Speed M Series devices have 1 analog trigger, so you will need an additional device for each trigger. Some of your triggers (such as stopping the analog output) may not be as high-priority (in terms of minimizing jitter), in which case you could do some of this triggering in software and save yourself a DAQ card. If the X,Y, and Z values are sufficiently long enough, you could reconfigure the trigger instead.

As stated here, you will not be able to do continuous analog input and use that same line to trigger. The continuous analog input and the trigger will have to be separated.

To have the AO stop at a given time, you will have to use a Pause Trigger. This will require another analog trigger. Using the DAQmx Trigger Property Node, you can pause the output of your waveform much like you would pause the input of a waveform on an AI task. When the trigger condition is satisfied, the waveform will be output; when the trigger condition is not satisfied, the analog output pin's value will not change.

To have the delay between receiving the analog input trigger and beginning the analog output, use the DAQmx Trigger Start Delay Property Node.

Take a look at this article for general synchronization knowledge.

--
Michael P
National Instruments
Message 2 of 6
(3,224 Views)

Excellent.  Thank you!

I also have an E-Series DAQ card in the computer; would it be possible to use that card for triggering, and the M-Series for AI/AO?  Would I have to apply the same signals to both cards, or can they be routed in software/driver/rtsi/???

To have the AO stop at a given time, you will have to use a Pause Trigger. This will require another analog trigger. Using the DAQmx Trigger Property Node, you can pause the output of your waveform much like you would pause the input of a waveform on an AI task. When the trigger condition is satisfied, the waveform will be output; when the trigger condition is not satisfied, the analog output pin's value will not change.

Can I specify the "idle" value (aka, Output the waveform while AI0 is >5V, but make sure it is 0 if AI0 <5V -- I want to send a 200A signal, not make a spot-welder)?
 
This is actually my first time delving into a "real" DAQ application (all of my other experience has been interfacing to T&M equip thru GPIB/Ethernet), so I guess I was a little naive when I was thinking of the functionality.  More or less, this is waiting for a certain contact pressure, then applying a signal thru the pin.  I was trying to use the 2nd AO channel as a bang-bang loop control to regulate the pin's pressure (right now, I've got a small micro doing the task, but was hopeing to integrate it all under PC control).
Many thanks,
Thor Johnson
 
0 Kudos
Message 3 of 6
(3,202 Views)
From the KB:

Solution: AI Start Trigger.vi will trigger all of the analog in channels. Thus, there is no simple hardware solution that can do analog in triggered and analog in continuous on the same DAQ device. However, this task can be easily accomplished by using two DAQ boards. One DAQ board can do the analog in trigger and another DAQ board can do the continuous analog in.

It doesn't look like I can't use an Analog Comparison Event to start the AO while doing continuous AI (just can't have eg 4 channels AIcont & 2 channels AI Trig)  -- maybe with the DAQmx Signal Routing to go to the counter and the counter to be the AO Trigger; could you elaborate?

 

Thank you,
Thor Johnson

0 Kudos
Message 4 of 6
(3,199 Views)
Thor,
 
This is the answer to your 2nd to last post. Your E Series device may or may not have analog triggering capabilities. Check this KnowledgeBase article to find out. The analog output will maintain the last value you wrote to it until you clear the task. If you want it to output 0V, you have to explicitly do a DAQmx Write of 0 after your output has completed.
--
Michael P
National Instruments
0 Kudos
Message 5 of 6
(3,191 Views)
You would have to separate these two things - have your signal wired into two different DAQ devices. One of those DAQ devices does continuous analog input, the other one uses a trigger.
--
Michael P
National Instruments
0 Kudos
Message 6 of 6
(3,193 Views)