Effacer les filtres
Effacer les filtres

Changing range voltage for NI acquisition : how to solve : Warning: Cannot support range of -5.0 to +5.0 Volts. Range set to -10 to +10 Voltt ?

19 vues (au cours des 30 derniers jours)
i try to change voltage range for NI card acquisition. If i use Daq Express or labview it works but from matlab i can't.
The code :
% %% acquisition
dq = daqlist("ni")
deviceInfo = dq{1, "DeviceInfo"}
dq = daq("ni")
dq.Rate = 2000;
ai2 = addinput(dq, "Dev5", "ai2", "Voltage");
ai2.Range = [-5 5];
ai2.TerminalConfig = "SingleEnded"
Et voici l'erreur :
Warning: Cannot support range of -5.0 to +5.0 Volts. Range set to -10 to +10 Volts.

Réponse acceptée

Mario Malic
Mario Malic le 22 Jan 2024
Modifié(e) : Mario Malic le 22 Jan 2024
It's just a warning, it will work, range is still in between -10V and 10V. Why wouldn't you utilize the full range of your acquisition channel? For example, if you have a sensor with specific sensitivity that will produce Voltage signal that is above 5V or below -5V, you wouldn't measure signal correctly as it would be overloaded.
Also, this is a property of an acquisition card, some cards (maybe none?) do not support adjusting the range.
It might be of help, still in a development stage. I made this to acquire data from NI devices easily. Hopefully it works on R2021b. https://uk.mathworks.com/matlabcentral/fileexchange/128118-daqx
  3 commentaires
Mario Malic
Mario Malic le 22 Jan 2024
Modifié(e) : Mario Malic le 22 Jan 2024
It is not neccessary to change the range. This Range property is related to the acquisition device, not the sensor.
Your measurement device will output the 5V signal and it is not going to cause any issue with the measurement.

Connectez-vous pour commenter.

Plus de réponses (1)

Hassaan le 22 Jan 2024
  1. Driver Limitations: The MATLAB Data Acquisition Toolbox may not fully support all features of the NI hardware driver that are available in LabVIEW or NI-DAQmx.
  2. Hardware Constraints: The NI card itself may have limitations on the supported ranges based on the mode you're using (for example, SingleEnded vs. Differential).
  3. Software Configuration: The configuration of the NI card through MATLAB might have constraints that differ from the configuration through LabVIEW or NI-DAQmx.
Here are some steps to troubleshoot:
  • Check Compatibility: Ensure that your version of MATLAB, the Data Acquisition Toolbox, and the NI driver are all compatible and up-to-date.
  • Consult Documentation: Refer to the documentation for both your NI card and the MATLAB Data Acquisition Toolbox to confirm the supported voltage ranges.
  • Test Range Support: Try testing different supported ranges programmatically to see if any others are accepted. Sometimes, NI cards support a limited set of ranges in certain configurations.
  • Device Configuration: Check if the device needs to be configured differently in MATLAB compared to LabVIEW or NI-DAQmx.
  • Software Reset: Sometimes resetting the device configuration through the NI Measurement & Automation Explorer (MAX) can resolve software conflicts.
  • Contact Support: If you continue to experience difficulties, consider reaching out to MathWorks Support for assistance specific to the Data Acquisition Toolbox.
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.


En savoir plus sur Data Acquisition Toolbox Supported Hardware dans Help Center et File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by