Gast
#652399
Hi,
ich habe mir einen kleinen GPS-Empfaenger gebastelt. Komischerweise
resetet sich das ding in etwa jede Sekunde und ab und zu funktioniert es
per Zufall, kann mir jemand weiterhelfen? Hier der Sourcecode:
$regfile = "m8def.dat"
$crystal = 16000000
$baud = 4800
Config Portb = Output
Config Portd = Input
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 ,
Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcd = 20 * 4
Cls
Cursor Off
Dim C As Byte
Dim I As Byte
Dim Time As String * 6
Dim Av As String * 2
Dim Lat As String * 8
Dim Ns As String * 2
Dim Lon As String * 9
Dim Ew As String * 2
Dim Spd As String * 6
Dim Crs As String * 6
Dim Leng As Byte
Dim Xx As Bit
Dim A As Byte
Declare Sub Wait_for_string(byval S As String)
Declare Function Read_string() As String
Cls
Wait 1
Upperline
Lcd ""
Lowerline
Lcd ""
Thirdline
Lcd ""
Fourthline
Lcd ""
Wait 3
Cls
Config Serialin = Buffered , Size = 100 ' Konfig.
der ser. Eingabe
Enable Interrupts
' $GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh
Do
Call Wait_for_string( "$GPRMC,") ' Warte auf
$GPRMC
Time = Read_string()
Av = Read_string()
Lat = Read_string()
Leng = Len(lat) - 1
Lat = Left(lat , Leng)
Ns = Read_string()
Leng = Len(ns) - 1
Ns = Left(ns , Leng)
Lon = Read_string()
Leng = Len(lon) - 1
Lon = Left(lon , Leng)
Ew = Read_string()
Leng = Len(ew) - 1
Ew = Left(ew , Leng)
Spd = Read_string()
Leng = Len(spd) - 1
Spd = Left(spd , Leng)
Crs = Read_string()
Leng = Len(crs) - 1
Crs = Left(crs , Leng)
If Av = "A," Then
Locate 1 , 1
Lcd "LAT: "
Locate 2 , 1
Lcd "LON: "
Locate 3 , 1
Lcd "HDG: "
Locate 4 , 1
Lcd "SPD:"
Locate 1 , 6
Lcd Lat
Lcd Ns
Locate 2 , 6
Lcd Lon
Lcd Ew
Locate 3 , 6
Lcd Crs
Locate 4 , 6
Lcd Spd
Locate 1 , 16
Lcd " "
Locate 2 , 16
Lcd " "
Locate 3 , 11
Lcd " "
Locate 4 , 11
Lcd " "
Locate 4 , 5
Lcd " "
'Spdkm = Val(spd)
'Spdkm = Spdkm * 1852
'Lcd Spdkm
'If Av = "V," Then Av = "*"
'If Av = "A," Then Av = " "
'Locate 4 , 11
'Lcd Av
End If
Toggle Xx
Loop
End
'------------------------------------------------------
Sub Wait_for_string(byval S As String) As String
Local Ii As Byte
Local Cc As Byte
Ii = 1
M1:
Cc = Waitkey()
If Cc <> Mid(s , Ii , 1) Then
Goto M1
Else
Incr Ii
If Ii > Len(s) Then Goto M2
Goto M1
End If
M2:
End Sub
'------------------------------------------------------
Function Read_string() As String
Local Cc As Byte
Local Ss As String * 10
Ss = ""
Do
Cc = Waitkey()
Ss = Ss + Chr(cc)
Loop Until Cc = ","
Read_string = Left(ss , 10)
End Function
'_____________________________________________________