Arduino/Arduino2AVR: Unterschied zwischen den Versionen
Die Seite wurde neu angelegt: = Arduino -> AVR HOWTO = This is an (incomplete) guide to how to map from Arduino source code to avr-gcc source code. It's been written to map this this direction, but... |
Keine Bearbeitungszusammenfassung |
||
(5 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt) | |||
Zeile 47: | Zeile 47: | ||
} | } | ||
== Port code away from Arduino == | == Step 3: Port code away from Arduino == | ||
{||style="width:100%" border="1" | {||style="width:100%" border="1" | ||
Zeile 63: | Zeile 63: | ||
| pinMode(pin, INPUT) || DDRx &= ~_BV(bit); || | // For I/O pins, convert pin to port+bit | | pinMode(pin, INPUT) || DDRx &= ~_BV(bit); || | // For I/O pins, convert pin to port+bit | ||
|- | |- | ||
| pinMode(pin, OUTPUT) || DDRx | | pinMode(pin, OUTPUT) || DDRx |= _BV(bit); | ||
|- | |- | ||
| digitalWrite(pin, LOW) || PORTx &= ~_BV(bit); | | digitalWrite(pin, LOW) || PORTx &= ~_BV(bit); | ||
|- | |- | ||
| digitalWrite(pin, HIGH) || PORTx | | digitalWrite(pin, HIGH) || PORTx |= _BV(bit); | ||
|- | |- | ||
| digitalRead(pin) || (PINx & _BV(bit)) >> bit; | | digitalRead(pin) || (PINx & _BV(bit)) >> bit; | ||
Zeile 134: | Zeile 134: | ||
| 5 || PORTC,5 | | 5 || PORTC,5 | ||
|} | |} | ||
[[Kategorie:Projekte]] | |||
[[Kategorie:Arduino]] |