11-14-2012 11:15 PM
Hello Everyone,
How can I convert a triangular wave to a sine wave? I am using NI cRIO-9012, with NI 9263 (AO), Real-Time Module and FPGA.
Please find attached a screenshot and my .vi. The current VI contains 2 while loops. The first while loop generates data (1/4 of the entire triangular wave) according to a multiplication factor. The second while loop outputs the data to the AO module, using a flat sequence and for loop. The address is called incrementally/decrementally; additionally the data is negated twice to accommodate for the negative part of the triangular wave.
However, at this point, I am struck. I would like to tweak the triangular wave to generate a sine wave (without using any inbuilt functions). I suppose using Taylor Series would be the best option, but I am having trouble implementing this idea. The sinewave should be operations around KHz.
If there are any newbie programming errors, please let me know.
Any assistance would be appreciated.
Donaustadt.
11-14-2012 11:20 PM - edited 11-14-2012 11:20 PM
The sinewave should be operating in the MHz region.
11-15-2012 02:07 PM
i am confused. why do you not want to use the built in functions for sin wave generation?
11-15-2012 04:52 PM
Hey Stu,
Thanks for your message. Just not a big fan of signal generating functions. Building my own will help me understand better- is that something bad? Can you assist Stu?
I would like to use taylor series to generate the sinewave. First start will a low no. of points for 1/4 of the wave (12 points in total for 1 period)- Then I would like to increase the number of points using a control to make the sine wave smoother. The speed should be in the MHz region.
Thanks
Donaustadt.
11-15-2012 06:29 PM
i would definately use the built in functions for sinewave.
your approach is good for understanding and for implementation of triangle wave.
however, understanding DDS generation is even more important. with DDS you can adjust triangle wave frequency (or any other wave) with very good resolution.
the built in generation of sine has been optimized for use so unless there is a good reason NOT to use it, then use it.
do you mean the update rate of the output at the MHz rate? if so then ok, if you intend to output frequencies in that range then you need to look at the flex line of FPGA.
11-15-2012 06:29 PM
i would definately use the built in functions for sinewave.
your approach is good for understanding and for implementation of triangle wave.
however, understanding DDS generation is even more important. with DDS you can adjust triangle wave frequency (or any other wave) with very good resolution.
the built in generation of sine has been optimized for use so unless there is a good reason NOT to use it, then use it.
do you mean the update rate of the output at the MHz rate? if so then ok, if you intend to output frequencies in that range then you need to look at the flex line of FPGA.
11-15-2012 06:53 PM
Hey Stu,
Thanks for your prompt reply. At the moment, this task is only for understanding purposes. Currently, I am trying to comprehend the basic building blocks of FPGA- that is the reason of not using inbuilt functions.
Is it possible for you to have a glance at my .vi? Any clean up suggestions for the current .vi?
How can I change the lower while loop to generate 1/4 of the sine wave?
Best Regards,
Donaustadt