Hi guys,
I am trying to do some simple stuff using only the launchpad.
I double checked and we got in the lab at my college the msp430 g2553. I looked up online and tried the code below, but it does not work on the microcontroller. It does some erractic behavior that I cant describe. I know there is a way using interrupt, but I am trying the simplest way.
Best regards,
#include <msp430g2553.h>
#define SAIDA 0x40
#define ACENDE_LED 0x40
#define APAGA_LED ~0x40
#define LE_BOTAO 0x08
void main( void )
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR = SAIDA;
P1OUT = 0x00;
while(1)
{
if(P1IN&LE_BOTAO)
{
P1OUT &= APAGA_LED;
}
else
{
P1OUT |= ACENDE_LED;
}
}
}