Hi leute,
Nachdem ich dachte das problem lag an den falschen Pins, hab ich nun die wahre ursache herrausgefunden.
Also mein motor dreht nur in eine richtung, bzw lässt sich nach der ersten änderung nichtmehr ändern.
Aber NUR wenn ich auch die geschwindigkeit durch PWM verändern will
Sobald irgendwo Speed= x steht, bzw Compare1a = x, dreht der motor nurnoch in eine richtung.Code:$regfile = "m8def.dat" $crystal = 8000000 $baud = 19200 $hwstack = 32 $swstack = 10 $framesize = 40 Config Portb.1 = Output 'PWM Config Portc.0 = Output 'motor Config Portc.1 = Output 'motor Config Portd.5 = Output ' LED M1 Alias Portc.0 M2 Alias Portc.1 Led Alias Portd.5 Speed Alias Compare1a Declare Sub Drive(byval Direction As Byte , Byval Geschwindigkeit As Byte) Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up , Prescale = 1 Do Call Drive(1 , 1) Wait 1 Call Drive(0 , 1) Wait 1 Loop End Sub Drive(byval Direction As Byte , Byval Geschwindigkeit As Byte) Waitms 200 If Direction = 0 Then M1 = 0 M2 = 1 End If If Direction = 1 Then M1 = 1 M2 = 0 End If If Direction = 3 Then M1 = 0 M2 = 0 Waitms 5 M1 = 1 M2 = 0 endif End Sub
Weiss jemand woran das liegt?
LG Raz







Zitieren


Lesezeichen