$regfile = "m8def.dat" $crystal = 3686400 $baud = 9600 $hwstack = 100 $swstack = 100 $framesize = 100 'Config Serialin = Buffered , Size = 10 Config Portd = Output Config Portb = Input Dim S As String * 200 Dim Z As Integer Dim Y As Integer Dim B As String * 1 Dim A As Byte Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.4 , Rs = Portc.5 Config Lcd = 20 * 4 Echo Off 'Enable Interrupts Print "at+cmgf=1" Waitms 300 Hauptprg: Wait 4 Cls Lcd "HauptProgramm" Wait 1 If Pinb.2 = 0 Then Gosub Smsloeschen End If 'If Pinb.1 = 0 Then Gosub Einlesen 'End If Goto Hauptprg Einlesen: Cls Lcd "Einlesen" Z = 0 S = "" Print "at+cmgf=1" Wait 2 'Handy befragen Print "at+cmgl" 'Waitms 200 Do If Usr.rxc = 1 Then Set Portd.1 A = Udr B = Chr(a) 'Print A Z = 0 Else Reset Portd.1 B = "" Z = Z + 1 'Überlaufzähler End If If Right(s , 2) <> "ok" Then 'Meine SMS enden alle mit ok S = S + B Else Exit Do End If If Len(s) > 170 Then 'S = "Ueberlauf" Exit Do End If If Z > 3000 Then 'Falls das Ptro S = "Time out" Exit Do End If Loop If Len(s) > 20 Then Y = 20 Else Y = Len(s) End If 'Print Right(s , Y) Cls Lcd Right(s , Y) Return Smsloeschen: Print "at+cmgd=1" Waitms 200 Print "at+cmgd=2" Cls Lcd "SMS geloescht" Waitms 200 Return