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 ( GitHub - cmasenas/3-Phase-Sine-Arduino: Code for generating 3 phase sine wave on Arduino Uno PWM o ) 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?