Timer_irq solltest du net in die Do Loop Schleife schreiben.
Außerdem hast du 2 verschachtelte Do Loop Schleifen. Du brauchst nur eine.
Und wenn du willst, dass dein Programm nur innerhalb der 5 Minuten ausgeführt wird solltest du überprüfen ob Variable Led ungleich 0 ist, sprich 1.
Code:
$regfile = "m8def.dat"
$crystal = 1000000
$baud = 9600
Config Portb.0 = Output
Config Pinc.0 = Input
Config Portb.1 = Output
Config Pinc.1 = Input
Config Pinc.2 = Input
Portc.0 = 1
Portc.1 = 1
Portc.2 = 1
Portc.3 = 1
Dim I As Integer
Dim Led As Integer
Led = 0
Config Timer0 = Timer , Prescale = 1024
On Timer0 Timer_irq
Const Timervorgabe = 100
Enable Timer0
Enable Interrupts
Do
If Portc.2 = 1 Then
If Led = 0 Then Led = 1
If Led = 1 Then Led = 0
End If
Waitms 1
If Led = 1 Then
If Pinc.0 = 1 Then
Portb.0 = 1
Portb.1 = 0
Portb.1 = 0
Else
Portb.0 = 0
Wait 3
Portb.1 = 1
Wait 5
Portb.1 = 0
Wait 3
End If
If Pinc.1 = 1 Then
Portb.2 = 1
Portb.3 = 0
Portb.3 = 0
Else
Portb.2 = 0
Wait 3
Portb.3 = 1
Wait 5
Portb.3 = 0
Wait 3
End If
End If
Loop
Timer_irq:
Timer0 = Timervorgabe
If I = 30000 Then
Led = 0
I = 0
Elseif Led = 1 Then
Incr I
End If
Return
So dürfte es funktionieren.
MfG
Lesezeichen