rate of acquisition with DAQ board not equal to s.Rate

1 回表示 (過去 30 日間)
John
John 2017 年 6 月 6 日
回答済み: Sid Jhaveri 2017 年 6 月 9 日
I'm using the Data Acquisition Toolbox to create TTLs using outputSingleScan with a NI DAQ USB 6002. I want the single scan to be .05 seconds long (A rate of 20 scans per second).
d = daq.getDevices;
d(1);
s = daq.createSession('ni');
ch = addAnalogOutputChannel(s,'Dev2', 'ao0', 'Voltage');
s.Rate=1/.05;
outputSingleScan(s, 5);
When I run this code the output on my computer does not appear to have scans of .05 (50 milliseconds). They are more between 1 and 3 milliseconds.
I have also tried using s.DurationInSeconds and s.ScansQueued with S.Rate, but both give errors. How can I make the length of one outputSingleScan .05 seconds?

回答 (1 件)

Sid Jhaveri
Sid Jhaveri 2017 年 6 月 9 日
"s.Rate" (where s is the session object) is usually used while doing continuous acquisition. Thus, I would suggest you the following:
1) Try sending data continuous using "startForeground" or "startBackground" function and check is that is giving you the sampling rate of 20 scans/second.
2) If you want to use "outputSingleScan" itself, then try giving an explicit pause after using it.

カテゴリ

Help Center および File ExchangeData Acquisition Toolbox Supported Hardware についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by