Hallo Raze
Code:
$regfile = "M8DEF.DAT"
$baud = 19200
$hwstack = 32
$swstack = 32
$framesize = 32
$crystal = 8000000 '7372800
Config Portc.0 = Output
Config Portc.1 = Output
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 1
Enable Interrupts
Do
Portc.0 = 1 'Pin 2 = 1A am L293D z.B rechts (je nach Anschluß)
Portc.1 = 0 'Pin 7 = 2A am L293D
Pwm1a = 80 'Pin1 = Enable am L293D
Wait 4
Portc.0 = 1 ' Halt
Portc.1 = 0
Pwm1a = 0
Wait 4
Portc.0 = 0 'z.B Links (je nach Anschluß)
Portc.1 = 1
Pwm1a = 80
Wait 4
Portc.0 = 1 ' Halt
Portc.1 = 0
Pwm1a = 0
Wait 4
Portc.0 = 0 'z.B Links (je nach Anschluß)
Portc.1 = 1
Pwm1a = 60 ' Umdrehungen aendern
Wait 4
Loop
So sollte es funktionieren
Solltest Du zwei Stromquellen haben eine fuer den Treiber und eine fuer Atmega8 unbedingt Gnd verbinden!
Gruß raggy
Lesezeichen