hallo,
ich habe da ein kleines problem mit meinem ATmega169. Ich benutze
alle 4 PWM und möchte zusätzlich noch über den ouput compare match
eine funktion func() aufrufen. das signal für den compare match kommt
aber nie....?
die pwm funkionieren tadellos. wenn ich in der initInterrupt allerding
das sei() mit reinnehme, dann erfolt laufend ein reset???
Code:
static void initPWM(void) {
// 8bit timer/counter 0
TCCR0A = (1<<WGM00)|(1<<COM0A1)|(1<<CS01);
// set initial pwm
OCR0A = 200;
// 16bit timer/counter 1
TCCR1A = (1<<WGM10)|(1<<COM1A1)|(1<<COM1B1);
TCCR1B = (1<<CS10);
// set initial pwm
OCR1A = 200;
OCR1B = 200;
// 8bit timer/counter 2
TCCR2A = (1<<WGM20)|(1<<COM2A1)|(1<<CS21);
// set initial pwm
OCR2A = 200;
}
static void initInterrupt(void) {
TIMSK1 |= (1<<OCIE1A);
//sei();
}
SIGNAL (SIG_OUTPUT_COMPARE1A) {
func();
}
Danke für Hilfe!
Gruß
RICOLA
Lesezeichen