I am trying to get my head around PWM and using Timer2 to run a ferite coil. My aim is to find the best frequency to opperate the coil at at a reduced duty cycle. something around 4Khz and 15%DC. My circuit is reasonably simple with pin11 connected to an optoisolator then to a fet and to the coil.
Until a HDD crash a while back i had the perfect thing that i muddled together and tried to recreate it but just seem to be working myself in to a corner and not getting anywhere.
I started with this…
TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM21) | _BV(WGM20);
TCCR2B = _BV(CS22);
OCR2A = 180;
OCR2B = 50;
By adjusting the values I’m getting the perfect frequency but don’t seem to be getting any variation on the pulse width.