My problem is that I'd like to free up 11 so I can use it for in circuit programming. And while I understand you can swap 3 & 11 for PWM in this case, I have no ideal of how to manage the registers at this low level. So my question is two part:
Does anyone know how to reverse this code so pin 11 is 'normal' and pin 3 does the PWM?
Can anyone recommend a web page/site that discusses the ATMEGA registers in enough detail so that I can decode/change the code myself? I need something easier than their chip's pdf, which is a tough read.
This is more concisely (and correctly - you want to configure ALL the bits in the timer control registers so you don't leave state from before unless you are certain of previous state):
You'll also have to configure pin 3 as an output of course.
BTW most of this configuration is not needed in the standard Arduino set-up as the timer2 is already set up for phase-correct PWM - you just need to change the clock select:
sbi (TIMSK2,TOIE2); // enable overflow interrupt (will run every 31.875us)
TCCR2B = (TCCR2B & 0xF8) | 0x01 ; // change prescaler from divide-by-64 to divide-by-1 (PWM at 31kHz approx)
should be sufficient, thereafter use analogWrite (3, ...)