Solved! Go to Solution.
I had to do arbitrary waveform generation on FPGA.
The DDS block as implemented uses a constant array for the look up table.
I used an FPGA memory block for the LUT and updated it as required from the RTHost using a DMA FIFO.
Then just wrote my own DDS algorithm on FPGA, it isn't that difficult. You could learn from the sine wave generator express vi.
If you have to output multiple waveforms you can just use multiple memories and share the addressing.
Sorry if I didn't explain myself well. I ignored in my explanation the fact that the sinewave is already generated, by the DDS Compiler 6.0 Xilinx IP block, and also that I need to achieve one sample/tick generation, placing the code inside an SCTL.
The DDS Compiler offers me the signal generator I need, and lets me vary the output signal frequency the way I want, but it does not support other waveforms rather than sine or cosine, and I would love to generate a sawtooth and triangle using the same mechanism.
So if I could perform small changes on the output of the DDS Compiler I would get a handy signal generator that could output different waveforms at very different frequencies, at requested.
- Square wave: you can create it by using a comparator. When sin is posivtive, it returns +V, when negative, it returns -V.
- Triangle wave: you can obtain it through integration of the square wave
- Sawtoot wave: I think about it.....
Sawtooth: Each sample increments by a constant from the previous sample starting from the rising edge of the square wave. Resets and starts over at the next rising edge.
Thanks for your replies!
I tried to implement the 'square-to-triangle' conversion, but I'm kind of struggling with the code. If I apply integration point by point to the output of the square wave I get an erratic triangle wave that I cannot use.
I'm not quite sure where the issue is, I have tried changing the parameters to the "Integral x(t) PtByPt.vi" but it didn't work.
Have anybody implemented this before?
You could use the increment method I suggested for sawtooth except that you increment when the square (or sine) wave is positive and decrement when negative. This method does not depend on the quality of the input signal except at the comparator transitions.