Setting two pins to fast PWM

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?

Carl

in the end, I just put analogWrite(11, outputvalue) - it works, but it's really clumsy and a little too slow.. Surely some of you clever people out there know how to address pin 11 by it's memory address?

:wink:

Define:

#define PWM_PIN2       11
#define PWM_VALUE_DESTINATION2     OCR2A

and

PWM_VALUE_DESTINATION2 = outputvalue;

I just tried this but it's not working.. Still no sound on pin 11,,

Add this

TCCR2A = _BV(COM2B1) | _BV(WGM20) | _BV(COM2A1);

And don't forget to set 11 as output - pinMode.