-
-
Declare Sub Motortest()
$regfile = "m32def.dat"
Config Pinc.6 = Output Linker Motor Kanal 1
Config Pinc.7 = Output Linker Motor Kanal 2
Config Pind.4 = Output Linker Motor PWM
Config Pinb.0 = Output Linker Motor Kanal
Config Pinb.1 = Output Linker Motor Kanal
Config Pind.5 = Output Linker Motor PWM
Call Motortest()
wait 40
Portc.6 = 0 Richtung
Portc.7 = 0 Richtung
Portc.4 = 0 Ein/Aus
Portb.0 = 0 Richtung
Portb.1 = 0 Richtung
Portd.5 = 0 Ein/Aus
Sub Motortest()
Portc.6 = 1 Richtung
Portc.7 = 0 Richtung
Portd.4 = 1 Ein/Aus
Portb.0 = 1 Richtung
Portb.1 = 0 Richtung
Portd.5 = 1 Ein/Aus
End Sub
Dieses funktioniert, aber die kanäle sind doch gleich, beim oberen liegt keine spannung an der motoren an
$regfile = "m32def.dat"
Dim I As Word
$crystal = 8000000 'Quarzfrequenz
Dim Geschwindigkeitlinks As Word
Dim Geschwindigkeitrechts As Word
'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
Geschwindigkeitlinks = 50
Geschwindigkeitrechts = 2900
Pwm1a = Geschwindigkeitrechts
Pwm1b = Geschwindigkeitlinks
Tccr1b = Tccr1b Or &H02 'Prescaler = 8
'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
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
-
Foren-Regeln
Lesezeichen