Moin, mein erstes Programm ist fertig, und da stoße ich schon mal auf ein Problem.
Erstmal will ich dazu was sagen, dass ist meine 1 Variante, die evtl durch Profis besser und kürzer geht, aber mein Wissen ist leider nur so weit wie in diesem Programm zusehen ist.
Aber leider stoße ich da auf ein Problem. Ganz unten darf kein GOTO im Interrupt sein, aber ich hätte dort zugern eins. Nur wie Löse ich das Problem?
Code:$regfile = "m8def.dat" $crystal = 1000000 '***********************************************************************' Dim Scheibe As Integer Dim 5punkte As Integer Dim 10punkte As Integer Dim Punkte As Integer Dim A As Byte A = 0 Scheibe = 0 Punkte = 0 Config Portd.0 = Output Config Portd.5 = Output Config Portd.6 = Output Config Int0 = Rising Config Int1 = Rising Enable Interrupts Enable Int0 Enable Int1 On Int0 Int0_5punkte On Int1 Int1_10punkte Anfang: Do If Scheibe = 1 Then Goto Scheibe1 Else Portd.0 = 0 End If If Scheibe = 2 Then Goto Scheibe2 Else Portd.5 = 0 End If If Scheibe = 3 Then Goto Scheibe3 Else Portd.6 = 0 End If Incr A Loop Until A = 20 End 'hier erscheint ein Ton und zeigt das Ende mit Ergebnis. '*************************************************************************' Scheibe1: Portd.0 = 1 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 'wenn hier getroffen wurde, ist die variable 2, also die 2. Scheibe ist aktiv' Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Portd.0 = 0 Goto Anfang Scheibe2: Portd.0 = 1 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 2 Portd.0 = 0 Goto Anfang Scheibe3: Portd.0 = 1 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 3 Waitms 250 Set Scheibe = 1 Waitms 250 Set Scheibe = 2 Waitms 250 Set Scheibe = 1 Portd.0 = 0 Goto ANFANG '*************************************************************************' Int0_5punkte: 5punkte = Punkte + 5 Goto Anfang 'mein größtes Problem, der hier wäre sehr wichtig, geht aber nicht... Interrupt braucht ein Return' Int1_10punkte: 10punkte = Punkte + 10 Goto Anfang 'mein größtes Problem, der hier wäre sehr wichtig, geht aber nicht... Interrupt braucht ein Return'







Zitieren

Lesezeichen