bin nciht sicher ob das so alles stimmt, weil ich die letzte version nciht finde, aber so grob sollte es stimmen...
Code:
$regfile = "m8def.dat"
$crystal = 8000000
'-----LCD-----
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.5 , Rs = Portc.4
'----Ports----
Config Pinb.1 = Output
Uv Alias Portb.1
Config Pinb.0 = Input
Config Pind.7 = Input
Config Pind.6 = Input
Config Pind.5 = Input
Minplus Alias Portb.0
Secplus Alias Portd.7
Minminus Alias Portd.6
Secminus Alias Portd.5
'-----VAR-----
Dim Bel_min As Integer
Dim Bel_sec As Integer
Dim Rest_min As Byte
Dim Rest_sec As Byte
Dim Start_uv As Bit
'-----Subs-----
Declare Sub Zeile1
Declare Sub Zeile2
Cls
Locate 1 , 1
Lcd "Hallo :)"
Wait 1
Bel_min = 0
Bel_sec = 0
Rest_min = 0
Rest_sec = 0
Start_uv = 0
Do
If Start_uv = 0 Then ' Einstellmodus
If Pinb.0 = 0 Then
Incr Bel_min
End If
If Pind.7 = 0 And Pind.5 = 1 Then
Incr Bel_sec
End If
If Pind.6 = 0 Then
Decr Bel_min
End If
If Pind.5 = 0 And Pind.6 = 1 Then
Decr Bel_sec
End If
If Bel_min < 0 Then 'überlauf
Bel_min = 0
End If
If Bel_sec < 0 Then
Bel_sec = 0
End If
If Bel_min >= 60 Then 'überlauf
Bel_min = 0
End If
If Bel_sec >= 60 Then
Bel_sec = 0
End If
Waitms 200
Zeile1
End If
If Pind.7 = 0 And Pind.5 = 0 Then ' Starten Stoppen
If Start_uv = 0 Then
Start_uv = 1
Rest_sec = Bel_sec
Rest_min = Bel_min
Else
Start_uv = 0
End If
End If
If Start_uv = 1 Then
Uv = 1
If Rest_sec = 0 Then
If Rest_min > 0 Then
Decr Rest_min
Rest_sec = 60
end if
if Rest_min = 0 Then
Uv = 0
Start_uv = 0
Locate 2 , 1
Lcd "*Fertig*"
end if
End If
Wait 1
Decr Rest_sec
Zeile2
End If
Loop
Sub Zeile1
Locate 1 , 1
If Bel_min < 10 Then
If Bel_sec < 10 Then
Lcd "Tg=0" ; Bel_min ; ":0" ; Bel_sec
Else
Lcd "Tg=0" ; Bel_min ; ":" ; Bel_sec
End If
Else
If Bel_sec < 10 Then
Lcd "Tg=" ; Bel_min ; ":0" ; Bel_sec
Else
Lcd "Tg=" ; Bel_min ; ":" ; Bel_sec
End If
End If
End Sub
Sub Zeile2
Locate 2 , 1
If Rest_min < 10 Then
If Rest_sec < 10 Then
Lcd "Tr=0" ; Rest_min ; ":0" ; Rest_sec
Else
Lcd "Tr=0" ; Rest_min ; ":" ; Rest_sec
End If
Else
If Rest_sec < 10 Then
Lcd "Tr=" ; Rest_min ; ":0" ; Rest_sec
Else
Lcd "Tr=" ; Rest_min ; ":" ; Rest_sec
End If
End If
End Sub
Lesezeichen