ne, den benutze ich nicht. Ansonsten benutze ich nur Servos, Int0 , den ADC und eben den Timer0.
Hier mal das ganze Programm:
GrußCode:$regfile = "m8def.dat" $crystal = 8000000 Config Adc = Single , Prescaler = Auto , Reference = Avcc Config Servos = 1 , Servo1 = Portb.1 , Reload = 10 Config Timer0 = Timer , Prescale = 8 On Timer0 Isr_von_timer0 Config Int0 = Rising On Int0 Einedrehung Config Portb = Output Config Portc = Input Config Portd = Input Dim Zaehler As Word Dim Geschwindigkeit As Word Dim Zeit As Long Dim Servoposition As Byte Dim Potiposition As Byte Dim Temp As Byte Const Umfang = 80000000 'umfang in mm*100000 Const Vmax = 312 Start Adc 'maximalgeschwindigkeit in cm/s Do Servo(1) = 50 Zaehler = 0 Waitms 3000 Enable Interrupts Enable Int0 Do Gosub Holepotipos If Geschwindigkeit > Vmax Then Servoposition = 0.9 * Servoposition End If If Geschwindigkeit < Vmax Then Servoposition = Potiposition End If Temp = 50 + Servoposition Servo(1) = Temp Loop Loop Einedrehung: Disable Interrupts Disable Timer0 If Zaehler > 10 Then Zeit = Zaehler * 256 Geschwindigkeit = Umfang / Zeit 'in cm/s End If Zaehler = 0 Enable Timer0 Enable Interrupts Return Isr_von_timer0: Zaehler = Zaehler + 1 If Zaehler > 65530 Then Disable Timer0 Zaehler = 0 End If Return Holepotipos: Potiposition = Getadc(0) Potiposition = Potiposition / 10 Return End
Jan







Zitieren

Lesezeichen