Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to do fequency sweep using daqmx and NI-6259 card AO

Hello all
 
I'm trying to write a  C# function: private void frequency_sweep(double start_freq, double stop_freq, double duration)
but beyond initial generation of start_freq, I can't change the frequency for the sweep.
 
I found a good example in labvew but I don't have enough knowledge to implement the same in .NET
Please help.
 
0 Kudos
Message 1 of 4
(3,654 Views)
Hello,

Could you provide more specific details about the trouble you are having? Do you get any errors? Have you looked at the DAQmx examples for C#? They are located in the "<National Instruments>\MeasurementStudioVS2005\DotNET\Examples\DAQmx" directory. Also, what LabVIEW example are you referring to? Please let me know, and I'll do my best to help. Thanks!

Regards,
Ebele O.
National Instruments
0 Kudos
Message 2 of 4
(3,640 Views)
Hello
I've soceeded in doing the sweep by configuring AO channel and using a timer to change frequency:

private void SweepTimer_Tick(object sender, EventArgs e)

{

double samp;

if (i < sweeps_nums)

{

samp = (

double)(2000.0 + 1500 * i);

freq_sweep_task.Timing.ConfigureSampleClock(

"", samp,

SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000);

ResultingSampleClockRateLbl.Text = System.

Convert.ToString(samp);

i++;

}

else

{

SweepTimer.Enabled =

false;

i = 0;

freq_sweep_task.Stop();

//stop task

freq_sweep_task.Dispose();

// dispose handle

}

}

But, the frequency change doesn't seem to occur when amplitude is zero ( cycle has finished)

Pls advice !!!!

0 Kudos
Message 3 of 4
(3,598 Views)
Hi Alexaver,

If you only want to see only a period while you are changing sampling rates, then you will need to change the number of samples you take as well. 

For instance if you have a 1 Hz signal and you are acquiring at 100 samples at 100Hz, then you will get one period of data.  If you then change the sampling rate to 200Hz, and keep the number of samples at 100, you will only acquire half a period of data. 

Once you adjust your samples according to the sampling rate, you can see only a period of data every time.


Thank You,

Nick F.
Applications Engineer
0 Kudos
Message 4 of 4
(3,583 Views)