Jump to content
  • 0

DT9837C - Analog output in MATLAB is getting distorted




I would like to generate sine waves in MATLAB and send them to an external amplifier via DT9837C. This is the code I am using:

d = daq('dt');

% Define Channels

% Microphone
in0 = addinput(d, "DT9837-C(00)", "0", "IEPE");
in0.Range = [-1 1];
in0.ExcitationCurrent = .002;

% Distance sensor
in1 = addinput(d, "DT9837-C(00)", "1", "Voltage");
in1.Range = [-10 10];

% Output Feedback
in2 = addinput(d, "DT9837-C(00)", "2", "Voltage");
in2.Range = [-10 10];

% Output
out = addoutput(d, "DT9837-C(00)", "0", "Voltage");

% Measurement parameters
duration = 2;
samplerate = 96000;
freq = 200;
d.Rate = samplerate;

% Generate output signal
dt = 1/samplerate;        % s / Sample
t = (0:dt:duration)';            % s
outputdata = 1*sin(2*pi*freq*t);

[data,time] = readwrite(d,outputdata,"OutputFormat","Matrix");

The sine waves look fine if I check with 'plot(time, outputdata)'. However, the signal coming out of the DT9837A does not sound like a sine wave. If I feed the output channel signal back into input channel 2 and plot it using 'plot(time, data)'  it gives a diagram which looks like the pictures attached to this post. The frequency is correct, but the shape of the signal does not represent a sine wave at all. Instead, it is composed of asymmetrical small bursts of 48kHz (which is half of my sampling rate).


Zoomed in below


If I use QuickDAQ with otherwise same setup, it generates a clean sine wave. But not in MATLAB. What am I doing wrong here?

Kind regards,

Edited by Domme
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @Domme.

Your analog output issue is due to an existing bug.  For a streaming analog output operation in MATLAB, the 'Data Acquisition Toolbox Support Package for Data Translation Hardware' (a.k.a DT daq adapter for MATLAB) relies on an older software version of DT Open Layers. 

Please open your Windows ->Control Panel->Programs and Features showing the Data Translation software and version column, like the one below.  (Click the Publisher header to sort the list.)  You will need to revert back to DT Open Layers v7.8.2.



Begin within MATLAB to uninstall the 'Data Acquisition Toolbox Support Package for Data Translation Hardware' via the Add-On Manager.



Afterwards, close MATLAB and open Windows ->Control Panel->Programs and Features.  Uninstall all programs with Data Translation as the publisher.  Reboot your system and download the DT-Open Layers v7.8.2 installer (zip file).  Unzip the file and install the DT software.  Next, verify the DT-Open Layers version in Windows ->Control Panel->Programs and Features. 



If the DT Open Layers programs show v7.8.2, then launch MATLAB to reinstall the 'Data Acquisition Toolbox Support Package for Data Translation Hardware' via the Add-On Manager.  Retest your example script afterwards to confirm whether or not your issue was resolved.



Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...