$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 100
$swstack = 100
$framesize = 100


Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2
Config Lcd = 16 * 2

$baud = 9600
$regfile "m8def.dat"
$crystal = 16000000
Config Lcd = 16 * 2
Dim Sekunde As Word
Dim Minute As Word
Dim Stunde As Word
Dim S1 As String * 2
Dim S2 As String * 2
Dim S3 As String * 2

'Minuten Einstellen
Config Pinb.4 = Input
Portb.4 = 1
Taster0 Alias Pinb.4

'Stunden Einstellen
Config Pinb.5 = Input
Portb.5 = 1
Taster1 Alias Pinb.5


Config Timer1 = Timer , Prescale = 64

Enable Timer1
On Timer1 Test
Enable Interrupts
Timer1 = 240

Cls
Cursor Off Noblink
'------------ Uhr Voreinstellung ----------------------------------------------
Sekunde = 0
Minute = 0
Stunde = 0

Do

'-------------------- Formatkonvertierung für Uhrzeit -------------------------
S1 = Str(stunde)
S1 = Format(s1 , "00")
'----------------------------------
S2 = Str(minute)
S2 = Format(s2 , "00")
'------------------------------------
S3 = Str(sekunde)
S3 = Format(s3 , "00")
'--------------------------------------
' S1 ist nun die Variable für Stunde
' S2 ist nun die Variable für Minuten
' S3 ist nun die Variable für Sekunden

'----------- Anzeige Stunden , Minuten, Sekunden auf Display ------------------

Locate 2 , 13
Lcd S3
Locate 2 , 11
Lcd ":"
Locate 2 , 8
Lcd S2
Locate 2 , 6
Lcd ":"
Locate 2 , 3
Lcd S1
Locate 1 , 1
Lcd "Aktuelle Uhrzeit"
Waitms 50


If Sekunde > 59 Then Minute = Minute + 1
If Sekunde > 59 Then Sekunde = 0
If Minute > 59 Then Stunde = Stunde + 1
If Minute > 59 Then Minute = 0
If Stunde > 23 Then Stunde = 0

'--------------Uhr einstellen Minute ------------------------------------------
If Taster0 = 0 Then
Waitms 50
Incr Stunde
End If
'--------------Uhr einstellen Stunde -----------------------------------------
If Taster1 = 0 Then
Waitms 50
Incr Minute
End If
'--------Uhr komplett auf Null stellen ----------------------------------------
If Taster0 = 0 And Taster1 = 0 Then
Sekunde = 0
Minute = 0
Stunde = 0
Waitms 50
End If
'------------------------------------------------------------------------------
Loop

End

Test:
Incr Sekunde


Return


Es läuft eigentlich Gut Tasten kann man Minute und Stunde einstellen