Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20606

BASCOM-AVR : PWM for Sinus generator too low in frequency : REPLY

$
0
0
Two more thoughts: You can switch to an Xmega, which can run at 32 MHz, giving you more clock cycles to work with. You can switch techniques on how you generate the sin wave. Right now you have a fixed loop rate, and each pass you take the next sample from the data table. Read the samples faster for a higher frequency. If you switch techniques, and use a DDS approach, you can easily get 50 KHz sin, and if you are very good, even higher. In the DDS approach one still has a data table. One uses interrupts to read from the table. One always uses the same interrupt rate regardless of the output frequency. One changes which sample is read from the table to change frequency. The program skips over samples in the table, and doesn't read them out one by one. Jesper's [url=http://www.myplace.nu/avr/minidds/] Mini DDS [/url] is one good example of this technique. Wiki DDS, (Direct Digital Synthesis), and the data sheets for chips which do this, (Analog Devices), have good explanations of how the method works. JC

Viewing all articles
Browse latest Browse all 20606

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>