Jest to mój pierwszy program z użyciem timera i nie mam pojęcia dlaczego nie działa, wydaje mi się że wszystko jest ok a jednak po wgraniu do mikrokontrolera nie ma żadnej reakcji.
$regfile "attiny2313.dat"
$crystal = 1000000
Config Timer0 = Timer , Prescale = 1024
Dim T1 As Byte
T1 = 0
Dim T2 As Byte
T2 = 0
Dim T3 As Byte
T3 = 0
On Timer0 Przerwanie
Start Timer0
Enable Timer0
Config Portb = &B11111111
Portb = &B00000000
Config Portd = &B11000011
Portd = &B00111100
D1 Alias Portb.0
D2 Alias Portb.1
D3 Alias Portb.2
D4 Alias Portb.3
D5 Alias Portb.4
D6 Alias Portb.5
D7 Alias Portb.6
D8 Alias Portb.7
Enable Interrupts
Do
If T1 = 0 Then
T1 = 10
Toggle D1
End If
If T2 = 0 Then
T2 = 40
Toggle D2
End If
If T3 = 0 Then
T3 = 80
toggle D3
End If
Loop
Przerwanie:
If T1 > 0 Then Decr T1
If T2 > 0 Then Decr T2
If T3 > 0 Then Decr T3
Return