Hallo Leute,
Ich sitze jetzt schon eine ganze Zeit vor dem Testprogramm des RN Control und frage mich, wie das mit der PWM Ansteuerung der Motoren funktioniert.
Code:' Für Motorentest 'Ports für linken Motor Config Pinc.6 = Output 'Linker Motor Kanal 1 Config Pinc.7 = Output 'Linker Motor Kanal 2 Config Pind.4 = Output 'Linker Motor PWM 'Ports für rechten Motor Config Pinb.0 = Output 'Rechter Motor Kanal 1 Config Pinb.1 = Output 'Rechter Motor Kanal 2 Config Pind.5 = Output 'Rechter Motor PWM Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down Pwm1a = 0 Pwm1b = 0 Tccr1b = Tccr1b Or &H02 'Prescaler = 8 ........ ........ ........ 'Testet Motoren und Geschwindigkeitsreglung Sub Motortest() 'Linker Motor ein Portc.6 = 1 'bestimmt Richtung Portc.7 = 0 'bestimmt Richtung Portd.4 = 1 'Linker Motor EIN 'Rechter Motor ein Portb.0 = 1 'bestimmt Richtung rechter Motor Portb.1 = 0 'bestimmt Richtung rechter Motor Portd.5 = 1 'rechter Motor EIN I = 0 Do Pwm1a = I Pwm1b = I Waitms 40 I = I + 5 Loop Until I > 1023 Wait 1 Do Pwm1a = I Pwm1b = I Waitms 40 I = I - 5 Loop Until I < 1 Pwm1a = 0 'Linker Motor aus Pwm1b = 0 'rechter Motor aus End Sub
Verstehe ich das richtig, dass nur Pind.4 und Pind.5 auf PWM Eingestellt werden??
Wenn ja, woher weis der Compiler das? Ich kann das aus dem Code nicht rauslesen.







Zitieren

Lesezeichen