Hi,
ist am Taster S2 der Pullup-Widerstand aktiv (P1OUT.3=1), ist P1IN.3 im
ungedrückten Zustand high, gedrückt low -alles ok. Versuche ich aber den
Taster am Pulldown zu betreiben, liegt an P1IN.3 low an -ob S2 gedrückt
ist oder nicht...
Die Reihenfolge P1DIR->P1REN->P1OUT habe ich eingehalten. P1REN.3 bleibt
auch korrekterweise 1, wird nicht plötzlich 0 oder so.
1 | void main(void) {
|
2 | WDTCTL=WDTPW+WDTHOLD;
|
3 |
|
4 | P1DIR = BIT0+BIT6;
|
5 | P1REN = BIT3;
|
6 | P1OUT = 0;
|
7 |
|
8 | while(1);
|
9 | }
|
Family Guide:
1 | 8.2.4 Pullup/Pulldown Resistor Enable Registers PxREN
|
2 |
|
3 | Each bit in each PxREN register enables or disables the pullup/pulldown resistor of the corresponding I/O
|
4 | pin. The corresponding bit in the PxOUT register selects if the pin is pulled up or pulled down.
|
5 | Bit = 0: Pullup/pulldown resistor disabled
|
6 | Bit = 1: Pullup/pulldown resistor enabled
|
7 |
|
8 |
|
9 | 8.2.2 Output Registers PxOUT
|
10 |
|
11 | [...]
|
12 | If the pin's pullup/pulldown resistor is enabled, the corresponding bit in the PxOUT register selects pullup
|
13 | or pulldown.
|
14 | Bit = 0: The pin is pulled down
|
15 | Bit = 1: The pin is pulled up
|
Klar lässt sich das in jedem Fall auch softwaretechnisch lösen. Ich
würde aber gerne wissen was da los ist und was ich falsch mache. Könnt
ihr mir da helfen bitte?
Danke euch schonmal!