Sorry Leute,
der Quellcode wurde nicht mit übertragen.
Das ganze also noch einmal.
$regfile = "m8def.dat"
$crystal = 4000000
$baud = 19200
Dim New_time As Bit
Dim Seconds As Byte
Dim Minutes As Byte
Dim Hours As Byte
Dim S As String * 2
Const True = 1
Const False = 0
Const Reload = 62500
Config Pind.3 = Input
Portd.3 = 1
Config Pinb.5 = Output
Key Alias Pind.3
Led Alias Portb.5
Led = 1
Config Timer1 = Timer , Prescale = 64
Ocr1ah = High(reload)
Ocr1al = Low(reload)
Tccr1a = 0
Set Tccr1b.3
On Compare1a Timer1_isr
Enable Compare1a
Enable Interrupts
Do
If Key = 0 Then
New_time = False
Seconds = 0
Minutes = 0
Hours = 0
End If
While New_time = True
If Seconds = 60 Then
Seconds = 0 : Incr Minutes
End If
If Minutes = 60 Then
Minutes = 0 : Incr Hours
End If
If Hours = 24 Then Hours = 0
S = Str(hours) : S = Format(s , "00") : Print S ; ":";
S = Str(minutes) : S = Format(s , "00") : Print S ; ":";
S = Str(seconds) : S = Format(s , "00") : Print S
New_time = False
Wend
Loop
End
Timer1_isr:
New_time = True
Incr Seconds
Led = 0 : Waitms 10 : Led = 1
Return
Lesezeichen