hi zusammen, hat jemand ein Beispiel Code in C für die Steuerung eines Motors? ich benutze Atmel Studio 7 Mikrocontroller at90can128 Betriebsspannung 5V Vielen Dank
Klar, hab ich:
1 | if ((!(PIND & (1 << PushButton_MotorSpeed_increase)))) { |
2 | if ((!(PIND & (1 << PushButton_MotorSpeed_decrease)))) { |
3 | // Taster fuer Increase und Decrease MotorSpeed sind gleichzeitig gedrueckt,
|
4 | // die Motorrichtung wird umgeschaltet/getoggelt
|
5 | PORTB ^= (1 << Motor_Direction); |
6 | }
|
7 | }
|
8 | // Taster Motor wird ausgewertet
|
9 | if (!(PINB &(1 << PushButton_Motor))) { |
10 | // Taster ist gedrueckt, MotorEnable wird eingeschaltet
|
11 | PORTB |= (1 << Motor_Enable); |
12 | } else { |
13 | //Taster ist nicht gedrueckt, MotorEnable wird ausgeschaltet
|
14 | PORTB &= ~(1 << Motor_Enable); |
15 | }
|
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.
