Acquire and generate data simultaneously with NiDAQ USB 6211
조회 수: 3 (최근 30일)
이전 댓글 표시
I'm trying to generate and acquire data with this device but at the moment I've only achieved to generate and acquire in separated functions following the toolbox examples. I did this with the "startForeground" function. I thought that if I did this with "startBackground" instead it will be really easy but again I only managed to get background data in separated functions.
My goal it's to acquire data in the background for a long time while I generate data in the foreground with some loops and such. Is this possible?
If not I think I could manage acquiring and generating data in several sessions and after that sum all acquired data but I don't know how to do this. Could you help please?
Here's the code I have so far that doesn't work:
sIn = daq.createSession('ni');
sIn.Rate = samplesPerSec ;
sIn.DurationInSeconds = timeLenght;
ch1 = addCounterInputChannel(sIn,'Dev1', 'ctr0', 'Position');
ch1.TerminalA; ch1.TerminalB; ch1.TerminalZ;
ch1.EncoderType = 'X2';encoderCPR = 8192/4;
addAnalogInputChannel(sIn,'Dev1','ai1','Voltage');
addAnalogInputChannel(sIn,'Dev1','ai5','Voltage');
addAnalogInputChannel(sIn,'Dev1','ai6','Voltage');
addAnalogInputChannel(sIn,'Dev1','ai2','Voltage');
addAnalogInputChannel(sIn,'Dev1','ai4','Voltage');
addAnalogOutputChannel(sIn,'Dev1','ao1','Voltage');
Vout = linspace(outputValue,outputValue,samplesPerSec*timeLenght);
sIn.queueOutputData(transpose(Vout));
[data,timestamps] = startForeground(sIn);
I don't get any error but either get any output values
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!