DAQ National Instruments counting
3 ビュー (過去 30 日間)
古いコメントを表示
Dear reader, I am working with a DC motor with encoder. Previously, I have been using an Arduino to control the speed of the motor. However, this hardware isn't reliable enough. Therefore, I am using a National Instruments USB6001 by now.
Right now, I am struggling with reading the encoder. It is possible to use an analog input for that. But, it seems that there is also a counter input available. Can you tell me how to use that? With the following code I get the error "The session contains channels that do not support clocked operations using startForeground and startBackground. Only on-demand operations using inputSingleScan and outputSingleScan can be done."
s_continuous = daq.createSession('ni'); ch_counter = addCounterInputChannel(s_continuous,'Dev1', 'ctr0', 'EdgeCount'); ch_counter.ActiveEdge = 'Falling'; s_continuous.DurationInSeconds = 10; startForeground(s_continuous)
Kind regards, Matthijs
0 件のコメント
回答 (1 件)
Sid Jhaveri
2018 年 5 月 18 日
Hi Matthijs,
The error suggests that the counterInput channel you are trying to use does not support clocked operations. Thus, you can't use "startForeground" and "starBackground" operations. Instead of this, you will have to use the on-demand operations like "inputSingleScan" and "outputSingleScan".
If this is not ideal, depending upon the use-case and Hardware's capability, you can you AnalogInput channels to capture the data. That being said, you have to do some data processing if this approach is used. Again, using this approach depends upon the end goal and hardware's capability.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で National Instruments Frame Grabbers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!