Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1250

Generate a Specified Number of Pulse Signals Using NI USB-6211 with MATLAB

$
0
0
Hello all,
I need to generate a specified number of pulse signals using NI USB6211 and MATLAB DAQ toolbox to control the stepper motor. For example, 6e6 pulses are in need in about 1min of time. I'm now using code as follow. I use
DurationInSeconds ch.Frequency
to control the number of pulse. But if the Frequency is high and Time is long, the number of pulse may not agree with my expect.
test = daq.createSession('ni'); ch=addCounterOutputChannel(test,Device_ID,'ctr0','PulseGeneration'); ch.Frequency=100000; % Palse per second test.DurationInSeconds=60;
Can I generate a specified number of pulse signals with Counter output port in USB-6211 directly with MATLAB code? Just like what we can do in LabView.
HZY20_0-1624413619389.png

 

I need precise control of number of the counter pulse and not too care about the time of pulse train. (Precise in pulse number means precise position control of the stepper motor)
Thanks for your help.
 
大家好,我需要用MATLAB驱动USB6211产生指定数量的脉冲信号用于控制步进电机。我现在的使用方法是用脉冲总时间+脉冲频率的方法控制脉冲数量(见上述代码)。但是当脉冲频率较高或时间较长时,总脉冲数量与我期望的数量总有一定的偏差。请问大家有没有什么好方法能够直接用MATLAB控制采集卡的counter输出指定个数的脉冲?就像Labview中能够直接控制脉冲数量一样。
我比较关心脉冲的数量的准确性,脉冲重复频率与脉冲时间并不需要严格把控。
感谢大家的回复,祝大家工作顺利!

Viewing all articles
Browse latest Browse all 1250

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>