Jump to content

Question

Posted (edited)

Hello,

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.TerminalConfig='SingleEnded';
in0.Coupling='AC';
in0.ExcitationCurrentSource='Internal';
in0.ExcitationCurrent = .002;

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

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

% 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).

read_data.png

Zoomed in below

read_data_zoomed.png

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,
Domme

Edited by Domme

2 answers to this question

Recommended Posts

  • 0
Posted

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.

image.png

 

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

image.png

 

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. 

image.png

 

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.

Regards,

Fausto

  • 0
Posted

Hello Fausto,

thanks a lot. Reverting to 7.8.2 fixed the problem and now I am able to produce a clean sine wave.

Kind regards,
Domme

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...