Hallo
Ich hab mal die zusätzliche Variable Minutes_old eingebaut:
Ungetestet, sollte aber wenigstens das von Rone schon beschriebene Prinzip zeigen.Code:$regfile = "m8def.dat" ' specify the used micro $crystal = 1000000 ' used crystal frequency $baud = 19200 ' use baud rate $hwstack = 120 ' default use 32 for the hardware stack $swstack = 120 ' default use 10 for the SW stack $framesize = 50 ' default use 40 for the frame space Config Lcdpin = Pin , Db4 = Portb.1 , Db5 = Portb.2 , Db6 = Portb.3 , Db7 = Portb.4 , E = Portb.5 , Rs = Portb.6 Dim A As Byte Config Lcd = 16 * 2 'configure lcd screen Config Timer1 = Timer , Prescale = 1024 On Timer1 Isr_von_timer1 Timer1 = 6942 Dim Minutes As Byte Dim Minutes_old As Byte Dim Hours As Byte Dim Minutes10 As Byte Dim Hours10 As Byte Dim Day As Integer Dim I As Byte Minutes = 0 Minutes_old = 100 ' 100 = Startanzeige aufbauen Minutes10 = 0 Hours10 = 0 Hours = 0 Ddrd = &B00000000 'input D Enable Timer1 Enable Interrupts Cls 'clear the LCD display Lcd "Vienna Time" 'display this at the top line Do ' Hauptprogramm If Hours = 23 And Minutes = 56 Then ' Gangkorrektur Day = Day + 1 Hours = 0 Minutes = 0 End If If Pind.0 = 1 Then ' set clock Minutes = Minutes + 1 End If If Pind.1 = 1 Then Hours = Hours + 1 Minutes_old = 100 End If If Pind.2 = 1 Then Day = Day + 1 Minutes_old = 100 End If If Pind.3 = 1 Then Day = Day + 100 Minutes_old = 100 End If 'Lowerline If Minutes <> Minutes_old Then ' Ausgabe, wenn sich die Minuten geändert haben Hours10 = Hours / 10 Minutes10 = Minutes / 10 Locate 2 , 0 'select the lower line Lcd Str(hours10) Lcd Str(hours) Lcd ":" 'display this at the lower line Lcd Str(minutes10) Lcd Str(minutes) Lcd " " Lcd Day Lcd Str(day) Minutes_old = Minutes ' Anzeige wurde aktualisiert End If Loop End Isr_von_timer1: Timer1 = 6942 Minutes = Minutes + 1 If Minutes = 60 Then Minutes = 0 Hours = Hours + 1 End If Return
Gruß
mic







Zitieren

Lesezeichen