Schnell hingefetzes Beispiel, nicht getestet, ohne Gewähr und nix:
deine Pin- und Servo konfiguration kannst du selbst einfügen.
Prescale und Preload mußt du dir aus dem "$crystal = " ausrechnen.Code:Const Tmr_c_prescale = xxx Const Tmr_c_preload = xxx Config Timer1 = Timer , Prescale = Tmr_c_prescale 'Timer 1mS On Timer1 Interrupt_ticker ' Timer for Timer Queue dim mycount as word Enable Timer1 Enable Interrupts Do If Pind.6 = 1 Then mycount = 2000 else mycount = 0 Servo(1) = 120 End If Loop End '----------------------------------------------------- Interrupt_ticker: Timer1 = Tmr_c_preload if mycount > 0 then decr mycount if mycount = 0 then Servo(1) = 60 end if end if Return
Btw:
Du mußt übrigens Timer1 nehmen, weil Bascom timer0 für die Servos braucht.
Ich hoff', das klappt
EDIT: Bei Pin=0 MUSST du den Zähler zurücksetzen, sonst fetzt er dir ja vielleicht ins gerade-fahren rein.
Lesezeichen