Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

how to synchronize AI and AO?If DO can use the Hardware timed clock single point

how to synchronize AI and AO?
In the Labview 7.1 example"PID Control-Signal Source" which can be found in the directory:hardware input and output/daqmx/control/general/PID Control-Signal Source.vi, there a puzzle for me.
1、Two sample clock are used to synchronize the AI and AO. My problem is that, after the AI,there is a PID calculation,then the AO occurs. Since the AO occurs after the AI, why the example use two sample clock. Whether only a smple clock is OK?
2、In the example,AI and AO use two timing with the same source.In the timed loop,at first a set of samples are read,then send to PID calcaltion module.And then The rusult are written to the AO. Is the write and read happens at the same time?
If so,what data is the DAQmx Write?
help.
Thanks a lot!
 
 
If DO can use the Hardware timed clock single point?
I want to DO at 100Hz.
 
0 Kudos
Message 1 of 3
(3,275 Views)
I will try to take a stab at this
 
#1.  2 sample clocks are not used to synchronize in this example.  Only the ai sample clock is used.  It is used for both the AI and AO task.  Because the AO task is using it maybe that confused you, but the AI sample clock is used to ensure the synchronization between the input and output.
 
#2.  Not exactly sure what you are asking but take a shot.  The read and the write in SW happen at different times because of the data flow but in HW the read and write occur at the same instant in time (because they are sharing the AI sample clock).  So, as in most control apps you need to be careful on the first iteration.  The write is always i-1 away from the read.  So at time t0 data is read in and written out (what is written out is garbage.  A calculation is then made base on the read from t0 and written out to the FIFO (i.e. the write doesn't show up on your data pin yet).  Then at time t1 the next sample clock happens, the data from t0 is written out to the data pin, new data is read, calculations are made and everything starts over again.
 
#3.  DO can not do HWTSP
 
Hope this helps out
StuartG
Message 2 of 3
(3,268 Views)
Thanks you Stuart G .
Your reply helps a lot.
.
0 Kudos
Message 3 of 3
(3,262 Views)