#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= 0x41; // Set P1.0 to output direction
P1DIR &= ~0x08;
P1REN |=0x08; // needed to use key to enable pullup resistor
P1SEL |=0x08; // general statement but needed to select particular pins
P1OUT |= 0x00; //turning all pins in off
while(1)
{
if(!(P1IN &0x08))
{
P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
__delay_cycles(250000);
}
else
{
P1OUT ^= 0x40; // Toggle P1.0 using exclusive-OR
__delay_cycles(250000);
}
}
}