cancel
Showing results for 
Search instead for 
Did you mean: 

Setting sample rate for sinus analog output

SOLVED
felix_and
Member
Solved!

Setting sample rate for sinus analog output

Message contains an attachment

Hello,

I've been trying to do something very simple : using an analog output of the card PCI 6221 to produce a sinus curve of frequency 50 Hz. For this I used a Vi to create a sinus curve and the different DAQmx VIs. But I have difficulties understanding the principle of virtual channel and I think I'm doing a mistake setting the sample rate and samples number : one time for the sinus vi, second time for "DAQmx - Timing". Should I use the same values for both of these VIs ?

On my oscilloscope, with frequency=50Hz and sample rate=1kHz, I get a null signal. Then depending on both values, I get differently rated signals. For example with f=1Hz and sr=10kHz, a sinus of frequency 0,7 Hz.

 

7 REPLIES 7
RavensFan
Knight of NI

Re: Setting sample rate for sinus analog output

Message contains a hyperlink

Do you want a sine wave?

 

A "sinus" wave is a completely different thing.  It is a heartbeat rhythm.  http://en.wikipedia.org/wiki/Sinus_rhythm

felix_and
Member

Re: Setting sample rate for sinus analog output

Yes, sorry, I meant sine wave.
RavensFan
Knight of NI

Re: Setting sample rate for sine analog output

Try setting the Sample Clock to be Continuous Samples.  Delete the numeric constant from the top.  Right click on the terminal and select Create Constant.  The constant will be a ring constant with a meaningful name rather than a number.
Dennis_Knutson
Knight of NI

Re: Setting sample rate for sine analog output

And look at the shipping examples. There is one called Cont Gen Voltage Wfm-Int Clk. It uses a DAQmx Timing function set for Use Waveform to set the timing.
felix_and
Member

Re: Setting sample rate for sine analog output

Yes, thanks for your advice. I used the structure given in the example and now it's working fine. I'm still not sure what I did wrong though.

 

I would have a second question now (should I create a new topic?):

I put a continuous sine wave on the analog output. As soon as this is running, (or maybe after a short delay) I want to measure a limited amount of samples on my analog input. How can I be sure, it's not going to start measuring before the output is properly set ?

I don't think a trigger would solve the problem since I'm going to vary the output Amplitude.

RavensFan
Knight of NI
Solution

Re: Setting sample rate for sine analog output

Make sure the start task for the analog input occurs after the analog output.  By wiring the error wire in to the analog output start task first, then on to the AI start task, you guarantee the AI can't start until after the AO has started.
felix_and
Member

Re: Setting sample rate for sine analog output

Ok, thanks!