ich wollte die "Soft Clock" benutzen. Aber in dem Programm, welches ich hier im Forum gefunden habe ist KEIN Quarz irgendwo definiert... WARUM?
Code:
'************************************************************
'Atmega Softclock -> genau Uhrzeit ohne RTC (Real-Time-Clock)
'Benutzt wird ein Mega8/8, Fusebits auf Auslieferungszustand,
'Lcd An Portb , Taster Zum Stellen An Pd.0
'zum Hochzählen An Pd.3.
'zwischen XTAL ist ein 32.xxx Uhrenquarz
'14.08.2006, Andree-HB, www.pixelklecks.de
'************************************************************
$regfile = "m8def.dat"
Config Lcdpin = Pin , Rs = Portb.0 , E = Portb.1 , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , Db7 = Portb.5
Config Lcd = 24 * 2
Initlcd
Cursor Off
Cls
Enable Interrupts
Config Date = Mdy , Separator = /
Config Clock = Soft
Config Portd = Input
Portd.0 = 1 'Taster1, Zeit/Datum stellen, PullUp ein, schaltet gegen Minus
Portd.3 = 1 'Taster2, Zahl hochzählen, PullUp ein, schaltet gegen Minus
Time$ = "00:00:00" 'Setzen auf Startwert
Date$ = "00/00/00" 'Setzen auf Startwert
Do
Locate 1 , 1
Lcd Time$ 'Zeige Zeit in Zeile1
Locate 2 , 1
Lcd _day ; "/" ; _month ; "/0" ; _year 'Zeige Datum in Form DD/MM/YYin Zeile2
'lcd Date$ 'zeige Datum in Form MM/DD/YY
If Pind.0 = 0 Then Gosub Time 'wiederhole Anzeige bis Taster 1 zum Stellen gedrückt, springe nach Sub "Time"
Loop
End
'Stunde
Time:
Waitms 200
Cls 'lösche Zeilen
Do
Locate 1 , 1
Lcd "Set Hour:" 'Stunden setzen
Locate 2 , 1
Lcd _hour
If Pind.3 = 0 Then 'Mit Taster 2
Incr _hour 'hochzählen
Locate 2 , 1
Lcd _hour
End If
If _hour > 23 Then 'Zählt bis Max, danach wieder ab 0
Cls
_hour = 00
End If 'solange, bis Taster 1 gedrückt
Loop Until Pind.0 = 0
Waitms 200
'Minute
Cls
Do
Locate 1 , 1
Lcd "Set Minute:"
Locate 2 , 1
Lcd _min
If Pind.3 = 0 Then
Incr _min
Locate 2 , 1
Lcd _min
End If
If _min > 59 Then
Cls
_min = 00
End If
Loop Until Pind.0 = 0
Waitms 200
Cls
'Tag
Cls
Do
Locate 1 , 1
Lcd "Set Day :"
Locate 2 , 1
Lcd _day
If Pind.3 = 0 Then
Incr _day
Locate 2 , 1
Lcd _day
End If
If _day > 31 Then
Cls
_day = 01
End If
Loop Until Pind.0 = 0
Waitms 200
Cls
'Monat
Cls
Do
Locate 1 , 1
Lcd "Set Month :"
Locate 2 , 1
Lcd _month
If Pind.3 = 0 Then
Incr _month
Locate 2 , 1
Lcd _month
End If
If _month > 12 Then
Cls
_month = 01
End If
Loop Until Pind.0 = 0
Waitms 200
Cls
'Jahr
Cls
Do
Locate 1 , 1
Lcd "Set Year :"
Locate 2 , 1
Lcd _year
If Pind.3 = 0 Then
Incr _year
Locate 2 , 1
Lcd _year
End If
If _year > 10 Then
Cls
_year = 00
End If
Loop Until Pind.0 = 0
Waitms 200
Cls
_sec = 00 'Springe Nach Setzen Von Zeit / Datum Wieder Zurueck
Return
Lesezeichen