LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting sample rate for sinus analog output

Solved!
Go to solution

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.

 

0 Kudos
Message 1 of 8
(4,145 Views)

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

0 Kudos
Message 2 of 8
(4,142 Views)
Yes, sorry, I meant sine wave.
0 Kudos
Message 3 of 8
(4,138 Views)
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.
0 Kudos
Message 4 of 8
(4,134 Views)
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.
0 Kudos
Message 5 of 8
(4,131 Views)

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.

0 Kudos
Message 6 of 8
(4,101 Views)
Solution
Accepted by topic author felix_and
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.
0 Kudos
Message 7 of 8
(4,086 Views)
Ok, thanks!
0 Kudos
Message 8 of 8
(4,077 Views)