36
36
37
37
% Define properties that we will use for the acquisition
38
38
properties
39
+ DAQdevice = ' Dev1'
40
+
39
41
% Properties for the analog input end of things
40
42
hAITask % The AI task will be kept here
41
- AIDevice = ' Dev1'
42
43
AIChans = 0 : 1
43
44
AIterminalConfig = ' DAQmx_Val_RSE' % Valid values: 'DAQmx_Val_Cfg_Default', 'DAQmx_Val_RSE', 'DAQmx_Val_NRSE', 'DAQmx_Val_Diff', 'DAQmx_Val_PseudoDiff'
44
45
45
46
% Properties for the analog output end of things
46
47
hAOTask % The AO task will be kept here
47
- AODevice = ' Dev1'
48
48
AOChans = 0 : 1
49
49
50
50
% Shared properties
@@ -141,16 +141,16 @@ function connectToDAQandSetUpChannels(obj)
141
141
obj.hAOTask = dabs .ni .daqmx .Task(' mixedAO' );
142
142
143
143
% Set up analog input and output voltage channels
144
- obj .hAITask .createAIVoltageChan(obj .AIDevice , obj .AIChans , [], obj .minVoltage , obj .maxVoltage , [], [], obj .AIterminalConfig );
145
- obj .hAOTask .createAOVoltageChan(obj .AODevice , obj .AOChans );
144
+ obj .hAITask .createAIVoltageChan(obj .DAQdevice , obj .AIChans , [], obj .minVoltage , obj .maxVoltage , [], [], obj .AIterminalConfig );
145
+ obj .hAOTask .createAOVoltageChan(obj .DAQdevice , obj .AOChans );
146
146
147
147
148
148
% * Set up the AI task
149
149
150
150
% Configure the sampling rate and the buffer size
151
151
% ===> SET UP THE SHARED CLOCK: Use the AO sample clock for the AI task <===
152
152
% The supplied sample rate for the AI task is a nominal value. It will in fact use the AO sample clock.
153
- obj .hAITask .cfgSampClkTiming(obj .sampleRateAO , ' DAQmx_Val_ContSamps' , [], [' /' ,obj .AODevice ,' /ao/SampleClock' ]);
153
+ obj .hAITask .cfgSampClkTiming(obj .sampleRateAO , ' DAQmx_Val_ContSamps' , [], [' /' ,obj .DAQdevice ,' /ao/SampleClock' ]);
154
154
155
155
% Read back the data with a callback function at an interval defined by updatePeriod
156
156
% Also see: basicConcepts/anonymousFunctionExample.
@@ -169,7 +169,7 @@ function connectToDAQandSetUpChannels(obj)
169
169
obj .hAOTask .writeAnalogData(obj .waveforms , 5 )
170
170
171
171
% Configure the AO task to start as soon as the AI task starts
172
- obj .hAOTask .cfgDigEdgeStartTrig([' /' ,obj .AIDevice ,' /ai/StartTrigger' ], ' DAQmx_Val_Rising' );
172
+ obj .hAOTask .cfgDigEdgeStartTrig([' /' ,obj .DAQdevice ,' /ai/StartTrigger' ], ' DAQmx_Val_Rising' );
173
173
catch ME
174
174
daqDemosHelpers .errorDisplay(ME )
175
175
% Tidy up if we fail
0 commit comments