Go Down

Topic: oscillator problems using Timers1-5 (Read 148 times) previous topic - next topic

AiluniaHezekiah

Hi everyone!

I am trying to create as many independent oscillators as I can squeeze out of my ATMega-2560.

I am not an experienced coder (in fact this project is the first time I ever experimented with coding) but I have been studying this 3 Phase sine wave code ( https://github.com/cmasenas/3-Phase-Sine-Arduino ) for a couple of days now, and I feel confident that I have a good understanding of how he uses the Timers, Phase accumulator, Phase increment and a wavetable to create his sine waves.

I changed the code to include Timers 3,4 and 5 instead of just 1 and 2 and created 13 oscillators, all with independent frequency control ( I am hoping to add Phase back in and add an amplitude control but I need to fix the bugs first). The problem is that when I use all of these timers simultaneously the output of the oscillators are at different frequencies and some outputs are just full on. When using only Timers 1 and 2 they work perfectly but as soon as I add another Timer they lose sync.

Could this be a Clock sync problem?
If so can I set all the prescalers to use external clocks and use Timer0 as the master?

Thanks!
ceo 76hype
https://76hype.pw/

Grumpy_Mike

Quote
I am hoping to add Phase
Why? The phase of an audio signal is not audible.

Quote
Could this be a Clock sync problem?
There is only one clock so how could that be.

Can you post your code so we can study it please.

Don't forget to use code tags or use the copy for forum option on the IDE before passing it.

Go Up