Gast
#75288
Hallo, hoffe jemand kann mir helfen! Ich habe unter WinAVR ein Problem mit globalen Variablen. Ich möchte eine if-Anweisung in Main nur nach Interruptrücksprung ausführen, dazu benutze ich eine globale Varibale back die ich im Interrupt setze. Mein Problem, weder wird die If-Anweisung ausgeführt noch steht TCNT1 in timer_wert! Wenn ich das mit Pointer mache funktionierts! Das sollte doch ziemlich einfach sein, was mache ich falsch?????? Danke Thomas, #include <avr/io.h> #include <avr/signal.h> #include <avr/interrupt.h> unsigned int timer_wert; unsigned char back; SIGNAL(SIG_INTERRUPT0) { back = 0x01; timer_wert = TCNT1; } int main(void) { unsigned int time; sei(); back = 0x00; time = 0; while(1) { if (back == 0x01) // Nur bei Interruptrücksprung { back = 0x00; time = timer_wert; } } return 0; }