I'm building a wavetable VCO - and I found this code to set pin 3 to fast PWM (for the audio output):
#define PWM_PIN 3
#define PWM_VALUE_DESTINATION OCR2B
#define PWM_INTERRUPT TIMER2_OVF_vect
TCCR2A = _BV(COM2B1) | _BV(WGM20);
TCCR2B = _BV(CS20);
TIMSK2 = _BV(TOIE2);
and then the interrupt timer does this..
PWM_VALUE_DESTINATION = outputvalue;
outputvalue = (((uint8_t)(osc.amplitude>>8)) * pgm_read_byte(sintable+((osc.phase>>16)%LUTsize)))>>8;
Alas though, I don't really understand this! And what I want to do is get a second PWM pin to do exactly the same (to create a second oscillator) -
I read that pin 11 can also be set to fast PWM..
Does anyone know the code to implement this?