Hi,
I'm trying to make a PWM phase and freg correct, I've read 2 tutorials, on was dean's. I finally made a code for my AtMega128, but I doesn't work(AvrStudio and Stk501).
Everthing is initialised as it should be,but it doesn't work as it should be,meaning ICR1 should be my TOP but instead it goes all the way to 0xffff .
Code:
void PWM_init() { DDRB = 0b00100000; //PB5, OC1A TCCR1A = 0b11000000;// TCCR1B = 0b00010011;// N=64,ICR1=top unsigned int t=2500; ICR1H = (unsigned char)(t>>8); ICR1L = (unsigned char)t; unsigned int t2=1000; OCR1AH = (unsigned char)(t2>>8); OCR1AL = (unsigned char)t2; }
Thanx for any response