Gast
#1481970
Hallo, ich habe mit "open .... #1" und mit $baud zwei serielle Schnittstellen definiert. Beide 9600 baud. Jede geht einzeln, aber bei gleichzeitiger Definition im Programm geht nur Print aber nicht input #1, ... Wird print nicht benutzt, dann geht auch Input #1 Gleiches Problem gibts bei Print #2 Kann das nicht beides gehen oder muss ich etwas anders machen ? Janosch Code: '======================================================================= ======= ' GPS-ST22 Modul für ATMEGA32 '======================================================================= ======= $regfile = "m32def.dat" ' ATmega32 $crystal = 12000000 '$baud = 9600 ' NMEA Schnittstelle $hwstack = 32 ' default use 32 for the hardware stack $swstack = 10 ' default use 10 for the SW stack $framesize = 40 ' default use 40 for the frame space ' ' Format siehe http://www.nmea.de/nmea0183datensaetze.html ' Dim S0 As String * 6 , S1 As String * 100 , S2 As String * 50 Dim Sat_str As String * 15 , T1 As Byte , Mybaud As Long , K(35) As Byte Dim A As Byte , I As Byte , J As Byte , Le As Byte , Pos As Byte Dim S_time As String * 10 , S_br As String * 9 , S_le As String * 10 Dim S_date As String * 6 , C As Single , Br As Single , Lee As Single Dim S_output As String * 11 Declare Sub Line1(byval P As Byte) 'Zeilenauswahl bei 4-zeiligem Display Declare Sub Line2(byval P As Byte) Declare Sub Line3(byval P As Byte) Declare Sub Line4(byval P As Byte) ' LCD 4*27 oder 2*16 an Port B bzw. Steckanschluss Config Portb = Output Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.5 , Rs = Portb.4 Config Lcd = 40 * 4 'muss sein für BASCOM-Ausgaben mit 16 Zeichen und 2 Zeilen Config Lcdbus = 4 'Definition einer seriellen Schnittstelle als Kanal #1 Open "ComC.6:9600,8,n,1" For Input As #1 Open "ComD.1:9600,8,n,1" For Output As #2 Do Print #2 , S1 Do : Loop Until Waitkey(#1) = 36 'Warten auf "$" Input #1 , S1 If Left(s1 , 6) = "GPGGA," Then 'Kommapositionen suchen Sat_str = Mid(s1 , 44 , 15) 'Anzahl der Satelliten+Höhe End If If Left(s1 , 5) = "GPRMC" Then Cls 'Kommasuche im String Le = Len(s1) J = 0 For I = 1 To Le If Mid(s1 , I , 1) = "," Then 'Komma gefunden J = J + 1 K(j) = I 'Kommaposition speichern End If Next I 'J = Anzahl der Kommas For I = 1 To J Incr K(i) 'Datenanfang: Kommaposition+1 Le = K(i + 1) - K(i) 'Länge des Datenteils If I = 1 Then S_time = Mid(s1 , K(i) , Le) If I = 3 Then S_br = Mid(s1 , K(i) , Le) If I = 5 Then S_le = Mid(s1 , K(i) , Le) If I = 9 Then S_date = Mid(s1 , K(i) , Le) Next I C = Val(s_br) : C = C / 100 : Br = Int(c) 'Anpassung der Strings C = C -br : C = C / 0.6 : Br = Br + C : S_br = Str(br) : S_br = Left(s_br , 8) C = Val(s_le) : C = C / 100 : Lee = Int(c) C = C -lee : C = C / 0.6 : Lee = Lee + C : S_le = Str(lee) : S_le = Left(s_le , 8) Call Line1(1) : Lcd "D:" ; S_date ; " T:" ; S_time Call Line2(1) : Lcd "B:" ; S_br ; " L:" ; S_le Call Line4(10) Lcd Sat_str 'Anzahl End If Loop