Der Kommentar 2 Zeilen darüber könnte hilfreich sein:
Code:/*****************************************************************************/ // I/O PORT pin definitions // These definitions simplify reading and understanding the source code. // // ATTENTION: Initial value of port and direction registers should not // be changed, if you do not exactly know what you are doing! // // Hints for DDRx and PORTx Registers: // DDRxy = 0 and PORTxy = 0 ==> Input without internal Pullup // DDRxy = 0 and PORTxy = 1 ==> Input with internal Pullup // DDRxy = 1 and PORTxy = 0 ==> Output low // DDRxy = 1 and PORTxy = 1 ==> Output high // "=1" indicates that the appropriate bit is set. // // Example: // #define INIT_DDRA 0b00010000 // #define INIT_PRTA 0b00000000 // // This means that ALL ports on PortA are inputs without internal pullups // except for PortA4, which is an output (E_INT1 signal in this case) and // initial value is low. // // Binary value explanation: // 0b00010000 = 16 in decimal system // ^ ^ // MSB LSB (MSB = Most Significant Bit, LSB = Least Significant Bit) // // The program should always call the macro "portInit();" FIRST! You can find // it a bit below. Correct port initialisation is the most important step // after a hardware reset!
Übrigens solltest Du in der Library nichts ändern.
Das kannst Du alles in Deinem eigenen Code machen.
DDRA |= ADC0; // Pin als Ausgang
PORTA |= ADC0; // Ausgang auf 1
PORTA &= ~ADC0; // Ausgang auf 0
DDRA &= ~ADC0; // Eingang
PORTA |= ADC0; // Pullup an
PORTA &= ~ADC0; // Pullup aus
Auswerten mit if(PINA & ADC0) ...
MfG,
SlyD
PS:
GPIO = General Purpose I/O - das steht sicher auch irgendwo in der Doku![]()
PPS:
Achtung: Nicht den GPIO als Ausgang konfigurieren und dann mit dem Taster gegen Masse kurzschließen!
(bei den normalen Bumpern ist für sowas ein Serienwiderstand von 470 Ohm mit drin - s. Schaltplan des RP6
bei den LEDs. Übrigens kann man Taster an die LED Pins schalten genau wie bei den Bumpern, dann bleiben die wertvolleren ADCs frei - auswerten geht dann wie im RP6 Library code getBumper - natürlich etwas angepasst... )





Zitieren
.

Lesezeichen