Witam, jak w temacie. Otóż mam problem, napisałem program sterownika do akwarium i po 3 wejściach do menu zatrzymuje sie program i pojawiają się krzaki na wyświetlaczu. W symulatorze bascoma widac jak program zatrzymuje się w 2 linii wyświetlacza podczas wyświetlania zmiennej.
oto program i zaznaczam gdzie zatrzymuje program
oto program i zaznaczam gdzie zatrzymuje program
$regfile = "m8def.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcd = 16 * 2
Config 1wire = Portb.0
Dim Dsid1(8) As Byte
Dim I1 As Integer , Ss As String * 6
Deflcdchar 0 , 8 , 20 , 8 , 6 , 9 , 8 , 9 , 6
Deflcdchar 1 , 14 , 17 , 17 , 17 , 14 , 14 , 4 , 32 '
Config Clock = Soft
Config Date = Dmy , Separator = -
Enable Interrupts
Date$ = "00-00-00"
Time$ = "00:00:00"
Config Pind.4 = Input
Config Pind.2 = Input
Config Pind.3 = Input
Config Pind.1 = Input
Config Pind.5 = Output
Config Pind.0 = Output
Config Pind.7 = Output
Dim G1 As Byte
Dim M1 As Byte
Dim G2 As Byte
Dim M2 As Byte
Dim M11 As Byte
Dim M22 As Byte
Declare Sub Swiatlo
Declare Sub Pompka
Declare Sub Dat
Declare Sub Kar_b
Declare Sub Kar_a
Declare Sub Ustaw_godz
Declare Sub Temperatura_godzina
Declare Sub Karmienie
Cls
Cursor Off
Locate 1 , 4
Lcd "Sterownik"
Locate 2 , 4
Lcd "Akwarium"
Wait 2
Cls
Dsid1(1) = 1wsearchfirst()
Readeeprom _min , 1
Readeeprom _hour , 2
Readeeprom _day , 3
Readeeprom _month , 4
Readeeprom _year , 5
_hour = 1
_min = 1
Temperatura_godzina:
Do
Portd.1 = 1
Readeeprom G1 , 6
Readeeprom M1 , 7
Readeeprom G2 , 8
Readeeprom M2 , 9
1wreset
1wwrite &H55
1wverify Dsid1(1)
1wwrite &HBE
I1 = 1wread(2)
1wreset
1wwrite &HCC
1wwrite &H44
Waitms 750
I1 = I1 * 10
I1 = I1 / 16
Ss = Str(i1)
Ss = Format(ss , "0.0")
Cls
Locate 1 , 1
Lcd "T:" ; Ss ; Chr(0)
Locate 1 , 9
Lcd Time$
Locate 2 , 5
Lcd Date$
If Pind.7 = 1 Then
Locate 2 , 15
Lcd Chr(1)
End If
M11 = M1 + 5
M22 = M2 + 5
If _hour = G1 And _min = M1 And _sec = 0 Then
Call Karmienie
End If
If _hour = G2 And _min = M2 Then
Call Karmienie
End If
If _hour = G1 And _min = M11 Then
Portd.0 = 1
End If
If _hour = G2 And _min = M22 Then
Portd.0 = 1
End If
If _hour = 7 Then
Portd.7 = 1
End If
If _hour = 19 Then
Portd.7 = 0
End If
If Pind.1 = 0 Then
Waitms 30
Call Ustaw_godz:
End If
Loop
Ustaw_godz:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Cls
Locate 1 , 4
Lcd "ustaw czas "
Locate 2 , 1
Lcd ; _hour ; ":" ; _min; <--- tu sie zatrzymuje
Waitms 100
If Pind.2 = 0 Then
Waitms 30
_min = _min + 1
End If
If Pind.3 = 0 Then
Waitms 30
_hour = _hour + 1
End If
If Pind.1 = 0 Then
Waitms 30
Writeeeprom _hour , 1
Writeeeprom _min , 2
Call Dat:
End If
Goto Ustaw_godz:
Dat:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Portd.4 = 1
Cls
Locate 1 , 4
Lcd "ustaw date"
Locate 2 , 1
Lcd ; _day ; "-" ; _month ; "-" ; _year;
Waitms 100
If Pind.2 = 0 Then
Waitms 30
_day = _day + 1
End If
If Pind.3 = 0 Then
Waitms 30
_month = _month + 1
End If
If Pind.4 = 0 Then
Waitms 30
_year = _year + 1
End If
If Pind.1 = 0 Then
Waitms 30
Writeeeprom _day , 3
Writeeeprom _month , 4
Writeeeprom _year , 5
Call Kar_a:
End If
Goto Dat:
Kar_a:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Cls
Locate 1 , 1
Lcd "czas karmienia 1"
Locate 2 , 1
Waitms 100
If Pind.2 = 0 Then
Waitms 30
G1 = G1 + 1
End If
If Pind.3 = 0 Then
Waitms 30
M1 = M1 + 1
End If
If Pind.1 = 0 Then
Waitms 30
Writeeeprom G1 , 6
Writeeeprom M1 , 7
Call Kar_b:
End If
Goto Kar_a:
Kar_b:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Cls
Locate 1 , 1
Lcd "czas karmienia 2"
Locate 2 , 1
Waitms 100
If Pind.2 = 0 Then
Waitms 30
G2 = G2 + 1
End If
If Pind.3 = 0 Then
Waitms 30
M2 = M2 + 1
End If
If Pind.1 = 0 Then
Waitms 30
Writeeeprom G2 , 8
Writeeeprom M2 , 9
Call Pompka:
End If
Goto Kar_b:
Pompka:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Cls
Locate 1 , 6
Lcd "Pompka"
If Pind.2 = 0 Then
Waitms 30
Portd.0 = 1
End If
If Pind.0 = 1 Then
Locate 2 , 6
Lcd " wlaczona"
End If
If Pind.3 = 0 Then
Waitms 30
Portd.0 = 0
End If
If Pind.0 = 0 Then
Locate 2 , 6
Lcd "wylaczona"
End If
Waitms 100
If Pind.1 = 0 Then
Waitms 30
Call Swiatlo:
End If
Goto Pompka:
Swiatlo:
Portd.2 = 1
Portd.3 = 1
Portd.1 = 1
Cls
Locate 1 , 5
Lcd "Swiatlo"
If Pind.2 = 0 Then
Waitms 30
Portd.7 = 1
End If
If Pind.7 = 1 Then
Locate 2 , 6
Lcd " wlaczone"
End If
If Pind.3 = 0 Then
Waitms 30
Portd.7 = 0
End If
If Pind.7 = 0 Then
Locate 2 , 6
Lcd "wylaczone"
End If
Waitms 100
If Pind.1 = 0 Then
Waitms 30
Call Temperatura_godzina:
End If
Goto Swiatlo:
Karmienie:
Portd.0 = 0
Portd.5 = 1
Wait 1
Portd.5 = 0