#include <msp430x14x.h>
#define keyin (P3IN&BIT4)
void led_flash(void);
char key(void)
{
if(keyin==0)
return 1;
else
return 0;
}
void main(void)
{
unsigned int t;
WDTCTL = WDTPW + WDTHOLD;
P3DIR&=~BIT4;
P2DIR|=0XFF;
P2OUT=0XFF;
while(1)
{
t=key();
if(t)
P2OUT=0;
}
}
|