10-12-2015 06:54 PM
Hi all, I've been struggling for some time trying to get the simultaneous acquisition of analog voltage and thermocouple data to work. Solely, the analog input works just fine but when the code for thermocouples is added errors are displayed. I am using the NI cDAQ-9172 and am programming in MatlabR2015a. Below is the current code, any tips would be greatly appriciated!
global s;
s = daq.createSession('ni');
addAnalogInputChannel(s,'cDAQ1Mod1', 0, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 1, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 2, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 3, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod5',0, 'Thermocouple');
tc = s.Channels(5);
set(tc);
tc.ThermocoupleType = 'K';
tc.Units = 'Celsius';
s
figure
s.Rate = 10000;
s.IsContinuous = true;
lh = addlistener(s,'DataAvailable', @graphData);
s.NotifyWhenDataAvailableExceeds = 1000;
s.startBackground();
s.wait();
pause(.001);
10-13-2015 12:54 AM
This sounds like a technical question, not an idea for a new product feature and is thus offtopic here.
Please decide where it should go and have the moderator move it to the correct forum.