Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Syncronous AO-AI

Solved!
Go to solution

I wish to generate an output voltage and read an input signal, both at the same time. Both process(generation/reading) should start at the same time.

I have attached the VI i used to perform this operation. 

DO I NEED TO ADD ANYTHING ELSE? HOW DO I TEST IF ITS WORKING FINE ?

 

0 Kudos
Message 1 of 3
(2,998 Views)

Hi vishnu7,

 

Check out this resource on Timing and Synchronization Features of NI-DAQmx. Section 5 describes synchronized analog input and output. There is also an example where synchronized analog input and output is implemented. You should try to edit your VI to mimic this structure as closely as possible. Let me know if you have any further questions!

 

David B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,983 Views)
Solution
Accepted by topic author vishnu7

Timing and Synchronization Features of NI-DAQmx is good background information but the code vishnu7 linked seems fine to me with one exception (possibly 2):

 

1.   You should use the "Act input rate" to set the rate of your output task.  DAQmx actually rounds differently for AI and AO tasks (AI always rounds up, AO to nearest available rate).

 

(2.) I'd suggest using "Wait Until Done" on your AO task instead of "Is Task Done".  It shouldn't really matter here though since the DAQmx Read will block and when it is finished the AO task will be done anyway.

 

 

If you need to convince yourself that the tasks are synchronized you could export sample clocks and scope them, but I wouldn't do this myself unless I had some reason to suspect the tasks were not synchronized.  

 

*Keep in mind that sharing a trigger and nothing else only works because the tasks are on the same device (if you had AI on Dev1 and AO on Dev2 for example you would have to either share a sample clock or a timebase to ensure the clocks wouldn't drift over time).

 

**Also keep in mind that the AO takes time to update to the value that you set.  You might want to add some delay to the time the AI Sample is taken to allow for the AO to settle if you are looking for a 1:1 match of AO and AI samples.  On a multiplexed device I would do this by using the AI Convert DelayFromSampleClock DAQmx Timing property.

 

 

Best Regards,

John Passiak
0 Kudos
Message 3 of 3
(2,969 Views)