Tool/software: Code Composer Studio
Hello, I have a question. I am using the MSP430G2452 with the Launchpad Development board and am trying to practice using the I/O pins. Here is code that is supposed to turn an LED on a breadboard off when the button is pressed:
#include <msp430g2452.h>
// P1.4 is the led
// P1.5 is the button
#define LIGHT BIT4
#define BUTTON BIT5
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P1DIR |= LIGHT;
P1REN |= BUTTON;
P1OUT |= BUTTON;
while(1){
if((P1IN & BUTTON) == 0X00)
P1OUT |= LIGHT;
else
P1OUT &= ~LIGHT;
}
}
What happens, however, is that the whole board will turn off when I press the button, not just the LED. So when I press the button on my breadboard, the device acts as if I just disconnected the device from the computer. Does anybody know or can see why this is happening? Thank you for your time

