Timeout error NI DAQ recording encoder Position or EdgeCount using clock

2 views (last 30 days)
I wish to record timestamped data from a quadrature encoder using an NI DAQ USB-6341 but I receive the "timeout" error below. Thank you for your help.
>>[data, time] = s.startForeground()
Timeout expired before operation could complete.
This script works correctly (Analog channel only, third line commented-out):
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
%addCounterInputChannel(s,'Dev1', 0, 'EdgeCount');
s.DurationInSeconds = 0.25;
[data, time] = s.startForeground();
plot(time, data);
This script gives the timeout error mentioned above (third line active):
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
addCounterInputChannel(s,'Dev1', 0, 'EdgeCount');
s.DurationInSeconds = 0.25;
[data, time] = s.startForeground();
plot(time, data);
This script (analog and digital single scans) works correctly too:
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
addCounterInputChannel(s, 'Dev1', 0, 'EdgeCount');
data = inputSingleScan(s)
I based those scripts on the examples which I cannot run fully (timeout error above) from:
Thank you,
Guillermo

Answers (0)

Categories

Find more on Periodic Waveform Generation 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!