Der Rest läuft nicht einfach weiter. Ein Input blockiert den MC auch in einem Unterprogramm, wenn da keine Daten anliegen.
Könnte jetzt laufen.Code:$crystal = 1000000 $regfile = "m16def.dat" $baud = 2400 Config Pinb.6 = Input Config Portc = Output Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Prescale = 1 Config Lcdpin = Pin , Db4 = Portb.2 , Db5 = Portb.3 , Db6 = Portb.4 , _ Db7 = Portb.5 , E = Portb.1 , Rs = Portb.0 Config Adc = Single , Prescaler = Auto , Reference = Avcc Start Adc Config Lcd = 16 * 2 Cursor Off Cls Dim Asd As String * 5 Dim P0 As Byte At Asd Overlay Dim P1 As Word At Asd + 2 Overlay Dim B As Byte Dim P(10) As Word Do If Pinb.6 = 0 Then Locate 1 , 1 Lcd P(1) Locate 1 , 5 Lcd "P1" Locate 1 , 8 Lcd P(2) Locate 1 , 12 Lcd "P2" Locate 2 , 1 Lcd P(3) Locate 2 , 5 Lcd "P3" Locate 2 , 7 Lcd P(4) Locate 2 , 11 Lcd "P4" Locate 2 , 13 Lcd P(5) Else Locate 1 , 1 Lcd P(6) Locate 1 , 5 Lcd "P6" Locate 1 , 8 Lcd P(7) Locate 1 , 12 Lcd "P7" Locate 2 , 1 Lcd P(8) Locate 2 , 5 Lcd "P8" Locate 2 , 7 Lcd P(9) Locate 2 , 11 Lcd "P9" Locate 2 , 13 Lcd P(10 ) End If P(6) = Getadc(0) P(7) = Getadc(1) P(8) = Getadc(2) P(9) = Getadc(3) P(10) = Getadc(4) If P(1) <> P(6) Then Portc.0 = 1 Else Portc.0 = 0 If P(1) = P(6) Then Portc.1 = 1 Else Portc.1 = 0 If P(2) <> P(7) Then Portc.2 = 1 Else Portc.2 = 0 If P(2) = P(7) Then Portc.3 = 1 Else Portc.3 = 0 If P(3) <> P(8) Then Portc.4 = 1 Else Portc.4 = 0 If P(3) = P(8) Then Portc.5 = 1 Else Portc.5 = 0 If P(4) <> P(9) Then Portc.6 = 1 Else Portc.6 = 0 If P(4) = P(9) Then Portc.7 = 1 Else Portc.7 = 0 'ANFANG UNTERPROGRAMM If Ischarwaiting() = 1 Then Gosub Empfangen End If 'ENDE UNTERPROGRAMM Loop End Empfangen: B = Inkey() If Len(asd) < 5 Then Asd = Asd + Chr(b) End If If Len(asd) = 5 Then Gosub Auswerten End If Return Auswerten: If P0 > 0 And P0 < 6 Then P(p0) = P1 Print P(p0) End If asd="" Return
Jedoch wird keine Abweichung / Versatz abgefangen
Wer sendet denn die Daten und wie werden die abgeschlossen?







Zitieren


Lesezeichen