Forum: Mikrocontroller und Digitale Elektronik Wake Up und AVR Sim


von Nn N. (jaytharevo)


Lesenswert?

Hey!
Ich hab heute mal den Sim vom Avr Studio 4 verwendet.
Da bin ich auf etwas verwirrendes gestoßen.

Also:
1
        case Turn_off:    // System should be turned off between 10pm and 5am
2
        // Just need to check the Hour. Minutes and therfore Hours will be increased by the external Interrupt 0    
3
4
          if (Hour <= End_of_Night || Hour >= Start_of_Night)
5
          {
6
            //TIMSK1 &= ~(1<<TOIE1);            // Disable Overflow Interrupt for Timer1
7
            //TIMSK2 &= ~(1<<TOIE2);            // Disable Overflow Interrupt for Timer2
8
            PORTC  &= ~((1<<PC0) | (1<<PC1)); // Turn Laser off
9
          }
10
          else State = Turn_on;
11
12
          sleep_mode();                       // Only Minute Pulse will wake µC up
13
        break;

1
    case Turn_off:    // System should be turned off between 10pm and 5am
2
        // Just need to check the Hour. Minutes and therfore Hours will be increased by the external Interrupt 0    
3
4
          if (Hour <= End_of_Night || Hour >= Start_of_Night)
5
          {
6
            TIMSK1 &= ~(1<<TOIE1);            // Disable Overflow Interrupt for Timer1
7
            TIMSK2 &= ~(1<<TOIE2);            // Disable Overflow Interrupt for Timer2
8
            PORTC  &= ~((1<<PC0) | (1<<PC1)); // Turn Laser off
9
          }
10
          else State = Turn_on;
11
12
          sleep_mode();                       // Only Minute Pulse will wake µC up
13
        break;

In der oberen Version funktioniert der INT0 Interrupt noch (also wenn 
ich manuell das INTF0 Flag im EIFR Register setzte). Beim nächsten 
Schritt (F11) springt er gleich in die zugehörige ISR.

Bei der unteren Version ist dann aus. Nach dem ich im sleep_mode() bin 
geht nichts mehr. Kein F11, wenn ich das Flag setze passiert nichts.

Ich verstehe nicht ganz?! Sleep Mode ist der Idle Mode eingestellt.

Hab bei dem Projekt nämlich das Problem, das der Controller nicht mehr 
aufwacht und jetzt hab ich es halt mit dem Sim probiert.


MfG

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.