Ja, danke. Ich habe jetzt AVRStudio installiert und debuggt.
Er springt nicht in den Handler. Der Compiler zeigt mir auch an, dass das Signal "misspelled" ist.
Aber ich finde keine Konstanten im Interrupt.h. Und wenn ich dort 0x08 reinschreibe, kompiliert er es nicht. Irgendwie schein ich da was nicht zu verstehen.
Code:
#include <avr/io.h>
#include <avr/interrupt.h>
//#include <stdint.h>
#define F_CPU 1000000
int schalter=0;
void _40khz_init (void) {
DDRB = 0xFF;
OCR1A = 12; // PWM einstellen, bevor der Timer startet
OCR1B = 800;
ICR1 = 25; // TOP-wert
// 2-Kanal "non-inverting"
// 10-Bit = 2^10 = 1024
TCCR1A = (1<<COM1A1) | (1<<COM1B1) | (1<<WGM11); // 2-Kanal "non-inverting"
TCCR1B = (1<<WGM13)|(1<<WGM12) | (1<<CS10); //Fastpwm, mit ICR1 als TOP
}
SIGNAL (TIMER0_COMPB_vect){
TIMSK &= ~(1 << TOIE0);
TIMSK &= ~(1 << OCIE1A);
TIMSK &= ~(1 << TOIE1);
TCCR1A &= ~(1<<COM1A1);
TCCR1A &= ~(1<<COM1B1);
schalter = 1;
}
SIGNAL (TIMER0_COMPA_vect){
TIMSK &= ~(1 << TOIE0);
TIMSK &= ~(1 << OCIE1A);
TIMSK &= ~(1 << TOIE1);
TCCR1A &= ~(1<<COM1A1);
TCCR1A &= ~(1<<COM1B1);
schalter = 1;
}
int main(void)
{
_40khz_init();
TIMSK |= (1 << OCIE1B); //|(1<<OCIE1A)|(1<<TOIE1);
sei();//enable Interrupts
while(1){};
}
Lesezeichen