Hier ein kleines BASCOM-Programm zum Ansteuern der Motoren, nur zum Test, !ohne PWM!
Code:
'**********************************************************
'ASURO - Einfache Motoransteuerung
'**********************************************************
'Ansteuerung der Motoren
'----------------------------------------------------------
' +-------+--------+--------+-------+
' | ML-V | ML-R | MR-V | MR-R |
' +-------+--------+--------+-------+
' PORT D.4 | 0 | 1 | X | X |
' +-------+--------+--------+-------+
' PORT D.5 | 1 | 0 | X | X |
' +-------+--------+--------+-------+
' PORT D.1 | 1 | 1 | X | X | <- ML Enable
' +-------+--------+--------+-------+
' PORT B.4 | X | X | 0 | 1 |
' +-------+--------+--------+-------+
' PORT B.5 | X | X | 1 | 0 |
' +-------+--------+--------+-------+
' PORT B.2 | X | X | 1 | 1 | <- MR Enable
' +-------+--------+--------+-------+
$crystal = 8000000
'Motor Rechts
Config Pinb.1 = Output
Config Pind.4 = Output
Config Pind.5 = Output
'Motor Links
Config Pinb.2 = Output
Config Pinb.4 = Output
Config Pinb.5 = Output
Do
'mal sehn was geht ;-)
'*******************************
'!!! Keine PWM-Ansteuerung !!!
'Links volle Pulle vorwärts
Portd.4 = 0
Portd.5 = 1
Portb.1 = 1
Wait 2
Portb.1 = 0
Wait 1
'Links volle Pulle rückwärts
Portd.4 = 1
Portd.5 = 0
Portb.1 = 1
Wait 2
Portb.1 = 0
Wait 1
'Rechts volle Pulle vorwärts
Portb.4 = 0
Portb.5 = 1
Portb.2 = 1
Wait 2
Portb.2 = 0
Wait 1
'Rechts volle Pulle rückwärts
Portb.4 = 1
Portb.5 = 0
Portb.2 = 1
Wait 2
Portb.2 = 0
Wait 1
Loop
Gruß, Sonic
Lesezeichen