Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Bug with PxOUT + INPUT_PULLUP?

$
0
0

I was trying a code that toggles a LED when i press a button. So i used P1OUT^=00000001; just toggle the output state of P1_0 right?

Well when i use that the push button stops working. I don't know why but it seems the pin just stays LOW always.

Is this command overriding the PinMode command?

 

I'm not sure but after P1REN is used you can control the pins with the pull ups/down enabled with P1OUT wich choses if it is pullup or down.

But with P1OUT^=00000001; should not change the bit 3

 

 

Used this code to test the state of the pin:

    boolean estado=digitalRead(P1_3);
    Serial.println(estado);
    if (digitalRead(P1_3)==LOW){
     //  P1OUT ^= 00000011;  
       delay(1);
     while(digitalRead(P1_3)==LOW){
       estado=digitalRead(P1_3);
       Serial.println(estado);
     }
    }
  }

First i enabled the P1OUT line. The serial said that the pin was always 0. The voltmeter confirms that

Then i disabled it. The pin is only 0 while it's pressed. The voltmeter also confirms that.

 

Is this normal?


Viewing all articles
Browse latest Browse all 2077

Trending Articles