$regfile = "m8def.dat"
$crystal = 1000000
Deflcdchar 0 , 4 , 10 , 4 , 32 , 32 , 32 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 1 , 32 , 4 , 4 , 4 , 4 , 4 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 2 , 32 , 1 , 2 , 4 , 8 , 16 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 3 , 32 , 32 , 32 , 31 , 32 , 32 , 32 , 32 ' replace ? with number (0-7)
Deflcdchar 4 , 32 , 16 , 8 , 4 , 2 , 1 , 32 , 32 ' replace ? with number (0-7)
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portd.6 , Db6 = Portb.2 , Db7 = Portb.1 , E = Portb.0 , Rs = Portd.7
Config Timer0 = Timer , Prescale = 8 : Enable Interrupts : Enable Timer0
On Timer0 Zegar
Config Lcd = 16 * 2
Config 1wire = Portd.2 : Config 1wire = Portd.3
Config Portd.5 = 1 : Portd.5 = 1
Dim B1 As Byte : Dim B2 As Byte : Dim R As Byte : Dim Znak As String * 1 : Dim Tmp As String * 4
Dim T1 As Single : Dim T2 As Single : Dim Tu As Single : Dim Tu1 As Single
Dim Sek As Byte : Dim Minu As Byte : Dim Godz As Byte : Dim Setne As Word 'zmienne dla zegara
Dim Wl_przek As Byte : Dim Flaga As Bit
Dim Anim As Byte
Flaga = 0
R = 255
Tu = 28 : Tu1 = Tu + 2
Sek = 0 : Minu = 22 : Godz = 22 : Setne = 0
Wl_przek = 0 : Flaga = 0 : Anim = 1
Cursor Off
Cls
Do
Disable Interrupts
1wreset Pind , 2
1wwrite &HCC , 1 , Pind , 2
1wwrite &H44 , 1 , Pind , 2
Enable Interrupts
Waitms 500
1wreset Pind , 2
1wwrite &HCC , 1 , Pind , 2
1wwrite &HBE , 1 , Pind , 2
B1 = 1wread(1 , Pind , 2)
B2 = 1wread(1 , Pind , 2)
If Flaga = 1 Then
Locate 1 , 14 : Lcd Wl_przek
Locate 2 , 14 : Lcd Chr(anim)
Incr Anim
If Anim = 5 Then Anim = 1
Else
Anim = 1
Locate 2 , 14 : Lcd " "
End If
Upperline
Lcd "temp.:"
Lowerline
Lcd "ust. : " ; Tu ; Chr(0) ;
Locate 1 , 7
'prcedura przeliczajaca temperature z czujnikow DS18B20
If B2 >= 248 Then
B1 = R - B1
B2 = R - B2
Znak = "-"
Else
Znak = " "
End If
T1 = B1 / 16
T2 = B2 * 16
T1 = T1 + T2
T1 = T1 + 0.05
If T1 < Tu Then
Portd.5 = 0
If Flaga = 0 Then
Flaga = 1
Wl_przek = Wl_przek + 1
End If
End If
If T1 > Tu1 Then
Portd.5 = 1
Flaga = 0
End If
Tmp = Fusing(t1 , "##.&")
If T1 > 99.999 Then
Lcd Tmp ; Chr(0) ;
Else
If T1 > 9.999 Then
Lcd Znak ; Tmp ; Chr(0) ;
Else
Lcd Znak ; " " ; Tmp ; Chr(0) ;
End If
End If
Loop
Zegar:
Timer0 = 12
Incr Setne
If Setne = 500 Then
Incr Sek
Setne = 0
End If
If Sek = 60 Then
Sek = 0
Incr Minu
If Minu = 60 Then
Minu = 0
Incr Godz
If Godz = 24 Then
Godz = 0
Wl_przek = 0 'co 24 godziny zeruj licznik wlaczen przekaznika
End If
End If
End If
Return
End