Reading data from NI USB-6210

6 views (last 30 days)
Dejan Hrovatin
Dejan Hrovatin on 5 Mar 2017
Edited: Dejan Hrovatin on 5 Mar 2017
Hi!
I am using DAQ converter Ni USB-6210 for reading voltage. Because I need 4 differential inputs and 2 single ended input (and also different ranges), I run:
nidaq = daq.createSession('ni');
ch1=addAnalogInputChannel(nidaq,'dev1', 'ai0', 'Voltage');
ch1.TerminalConfig = 'Differential';
ch1.Range = [-5,5];
ch2=addAnalogInputChannel(nidaq,'dev1', 'ai1', 'Voltage');
ch2.TerminalConfig = 'Differential';
ch2.Range = [-5,5];
ch3=addAnalogInputChannel(nidaq,'dev1', 'ai2', 'Voltage');
ch3.TerminalConfig = 'Differential';
ch3.Range = [-5,5];
ch4=addAnalogInputChannel(nidaq,'dev1', 'ai3', 'Voltage');
ch4.TerminalConfig = 'Differential';
ch4.Range = [-1,1];
ch5=addAnalogInputChannel(nidaq,'dev1', 'ai4', 'Voltage');
ch5.TerminalConfig = 'SingleEnded';
ch5.Range = [-10,10];
...everything looks OK. Also if I type nidaq.inputSingleScan in a Command Window, I get 5 voltages, which corresponds to 5 channels. I hope that I will not have problems with mixing differential and single ended channels at the same time...
I want to read this five voltages on some function call. Singlescan is not good for me (singlescan give readings which corresponds to the voltages exactly on the call time), because on the function call I would like to get an average of readings between two calls of this function. Reading with 1000 samples/second (for each of 5 channels) is enough for me... For ex. I call function after 10 second (since calling nidaq = daq.createSession('ni');) and this function give to me an average of 10.000 samples for each of 5 voltages for the past 10 seconds...then I call this function 6 seconds later, and this function give to me an average of 6.000 samples for each of 5 voltages...
I know that I must run this function in the background. But is my idea supported by Data Acquistion Toolbox? I am slightly confused with documentation of this toolbox.
Thank you!

Answers (0)

Categories

Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!