Why it shows“Not all channels support on-demand operations. Only clocked operations are allowed”when I use NI-DAQ to acquire data?
34 views (last 30 days)
Show older comments
Hi, all,
When I want to use MATLAB (R2022b-academic use) to control NI-USB 4431 to acquire data, the command window shows "Not all channels support on-demand operations. Only clocked operations are allowed." What does this mean? I can't figure out how to solve it (I have installed NI-DAQmx toolbox, version 22.2.0). Here is the code:
dq = daq("ni");
dq.Rate = 8000;
ch1 = addinput(dq, d.DeviceID, "ai1", "Voltage");
tabledata = read(dq)
In addition, the NI-4431 device information is as follows.
ni: National Instruments(TM) USB-4431 (Device ID: 'Dev1')
Analog input supports:
-10 to +10 Volts range
Rates from 1000.0 to 102400.0 scansc
4 channels ('ai0','ai1','ai2','ai3')
'Voltage','Accelerometer','Microphone','IEPE' measurement types
Analog output supports:
-3.5 to +3.5 Volts range
Rates from 800.0 to 96000.0 scansc
1 channel ('ao0')
'Voltage' measurement type
Thanks!
0 Comments
Answers (1)
Manikanta Aditya
on 20 Mar 2023
Hi Hunag,
As per my understanding, you are getting error saying ‘Not all channels support on-demand operations. Only clocked operations are allowed.’ When trying to use NI-DAQ to acquire data.
The specific input channel you are trying to use does not support on-demand operations, which is when data is acquired on demand as opposed to at a regular interval. Instead, it only supports clocked operations, which require you to specify a regular clock signal to trigger data acquisition.
As a workaround, you can add a clock signal to your data acquisition session by using the "addclock" function.
dq = daq("ni");
dq.Rate = 8000;
ch1 = addinput(dq,"Dev1","ai1","Voltage");
clock = addclock(dq,"ScanClock","ai1",dq.Rate);
start(dq,"Duration",1);
tabledata = read(dq)
For further reference, please check out this link to know more about ‘addclock’ function:
I hope this resolves the issue you are facing.
1 Comment
KOLBY
on 2 Jul 2024
Hello,
I am facing a similar issue when using a MCC USB 205 DAQ board. I receive "Added channel does not support clocked sampling: clocked operations are disabled. Only on-demand operations are allowed. " after adding an output channel. Additionally, this sets the Rate of the board to 0, preventing me from implementing a clock.
While this is the opposite warning, do you know how to use simultaneous analog input and output given the error received?
Is this a limitation of the board, or is there a workaround in MATLAB?
Thank you,
KS
Code used to troubleshoot, error follows that readwrite is limited to clocked operations.
clear; clc; close all;
d = daq("mcc")
addoutput(d, "Board1","ao1","Voltage");
d
addinput(d, "Board1","ai0","Voltage");
d
% clock = addclock(d,"ScanClock","Board1/ai0",d.Rate);
outScanData = linspace(0,1,d.Rate)'; % Increase output voltage with each scan.
inScanData = readwrite(d,linspace(0,1,d.Rate)');
See Also
Categories
Find more on Analog Data Acquisition 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!