I'm testing my DT9847-2-2, I connected analog output 0 to analog input 0 and, by using QuickDaq software, I'm able to produce a sinusoidal wave and to acquire it on the analog input. I'm also checking with an oscilloscope and the operation looks fine.
Now, I'm trying a simple matlab script (attached as .m file and copied at the bottom of the question) which should do exactly the same. If I plot the generated signal (i.e. dout, figure1) I can see the proper sinusoidal function, while if I plot the acquired analog input I see something like this:
On the oscilloscope, I see the voltage going from 0 to -10 V, and then going back to 0 gradually when the command delete(s) is performed.
I installed version 7.8.9 of the DT software (I also tried version 7.8.2, same result) and I applied the fix to the scripts "AsyncOLChannel" and "ChannelGroupOL", which solved the first Matlab errors.
Any suggestion?
Thank you very much
MATLAB SCRIPT
%% Initialize DT DAQ
clear
close all
clc
dev = daq.getDevices(); % NEEDED to obtain correct Device Name for DT9847
devID = dev.ID; % ID for the DT9847
% Sets up session with the DT-DAQ (Needed to setup the session)
s=daq.createSession('dt');
Rate = 50000;
Duration = 2;
tout = 0:1/Rate:Duration;
fout = 10;
dout = 0.9*sin(2*pi*fout*tout).';
% Set Sampling Rate
s.Rate = Rate;
% Setup output channel as Voltage with the default range
Question
Paolo Neri
I'm testing my DT9847-2-2, I connected analog output 0 to analog input 0 and, by using QuickDaq software, I'm able to produce a sinusoidal wave and to acquire it on the analog input. I'm also checking with an oscilloscope and the operation looks fine.
Now, I'm trying a simple matlab script (attached as .m file and copied at the bottom of the question) which should do exactly the same. If I plot the generated signal (i.e. dout, figure1) I can see the proper sinusoidal function, while if I plot the acquired analog input I see something like this:
On the oscilloscope, I see the voltage going from 0 to -10 V, and then going back to 0 gradually when the command delete(s) is performed.
I installed version 7.8.9 of the DT software (I also tried version 7.8.2, same result) and I applied the fix to the scripts "AsyncOLChannel" and "ChannelGroupOL", which solved the first Matlab errors.
Any suggestion?
Thank you very much
MATLAB SCRIPT
%% Initialize DT DAQ
clear
close all
clc
dev = daq.getDevices(); % NEEDED to obtain correct Device Name for DT9847
devID = dev.ID; % ID for the DT9847
% Sets up session with the DT-DAQ (Needed to setup the session)
s=daq.createSession('dt');
Rate = 50000;
Duration = 2;
tout = 0:1/Rate:Duration;
fout = 10;
dout = 0.9*sin(2*pi*fout*tout).';
% Set Sampling Rate
s.Rate = Rate;
% Setup output channel as Voltage with the default range
chOut0 = addAnalogOutputChannel(s, devID,'0', 'Voltage');
chIn0 = addAnalogInputChannel(s, devID ,'0', 'Voltage');
% Queue the output to be output to the channel
queueOutputData(s, dout);
figure(1)
plot(dout)
% Transmit the output based on sampling rate and data samples queued
[din, tin] = startForeground(s);
delete (s);
figure(2)
plot(tin, din)
DT9847_InOut_Test.m
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now