[AVR-GCC] PWM problem ...

Witam, niestety avrfreaks padlo :( Chce uzyc Timer1 w trybie fast PWM przykladzik jak ponizej, problem polaga na tym, przy porownaniu z OCR1A stan na OC1A znienia sie z 0 na 1 (to OK), ale przy przepelnieniu sie timera nie wraca spowrotem do stanu niskiego. moze ktos mi powiedziec czemu? co robie nie tak?

int main ( void ) {

TIMSK |= (1<<TOIE1);

TCCR1A |= (1<<COM1A1)|(1<<WGM10); // non inverting / 8Bit PWM TCCR1A |= (1<<COM1B1)|(1<<COM1B0); //B przeciwnie do A TCCR1B |= (1<<CS10)|(1<<WGM12); // CLK/1 #if defined (__AVR_ATmega128__) DDRB |= (1 << DDB5); // PB5 (OC1A) as output DDRB |= (1 << DDB6); // PB6 (OC1B) as output #endif OCR1A = 128; OCR1B = 128; }

Reply to
Pawel Kurzawa
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.