Skip to content

Commit 893bca2

Browse files
committed
A single device ID for AO and AI.
1 parent 4a28f81 commit 893bca2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

code/+vidrio/+mixed/AOandAI_OO.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444

4545
% Define properties that we will use for the acquisition
4646
properties
47+
DAQdevice = 'Dev1'
48+
4749
%Properties for the analog input end of things
4850
hAITask %The AI task will be kept here
49-
AIDevice = 'Dev1'
5051
AIChans = 0:1
5152
AIterminalConfig = 'DAQmx_Val_RSE' %Valid values: 'DAQmx_Val_Cfg_Default', 'DAQmx_Val_RSE', 'DAQmx_Val_NRSE', 'DAQmx_Val_Diff', 'DAQmx_Val_PseudoDiff'
5253

5354
%Properties for the analog output end of things
5455
hAOTask %The AO task will be kept here
55-
AODevice = 'Dev1'
5656
AOChans = 0:1
5757

5858
% Shared properties
@@ -147,8 +147,8 @@ function connectToDAQandSetUpChannels(obj)
147147
obj.hAOTask = dabs.ni.daqmx.Task('mixedAO');
148148

149149
% Set up analog input and output voltage channels
150-
obj.hAITask.createAIVoltageChan(obj.AIDevice, obj.AIChans, [], obj.minVoltage, obj.maxVoltage, [], [], obj.AIterminalConfig);
151-
obj.hAOTask.createAOVoltageChan(obj.AODevice, obj.AOChans);
150+
obj.hAITask.createAIVoltageChan(obj.DAQdevice, obj.AIChans, [], obj.minVoltage, obj.maxVoltage, [], [], obj.AIterminalConfig);
151+
obj.hAOTask.createAOVoltageChan(obj.DAQdevice, obj.AOChans);
152152

153153

154154
% * Set up the AI task
@@ -173,7 +173,7 @@ function connectToDAQandSetUpChannels(obj)
173173
obj.hAOTask.writeAnalogData(obj.waveforms, 5)
174174

175175
% Configure the AO task to start as soon as the AI task starts
176-
obj.hAOTask.cfgDigEdgeStartTrig(['/',obj.AIDevice,'/ai/StartTrigger'], 'DAQmx_Val_Rising');
176+
obj.hAOTask.cfgDigEdgeStartTrig(['/',obj.DAQdevice,'/ai/StartTrigger'], 'DAQmx_Val_Rising');
177177
catch ME
178178
daqDemosHelpers.errorDisplay(ME)
179179
%Tidy up if we fail

code/+vidrio/+mixed/AOandAI_OO_sharedClock.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636

3737
% Define properties that we will use for the acquisition
3838
properties
39+
DAQdevice = 'Dev1'
40+
3941
%Properties for the analog input end of things
4042
hAITask %The AI task will be kept here
41-
AIDevice = 'Dev1'
4243
AIChans = 0:1
4344
AIterminalConfig = 'DAQmx_Val_RSE' %Valid values: 'DAQmx_Val_Cfg_Default', 'DAQmx_Val_RSE', 'DAQmx_Val_NRSE', 'DAQmx_Val_Diff', 'DAQmx_Val_PseudoDiff'
4445

4546
%Properties for the analog output end of things
4647
hAOTask %The AO task will be kept here
47-
AODevice = 'Dev1'
4848
AOChans = 0:1
4949

5050
% Shared properties
@@ -141,16 +141,16 @@ function connectToDAQandSetUpChannels(obj)
141141
obj.hAOTask = dabs.ni.daqmx.Task('mixedAO');
142142

143143
% 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);
146146

147147

148148
% * Set up the AI task
149149

150150
% Configure the sampling rate and the buffer size
151151
% ===> SET UP THE SHARED CLOCK: Use the AO sample clock for the AI task <===
152152
% 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']);
154154

155155
% Read back the data with a callback function at an interval defined by updatePeriod
156156
% Also see: basicConcepts/anonymousFunctionExample.
@@ -169,7 +169,7 @@ function connectToDAQandSetUpChannels(obj)
169169
obj.hAOTask.writeAnalogData(obj.waveforms, 5)
170170

171171
% 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');
173173
catch ME
174174
daqDemosHelpers.errorDisplay(ME)
175175
%Tidy up if we fail

0 commit comments

Comments
 (0)