DAQ output speed maximum
显示 更早的评论
Hi,
I'm tring to use my NI card (PCI 6259) to output a "smooth" ramp function, similar to those you achieve from function generators.
function [] = Ramp(Vpp, Frequency, NumRepeat)
% Vpp = Voltage peak to peak
if isempty(NumRepeat)
NumRepeat = 1;
end
x = 0.5 * Vpp * linspace(-1,1,500/Frequency)';
x = [x; -x];
ao_Ref = analogoutput('nidaq','Dev1');
addchannel(ao_Ref, 2);
set(ao_Ref,'SampleRate',1000);
% set(ao_Ref,'TriggerType','Immediate')
for j = 1:NumRepeat
putdata(ao_Ref, x);
end
start(ao_Ref)
The code works fine. The only problem I am having is that the output voltage is given in tiny steps. The voltage is determining the position of an actuator, and thus the actuator does 1000 little "jumps" per second.
>> daqfind
Display Summary of Analog Output (AO) Object Using 'PCI-6259'.
Output Parameters: 1000 samples per second on each channel.
The NI card should be able to output alot more then 1000 samples per second, if I am not mistaken. Is there a way to "smotthen" out the output voltage? (make it a linear slope, rather then 1000 small steps.
Any help would be appreciated.
Thanks,
Michael
采纳的回答
更多回答(1 个)
Chirag Gupta
2011-9-15
You should be able to increase the sample rate of your AO to reduce the steps.
set(ao_Ref,'SampleRate',5000);
The default setting of the toolbox is to make it 1000.
类别
在 帮助中心 和 File Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!