Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate sine waves of changing frequencies with ni 6733 ??

Solved!
Go to solution

i have one ni6733 card. i want to output a waveform of particular frequency. After few cycles frequency of waveform has to be changed repeatedly without any delay. Frequency range varies from 0.1 Hz to 10 Hz.

i am new to NI6733 card, so don't have much idea about it. I am planning to use double-buffered scheme for waveform generation. Timing is critical here.

Please give function sequence(if possible).

0 Kudos
Message 1 of 8
(5,376 Views)

Hi Rj7,

 

I would suggest looking at the DAQmx examples in the example finder in LabVIEW as these will give you a good start on how to develop your code ( Help->Find Example). In terms of developing what you want to do, I have attached an example code that will generate a Sine wave at a particular frequency. You would need to build your waveform as shown in the attached image in order to output the varying frequencies. The image shows two cycles of a sine wave being generated and put together but one after another. 

 

Please let me know how you get on. 

 

Thanks,

Andrew McLennan
Applications Engineer
National Instruments
Download All
0 Kudos
Message 2 of 8
(5,355 Views)

Hi Sorry, That VI doesn't work. Use this one.

 

 

Andrew McLennan
Applications Engineer
National Instruments
0 Kudos
Message 3 of 8
(5,354 Views)

thanx for your valuable feedback. 

but, sorry, i forgot to mention that i am doing programming in Visual C++.

i m not using LabView.

also i need to generate Ramp signals along with different sine waves one after another.

Please help...

0 Kudos
Message 4 of 8
(5,340 Views)

Hi rj7,

 

Here is a link to some of the online help that details how to develop DAQmx applications in C/C++. As far as generating the Sine waves, I would have thought that you could generate an array of values to the AO output. In order to generate the varying frequency sine waves, I think the only real way to do this is unfortunately, quite complicated. 

 

You would need a sine function that generates a single sine wave at the rate you specify. So for example if you want a 1Hz wave at 1000 Hz rate. I would suggest generating a sinewave cycle with a thousand data points. If you want a 2Hz wave, generate 500 data points with the same sine function. Again, you only want to produce one cycle so that the frequency will increase but not shift the phase. After this has been done, string all the waves (in Arrays) together and output them from the AO.

 

I know that is pretty complicated but I don't know of a function in C that will generate waveforms of varying frequency that can be outputted to the DAQmx.

 

Please let me know if you require any further help,

Andrew McLennan
Applications Engineer
National Instruments
Message 5 of 8
(5,334 Views)

Hi Andrew,

thanx for your quick and prompt response.

I tried to modify buffer contents, what u told, in double-buffering waveform generation mode and I m able to generate Ramp signal with varying amplitude and frequency. Is there any minimum and maximum limit on buffer size when using double-buffering???

 

I am still working for sine wave also but its time-taking.

If you have some other way to generate sine wave then please tell me.

Also sine wave generated using NIDAQMakeBuffer function is unipolar. how can I make it bipolar?? 

 

waiting for ur reply....

thanx again. 

0 Kudos
Message 6 of 8
(5,308 Views)

Hi rj7,

 

As far as I am aware there is no limit on buffer size, though I would have thought that if you make it enormous, your code may start to slow down your pc. Again this is unlikely to occur unless you are buffering literally millions of datapoints. 

 

I shall look at the NIDAQMakeBuffer function. 

 

Thanks,

 

 

Andrew McLennan
Applications Engineer
National Instruments
0 Kudos
Message 7 of 8
(5,267 Views)
Solution
Accepted by topic author rj7
Hi Andrew, I found problem in double-buffering when using buffer size less than 16384(i.e. 32768/2). why?? i don't know.... also beyong 1,25,000 "stack overflow" error was coming. Anyway, I have dropped the idea of using double-buffering. Now i am using single buffer waveform generation without using NIDAQMakeBuffer. Instead I am creating the buffer myself having data points of varying frequency for defined number of cycles. since requirement for time-duration of waveform profile to be generated is limited to 50 seconds, and I am using constant update rate of 1000 samples per second, so required buffer size is not creating any problem so far(for the time-being). thanx a lot for your generous support. rahul
0 Kudos
Message 8 of 8
(5,185 Views)