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 Comment

Is there a simpler way to achieve a ramp function??

Sign in to comment.

 Accepted Answer

Walter Roberson
Walter Roberson on 15 Sep 2011

0 votes

Ummm, you did set(ao_Ref,'SampleRate',1000) so why not try increasing that 1000 to a higher value?

4 Comments

Do you know the maximum value I can set it?
With regard to smoothing out the output voltage to make it linear rather than many small steps: that is not possible through anything you can send through through a DAQ. To do it through your program, you would need an analog signal generator and to send commands to it telling it the start voltage and slew rate.
Perhaps some kind of filter could be put on the output voltage to smooth it out, but when I think of the situation in terms of frequency, I cannot think of how to do it. As is the case with all straight lines, a linear slope in frequency space requires an infinite series; the real portion of the fft is constant (except for the DC term) but the imaginary portion of the fft has a very steep slope at the beginning and end. A high-pass filter would not give you anywhere close to the line you want, and a low-pass filter ends up with fairly notable ring.
Perhaps some kind of mixed filter could give you a wavy descent instead of steps; I do not know enough about filtering techniques to say.
For that card and single channel, the spec is 1.25 Msamp/second, so somewhere around 1250000 in theory. I don't know what the practical limit is (based upon MATLAB's overhead, the other operations happening on your system, and so on.)
Once the data acquisition starts, there will be no MATLAB overhead as the data is queued on the board.

Sign in to comment.

More Answers (1)

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.

Categories

Community Treasure Hunt

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

Start Hunting!