PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : motor an l293D PWM problem



maximum2006
17.04.2006, 20:01
also der motor läuft wunder bar auch die einfache pwm funtzt

nur wie bekomm ich die schleife richtig hin das der motor langsam schneller wird zb?


$regfile = "m32def.dat"
$crystal = 16000000 'Quarzfrequenz
$baud = 9600

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

'motor pwm control

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
Dim I As Integer
Do

'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
For I = 1 To 1023
Pwm1b = I
Next I

Loop



End 'end program

gruß max