Es geht weiter? Ja, blos funktionieren tuts nicht :-/ Da muss ich mal (noch) gründlich (..er) drüberschauen.
Wird im main aufgerufen :Code:// ============================================================================= = // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // N E U Basis "alter" SLEEP1, Adaption aus searcher´s tiny44_WDT_Demo-in-BAS // ============================================================================= = // Dok D:\D_pro-fi...blätter\atmel-controller_Datenblätter_App-Notes // \ATtiny13_doc2535J_08-10-akt-neueste-13-13V_13neu_13-13Vneu_13-13Vneu.pdf // ============================================================================= = // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SLP0init (void) // Ruhemodus vorbereiten / initialisieren { // // __watchdog_reset(); // Siehe https://arduino-projekte.webnode.at // /meine-projekte/attiny-im-schlafmodus/wecken-mit-wdt/ // Setzen des Registers fuer Watchdog Time-out Interrupt cli(); wdt_reset(); // Reset Watchdog Timer MCUSR &= ~(1 << WDRF); //Ruecksetzen des Watchdog System Reset Flag MCUCR |= (1 << SM1); // SM1: Power Down 46 /* Set new prescaler(time-out) */ WDTCR |= (1<<WDE) | (1<<WDCE) | (1<<WDP3); // WDTCR |= (1 << WDTIE); // Watchdog Timer Interrupt Enable 41 WDTCR |= (1 << WDTE); // Watchdog Timer Interrupt Enable setzen 41 // sei(); return; } // Ende void SLEEP1 (void) -- Ruhemodus ein, wake up dur // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ============================================================================= = // ============================================================================= = // Dok D:\D_pro-fi...blätter\atmel-controller_Datenblätter_App-Notes // \ATtiny13_doc2535J_08-10-akt-neueste-13-13V_13neu_13-13Vneu_13-13Vneu.pdf // Dann - neu: D:\D_pro-fi...blätter\atmel-controller_Datenblätter_App-Notes // \ATtiny13A-Data-Sheet-DS40002307A-2021_neu-Microchip // ============================================================================= = // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SLEEP0 (void) // Ruhemodus SLEEP0 starten { // MCUCR |= (1<<SM1)|(1<<SE); // SM1: Power Down, SE: Sleep enable 46 sei(); // asm volatile ("sleep"); // Inline-Assembler MCUCR &= ~(1<<SM1)|(1<<SE); // => alten Zustand / zurücksetzen WDTCR &= ~(1<<WDE); // Watchdog Timer Interrupt D I S able 41 WDTCR |= (1<<WDTIE); // Watchdog Timer Interrupt Enable 41 // - - - - - - - - - - - - - - - - return; } // Ende void SLEEP1 (void) -- Ruhemodus ein, wake up dur // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ============================================================================= =*grübel*Code:.. SetBit (PORTB, kLED); wms ( 5 ); // Port für/mit PB0/rLED SLP0init ( ); // Ruhemodus SLEEP0 vorbereiten / initialisieren ClrBit (PORTB, kLED); wms ( 5 ); // Port für/mit PB0/rLED while ( 1 ) // Hier folgt das eigentliche Hauptprogramm { // SetBit (PORTB, kLED); wms ( 10 ); // SLEEP0 ( ); // Ruhemodus SLEEP0 // ClrBit (PORTB, kLED); wms ( 10 ); // LED aus // // SLEEP0 ( ); // Ruhemodus SLEEP0 // } // Ende while ( 1 ) ..







Zitieren

Lesezeichen