Interrupt löst nicht aus.

Gast #3144915
Lesenswert?

Interrupt wird nicht ausgelöst.
Hallo,
ich habe an einem Programm gearbeitet,
dass nach Ablauf eines Timers eine LED anschalten soll.
Ich arbeite mit Notepad++ als Compiler kommt AVR Toolchain zum einsatz.
Das ganze läuft auf einem AtXMega128a3u mit einer Frequenz von 24MHz und 
Prescaler 1024.
Nach 1 Sekunde soll der Interrupt ausgeführt werden und eine LED 
einschalten.
Mein Code:
1
void humidity_timer_init(){
2
   pmic_init(); 
3
   sysclk_init(); 
4
   volatile void *tc = &HUMIDITY_TIMER; //Adress
5
          tc_enable(tc); //Enable timer/counter 
6
   tc_write_period(tc, 100); //This will specify the TOP value of the counter. The timer will overflow and reset when this value is reached.
7
   
8
   tc_set_overflow_interrupt_callback(tc, LED_tester); //Set the callback function for overflow interrupt
9
   tc_set_overflow_interrupt_level(tc, TC_INT_LVL_HI ); //Set the overflow interrupt level
10
   tc_write_clock_source(tc, HUMIDITY_COUNTER_CLKSEL  ); //Set the clock source
11
}
12

13
void LED_tester(){
14
  ioport_set_pin_dir(D2, IOPORT_DIR_OUTPUT);
15
  ioport_set_pin_level(D2, true);
16
  ioport_toggle_pin_level(D2);  //Turn LED D2 On
17
}
Danke im Vorraus
MfG
Julian

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren