Why do my input initialize the correct voltage, then accumulate to 10V
6 views (last 30 days)
Show older comments
We're seeing a different value in Matlab than we are in DAQami.
My versions:
Windows 10
Instacal 6.60
Matlab 2024a
Data Acquisition Toolbox Support Package for Measurement Computing Hardware 24.1
We expect about 6 V and 0.5-0.9 Volts
DAQami (native MCC software) is reading thosevalues correctly, but MATLAB when using slightly modified script of the example script at https://www.mathworks.com/help/daq/getting-started-with-session-based-interface-using-mcc-devices.html
we get these followings results where it starts at the correct values but then increases immediately to 10 V for both input channels. See attached graph.
%% Discover Available Devices
% Discover devices connected to your system using |daqlist|. To learn more
% about an individual device, access the entry in the device table.
d = daqlist("mcc");
d(1, :)
%% Create a DataAcquisition
% The |daq| function creates a DataAcquisition object. The DataAcquisition
% contains information describing hardware, scan rate, and other properties
% associated with the acquisition.
dq = daq("mcc")
%% Add an Analog Input Channel
% The |addinput| function attaches an input channel to the DataAcquisition.
% You can add more than one channel to a DataAcquisition.
addinput(dq, "Board0", "Ai5", "Voltage");
addinput(dq, "Board0", "Ai6", "Voltage");
dq
%% Change Default Properties of the Acquisition
% By default, acquisitions run for one second at 1000 scans per second. To
% acquire at a different rate, change the |Rate| property.
dq.Rate = 100;
%%
% Run the acquisition and plot the acquired data:
[data, startTime] = read(dq, seconds(3));
hold on;
plot(data.Time, data.Board0_Ai5);
plot(data.Time, data.Board0_Ai6);
hold off;
xlabel("Time (s)");
ylabel("Voltage (V)");
0 Comments
Answers (1)
Divyam
on 27 Aug 2024
Edited: Divyam
on 27 Aug 2024
It may happen that while using the Data Acquisition Toolbox Support Package for your hardware, the signal is running into an overrange condition. To avoid this issue, you can set up the "Range" and "TerminalConfig" of the input channels.
ch1 = addinput(dq, "Board0", "Ai5", "Voltage");
ch1.Range = [5.5 6.5];
ch1.TerminalConfig = "SingleEnded"
ch2 = addinput(dq, "Board0", "Ai6", "Voltage");
ch2.Range = [0.5 0.9];
ch2.TerminalConfig = "SingleEnded"
To learn more about the "Range" and "TerminalConfig" properties for input channels, refer to this documentation: https://www.mathworks.com/help/daq/channel-properties.html
0 Comments
See Also
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!