Mógłby ktoś zerknąć na kod? Portami się nie przejmujcie. Z góry dzięki!
$regfile = "m8def.dat"
$crystal = 8000000
Config Lcdbus = 4
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Pb.4 , Db5 = Pb.5 , Db6 = Pb.6 , Db7 = Pb.7 , E = Pb.3 , Rs = Pb.2
Config Portd = Output
Config 1wire = Portb.0 ' termometr ds18b20
Dim I As Integer 'zmienne do odczytu temp.
Dim S As Single
Dim T As String * 4
Dim H As String * 4
Deflcdchar 0 , 6 , 9 , 6 , 32 , 32 , 32 , 32 , 32 ' znak stopnia
Cursor Off
Cls
'pomiar temp. na termometrze ds18b20
Do
1wreset
1wwrite &HCC
1wwrite &H44
Waitms 750
1wreset
1wwrite &HCC
1wwrite &HBE
I = 1wread(2)
S = I / 16
T = Fusing(s , "##.#")
Locate 1 , 1
Lcd "Temp:" ; T ; Chr(0) ; "C"
Lowerline "Ustaw.:" ; T1 ; Chr(0) ; "C"
T1 = 20
H = 3
If Portd.1 = 1 & Portd. = 1 Then
Lcd "Histereza:" ; H ; Chr(0) ; "C"
If Portd.1 = 1 Then
H = H + 1
End If
If Portd.2 = 1 Then
H = H - 1
End If
Else If Portd.1 = 1 Then
T1 = T1 + 1
Else If Portd.2 = 1 Then
T1 = T1 - 1
End If
A1 = T - H
A2 = T + H
If Temp <= A1 Then
Portb.2 = 1
Waitms 50
Stan = 1
End If
If Temp >= A2 Then
Waitms 50
Portb.2 = 0
Stan = 0
End If
Loop