erstens das und zweitens erstmal so zum test das programm werde ich gleich noch weiter ausbauen.
so es klappt zum mindestens mal so:
Code:$regfile = "m8def.dat" $crystal = 7372800 $baud = 9600 $hwstack = 34 $framesize = 34 $swstack = 34 Declare Sub Fahr_v() Declare Sub Stop_v() Declare Sub Fahr_r() Dim A As Word Dim B As Word Config Portc = &B11111111 Config Adc = Single , Prescaler = Auto , Reference = Internal Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 8 Config Pinb.1 = Output Motor1_pwm Alias Portb.1 Config Pind.4 = Output Motor1_in1 Alias Portd.4 Config Pind.5 = Output Motor1_in2 Alias Portd.5 Start Adc Do B = Getadc(1) Print B If B >= 200 Then Stop_v Else Fahr_v End If Loop End Sub Fahr_v: Motor1_in1 = 1 Motor1_in2 = 0 For A = 255 To 255 Pwm1a = A Waitms 10 Next A End Sub Sub Stop_v: Motor1_in1 = 1 Motor1_in2 = 1 For A = 255 To 0 Pwm1a = A Waitms 10 Next End Sub







Zitieren

Lesezeichen