Data Acquisition with ADLINK DAQe-2006
3 views (last 30 days)
Show older comments
Hi MATLAB Community,
I am having difficulty acquiring data with the ADLINK card. This is my setup.
%%Capture a Single Analog Input Signal
ai_device = analoginput('mwadlink', 0)% Opens the analog input functionality
ai0 = addchannel(ai_device, 0)%Add channel #0 to ai_device
ai1 = addchannel(ai_device, 1)%Add channel #1 to ai_device
%%Single Sample
getsample(ai_device)%Read the voltage value on channel #0
The getsample(ai_device) works fine as expected. But when I try continuous sampling:
%%Continuous Sample Setting
set(ai_device, 'SampleRate', 1000)%Set SampleRate to 1000
set(ai_device, 'SamplesPerTrigger', 5000)%Set SamplePerTriger to 1000
start(ai_device) %Start data acquisition
get(ai_device, 'Running')
wait(ai_device, 10)%Wait for data acquisition to complete (wait timeout is 10 seconds)
get(ai_device, 'SamplesAcquired')
[time, ai_data] = getdata(ai_device);%Get the waveformcaptured by ai_device object
The 'SamplesAcquired' property shows 64, and the getdata function returns an empty array.
The 'BufferingMode' is 'Auto' and the 'BufferingConfig is [64 30].
What's wrong?
Side Note: =========== I tried continuous sampling by using getsample function with the following code:
n = 100 d = zeros(n,2); t = zeros(n,1);
tic for i = 1:n t(i) = toc; d(i,:) = getsample(ai_device)%Read the voltage value on channel #0 pause(.001) end
It turns out that the ADLink only returns a sample about every 1.5 seconds. Trying the same code on another DAQ (DT9816-S) returns a sample about every .001 seconds.
1 Comment
muhammad choudhry
on 10 Mar 2021
lolz, after 8 years I am having the same problem. Stupid to ask but still asking haha did you get it sorted ?
Answers (0)
See Also
Categories
Find more on Data Acquisition Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!