Versuch mal, ist eine variante, da dreht er sich ewig hin und her

Code:
$regfile = "m32def.dat"                                     'controller definieren
$crystal = 16000000                                         'Taktfrequenz definieren

Dim I As Byte
Dim A As Byte
Dim Zeit As Byte

Config Portb = Output                     'Port als "Ausgang" definieren
Config Portc = Output
Config Portd = Output

1a Alias Portb.0                               'Pin als Spule 1a benennen
1b Alias Portb.1                               'Spule 1b

2a Alias Portc.6                                            'Spule 2a
2b Alias Portc.7                                            'Spule 2b


Portb.0 = 0                                                 'Spule 1a definiert auf Null
Portb.1 = 0                                                 'Spule 1b

Portc.6 = 0                                                 'Spule 2a
Portc.7 = 0                                                 'Spule 2b

Portd.4 = 1                                                 'Motortreiber Spule 1 Enable
Portd.5 = 1                                                 'Motortreiber Spule 2 Enable


Dim Stepp As Integer
Dim Direct As Integer

   Direct = -1                                              ' rückwärts
   Zeit = 3

   Do
      Direct = Direct * -1                                  ' ändern richtung
      For A = 1 To 240
         Stepp = Stepp + Direct
         Stepp = Stepp And &H0003
         On Stepp Gosub P_0 , P_1 , P_2 , P_3
         Waitms Zeit
      Next
  Loop
End

P_0:
  1a = 1 : 1b = 0 : 2a = 1 : 2b = 0                         'Schritt 1
  Return
P_1:
  1a = 1 : 1b = 0 : 2a = 0 : 2b = 1                         'Schritt 2
  Return
P_2:
  1a = 0 : 1b = 1 : 2a = 0 : 2b = 1                         'Schritt 3
  Return
P_3:
  1a = 0 : 1b = 1 : 2a = 1 : 2b = 0                         'Schritt 4
  Return