runner02
15.09.2011, 10:26
$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
Enable Timer1
Dim Minutes As Byte
Dim Hours As Byte
Dim Minutes10 As Byte
Dim Hours10 As Byte
Dim Day As Integer
Dim I As Byte
Minutes = 0
Minutes10 = 0
Hours10 = 0
Hours = 0
Ddrd = &B00000000 'input D
On Timer1 Isr_von_timer1
Enable Interrupts
Timer1 = 6942
Do ' Hauptprogramm
If Hours = 23 And Minutes = 56 Then
Day = Day + 1
Hours = 0
End If
Hours10 = Hours / 10
Minutes10 = Minutes / 10
If Pind.0 = 1 Then
Minutes = Minutes + 1
End If
If Pind.1 = 1 Then
Hours = Hours + 1
End If
If Pind.2 = 1 Then
Day = Day + 1
End If
If Pind.3 = 1 Then
Day = Day + 100
End If
Cls 'clear the LCD display
Lcd "Vienna Time" 'display this at the top line
'Lowerline
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)
Loop
Isr_von_timer1:
Timer1 = 6942
Minutes = Minutes + 1
If Minutes = 60 Then
Minutes = 0
Hours = Hours + 1
End If
Return
End
So, das ist nun meine neue Uhr ;)
Sie schreibt auch
"Vienna Time",
nur darunter die Zahlen 01:02 die wechselt hundert mal pro sekunde oder so, und dann entsteht eine Zahlenkette 1235454545125454512 -> 2ms später5454564545456465 -> 2ms 58645645647865456454 und der ganze Bildschirm flackert herum... Vlt findet jemand den Bug??
Mfg
$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
Enable Timer1
Dim Minutes As Byte
Dim Hours As Byte
Dim Minutes10 As Byte
Dim Hours10 As Byte
Dim Day As Integer
Dim I As Byte
Minutes = 0
Minutes10 = 0
Hours10 = 0
Hours = 0
Ddrd = &B00000000 'input D
On Timer1 Isr_von_timer1
Enable Interrupts
Timer1 = 6942
Do ' Hauptprogramm
If Hours = 23 And Minutes = 56 Then
Day = Day + 1
Hours = 0
End If
Hours10 = Hours / 10
Minutes10 = Minutes / 10
If Pind.0 = 1 Then
Minutes = Minutes + 1
End If
If Pind.1 = 1 Then
Hours = Hours + 1
End If
If Pind.2 = 1 Then
Day = Day + 1
End If
If Pind.3 = 1 Then
Day = Day + 100
End If
Cls 'clear the LCD display
Lcd "Vienna Time" 'display this at the top line
'Lowerline
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)
Loop
Isr_von_timer1:
Timer1 = 6942
Minutes = Minutes + 1
If Minutes = 60 Then
Minutes = 0
Hours = Hours + 1
End If
Return
End
So, das ist nun meine neue Uhr ;)
Sie schreibt auch
"Vienna Time",
nur darunter die Zahlen 01:02 die wechselt hundert mal pro sekunde oder so, und dann entsteht eine Zahlenkette 1235454545125454512 -> 2ms später5454564545456465 -> 2ms 58645645647865456454 und der ganze Bildschirm flackert herum... Vlt findet jemand den Bug??
Mfg