1+ # Synchronising DAQ operations across devices
2+
13The examples in this folder relate to synchronising tasks.
24It's assumed you're already familiar with the information in vidrio.mixed
35Also see ContinuousAI.c in the DAQmx_ANSI_C_examples directory
46
57### One
68Let's start two tasks at the same time on different DAQs from the command line.
79Hook up the AO0 lines of each DAQ to a scope then run:
10+
11+ ```
812>> B=vidrio.sync.sine_AO_AI('Dev1');
913>> R=vidrio.sync.sine_AO_AI('Dev2');
1014>> B.startAcquisition;R.startAcquisition;
15+ ```
1116
1217Where 'Dev1' and 'Dev2' are your DAQ names.
1318You should see two waveforms with a phase shift.
1419Trigger off the waveform on channel 1 of the scope and change the time scale to show about one cycle of the waveform.
1520Watch for a while. What do you notice?
1621
1722Stop the acquisition:
23+ ```
1824>> B.stopAcquisition;R.stopAcquisition;
19-
25+ ```
2026
2127### Two
2228Will this problem go away if start the two waveforms at exactly the same time?
@@ -27,17 +33,20 @@ Set up triggers so nothing happens until 5V goes into PFI0
2733
2834Now wire up the rack so that the two PFI0 ports are connected. If using BNC, attach a T-piece to one.
2935
36+ ```
3037>> B.startAcquisition;R.startAcquisition;
38+ ```
3139
3240Nothing happens on the scope until you hook up PFI0 (e.g. with your T connector) to +5 (the breakout box provides this)
33- You can un-plug the 5V line right away, it's only needed transiently for the trigger.
41+ You can unplug the 5V line right away, it's only needed transiently for the trigger.
3442
3543What do you see on the scope? The waveforms should be in phase perfectly. Nice, huh?
3644Keep watching. Ah.....
3745
3846Stop the acquisition:
47+ ```
3948>> B.stopAcquisition;R.stopAcquisition;
40-
49+ ```
4150
4251### Three
4352Clearly we need a shared clock between the boards.
@@ -48,8 +57,10 @@ Ensure the stopAcquisition methods have been run.
4857
4958If your cards are in a PXI chassis or linked by an RTSI cable then just do:
5059
60+ ```
5161>> B.hAOTask.cfgSampClkTiming(B.sampleRate,'DAQmx_Val_ContSamps', size(B.waveform,1), ['/',R.DAQdevice,'/ao/SampleClock'])
5262>> B.startAcquisition;R.startAcquisition;
63+ ```
5364
5465Then trigger.
5566Easy: no more phase delay!
0 commit comments