Moin,
Nun funktioniert alles super. Der Zufall ist sogar viel besser mit 50ms.
Ich wollte dies jetzt nur für mich vollenden, damit ich auch mal eins hin bekommeUnd nun muss ich mich mal mit den ATmega88 beschäftigen, was der so alles braucht.
Wenn ich das ATmega88 habe, kann ich die einzelnen Trigger deaktiveren, um ein 2. Treffer zu verhinden?
-EDIT-
Ich habe eben bemergt, das ich schon bei 3kb bin und ich werde bestimmt über 8kb kommen, und von daher lohnt sich der atmega88 leider nicht. Kennt jemand noch einen der mindestens 6 Triggers umschalten kann?
mfg EKI
Hier der Code, und sogar noch optimiert:
Code:$regfile = "m32def.dat" $framesize = 32 $swstack = 32 $hwstack = 32 $crystal = 1000000 '***********************************************************************' Dim Scheibe As Integer Dim Punkte As Integer Dim Scheibe_akt As Bit Dim A As Byte Dim B As Byte A = 0 B = 0 Scheibe = 1 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 Do '---------------------' If Scheibe = 1 Then Portd.0 = 1 Scheibe = 0 Do Incr Scheibe Waitms 50 If Scheibe_akt = 1 Then Goto Anfang End If Incr B If Scheibe = 3 Then Scheibe = 0 End If Loop Until B = 15 Scheibe = 2 Portd.0 = 0 Goto Anfang Else Portd.0 = 0 End If '---------------------' If Scheibe = 2 Then Portd.5 = 1 Scheibe = 0 Do Incr Scheibe Waitms 50 If Scheibe_akt = 1 Then Goto Anfang End If Incr B If Scheibe = 3 Then Scheibe = 0 End If Loop Until B = 15 Scheibe = 3 Portd.5 = 0 Goto Anfang Else Portd.5 = 0 End If '---------------------' If Scheibe = 3 Then Portd.6 = 1 Scheibe = 0 Do Incr Scheibe Waitms 50 If Scheibe_akt = 1 Then Goto Anfang End If Incr B If Scheibe = 3 Then Scheibe = 0 End If Loop Until B = 15 Scheibe = 1 Portd.6 = 0 Goto Anfang Else Portd.6 = 0 End If Anfang: Scheibe_akt = 0 B = 0 Waitms 2000 Incr A Loop Until A = 20 Portd.0 = 1 Portd.5 = 1 Portd.6 = 1 End 'hier erscheint ein Ton und zeigt das Ende mit Ergebnis. '*************************************************************************' Int0_5punkte: Punkte = Punkte + 5 Portd.0 = 0 Portd.5 = 0 Portd.6 = 0 Scheibe_akt = 1 Return Int1_10punkte: Punkte = Punkte + 10 Portd.0 = 0 Portd.5 = 0 Portd.6 = 0 Scheibe_akt = 1 Return







Zitieren

Lesezeichen