Hallo,
Ich bin dabei, einen "ewigen Blinker" mittels eines ATtinys zu bauen. Dazu lege ich den Chip schlafen (im Power-down Mode >0,1 uA Verbrauch), und dann soll er durch den Timer-Interrupt aufwachen. Es hängt nur eine LED am PB0.
Dazu hätte ich diesen Code so geschrieben / angepasst.
Leider tut er nichts. Die LED blinkt einmal (Funktionstest) und dann nie wieder...
Code:$regfile = "attiny13.dat" ' specify the used micro $crystal = 1000000 ' used crystal frequency $hwstack = 20 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 30 ' default use 40 for the frame space 'The following code shows how to use the TIMER0 in interrupt mode Config Portb = Output Dim I As Byte I = 0 'Configute the timer to use the clock divided by 1024 Config Timer0 = Timer , Prescale = 1024 'Define the ISR handler On Ovf0 Tim0_isr 'you may also use TIMER0 for OVF0, it is the same Enable Timer0 ' enable the timer interrupt Enable Interrupts Portb = &B00000000 Wait 1 Portb = &B11111111 'Funktionstest LED ein und ausschalten Wait 1 Portb = &B00000000 'allow interrupts to occur Do Powerdown MCUCR = bits( SE , SM1) SLEEP Loop 'the following code is executed when the timer rolls over Tim0_isr: I = I + 1 If I >= 9 Then I = 0 Portb = &B11111111 Wait 1 Portb = &B00000000 End If Return End
Wäre echt classe, wenn mir jemand mit Interrupterfahrung den Fehler fände![]()
Danke & Mfg







Zitieren


Lesezeichen