Hallo
Jetzt ist doch wieder ein Problem aufgetaucht. Das Programm hängt bei bestimmten Zahlen.
Momentan bleibt es immer bei eins stehen und läuft nicht weiter darüber hinaus.
Vorher blieb es bei 5 oder 6 immer stehen.
Ich hab auch schon einen anderen Controller hergenommen.
Doch das bewirkt keinen Unterschied.
Kann das am Prgramm liegen ?
Hier mal mein Programm:
Frohe WeihnachtenCode:$regfile = "m8def.dat" $crystal = 1000000 ' 1MHZ crystal Config Portd.0 = Output Config Portd.1 = Output Config Portd.7 = Output Config Portd.3 = Output Config Portd.4 = Output Config Portd.5 = Output Config Portd.6 = Output Config Portd.2 = Input Config Portb.1 = Input Portd.2 = 1 Portb.1 = 1 Dim A As Integer A = 0 Do If Pind.2 = 1 Then 'Zähler hochzählen Incr A Waitms 50 End If If Pinb.1 = 0 Then 'Zähler runterzählen Decr A Waitms 50 End If If A >= 10 Then '10 als Maximalwert A = 0 Else End If If A = 0 Then Gosub Null End If If A = 1 Then Gosub Eins End If If A = 2 Then Gosub Zwei End If If A = 3 Then Gosub Drei End If If A = 4 Then Gosub Vier End If If A = 5 Then Gosub Fuenf End If If A = 6 Then Gosub Sechs End If If A = 7 Then Gosub Sieben End If If A = 8 Then Gosub Acht End If If A = 9 Then Gosub Neun End If If A = 10 Then Gosub Zehn End If If A = 11 Then Gosub Elf End If If A = 12 Then Gosub Zwoelf End If If A = 13 Then Gosub Dreizehn End If If A = 14 Then Gosub Vierzehn End If If A = 15 Then Gosub Fuenfzehn End If If A = 16 Then Gosub Sechzehn End If If A = 17 Then Gosub Siebzehn End If If A = 18 Then Gosub Achtzehn End If If A = 19 Then Gosub Neunzehn End If Loop Unterprogramm: A = A + 1 Return Null: Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 1 Portd.5 = 1 Portd.6 = 0 Waitms 450 Return Eins: Portd.1 = 1 Portd.7 = 1 Portd.3 = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 Portd.0 = 0 Waitms 450 Return Zwei: Portd.0 = 1 Portd.1 = 1 Portd.6 = 1 Portd.4 = 1 Portd.3 = 1 Portd.5 = 0 Portd.7 = 0 Waitms 450 Return Drei: Portd.0 = 1 Portd.1 = 1 Portd.6 = 1 Portd.7 = 1 Portd.3 = 1 Portd.5 = 0 Portd.4 = 0 Waitms 450 Return Vier: Portd.5 = 1 Portd.6 = 1 Portd.1 = 1 Portd.7 = 1 Portd.4 = 0 Portd.3 = 0 Portd.0 = 0 Waitms 450 Return Fuenf: Portd.0 = 1 Portd.5 = 1 Portd.6 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 0 Portd.1 = 0 Waitms 450 Return Sechs: Portd.0 = 1 Portd.5 = 1 Portd.6 = 1 Portd.4 = 1 Portd.3 = 1 Portd.7 = 1 Portd.1 = 0 Waitms 450 Return Sieben: Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 Waitms 450 Return Acht: Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 1 Portd.5 = 1 Portd.6 = 1 Waitms 450 Return Neun: Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.5 = 1 Portd.6 = 1 Portd.4 = 0 Waitms 450 Return Zehn: Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 1 Portd.5 = 1 Portd.6 = 0 Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Waitms 450 Return Elf: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.1 = 1 Portd.7 = 1 Portd.3 = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 Portd.0 = 0 Waitms 450 Return Zwoelf: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.1 = 1 Portd.6 = 1 Portd.4 = 1 Portd.3 = 1 Portd.5 = 0 Portd.7 = 0 Waitms 450 Return Dreizehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.1 = 1 Portd.6 = 1 Portd.7 = 1 Portd.3 = 1 Portd.5 = 0 Portd.4 = 0 Waitms 450 Return Vierzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.5 = 1 Portd.6 = 1 Portd.1 = 1 Portd.7 = 1 Portd.4 = 0 Portd.3 = 0 Portd.0 = 0 Waitms 450 Return Fuenfzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.5 = 1 Portd.6 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 0 Portd.1 = 0 Waitms 450 Return Sechzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.5 = 1 Portd.6 = 1 Portd.4 = 1 Portd.3 = 1 Portd.7 = 1 Portd.1 = 0 Waitms 450 Return Siebzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 0 Portd.4 = 0 Portd.5 = 0 Portd.6 = 0 Waitms 450 Return Achtzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.4 = 1 Portd.5 = 1 Portd.6 = 1 Waitms 450 Return Neunzehn: Portc.1 = 1 Portc.2 = 1 Portc.0 = 0 Portc.5 = 0 Portc.6 = 0 Portc.4 = 0 Portc.3 = 0 Portd.0 = 1 Portd.1 = 1 Portd.7 = 1 Portd.3 = 1 Portd.5 = 1 Portd.6 = 1 Portd.4 = 0 Waitms 450 Return
David







Zitieren

Lesezeichen