Forum: Compiler & IDEs Interrupt löst nicht aus.


von Julian Klein (Gast)


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

von Steven (. (ovular) Benutzerseite


Lesenswert?

Gibts da auch ein "global interrupt enable"?

Und wo ist die ISR?

Gruß Steven

von Conny G. (conny_g)


Lesenswert?

Das basiert wohl auf dem Atmel Framework.
Da braucht's vielleicht noch ein:
http://asf.atmel.com/docs/3.0.1/mega/html/group__interrupt__group.html#gae4922a4bd8ba4150211fbc7f2302403c
Und ein enable für diesen Timer Interrupt via Timsk Register.

von Nils (Gast)


Lesenswert?

Das is doch für die ILC?

von Wilhelm F. (Gast)


Lesenswert?

Julian Klein schrieb:

> Ich arbeite mit Notepad++

Ist das als IDE tauglich?

Ich schaute es mir auch mal an, entschied mich aber für Geany. Auch wenn 
das hier erst mal nicht hilft.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.