#include<msp430x16x.h>
int main(void)
{
WDTCTL=WDTPW+WDTHOLD;//CLOSE WATCHDOG
P2DIR|=0XFF;P2OUT=0XFF;
P1OUT=0X00;
P1IES|=0X00; //rising edge strike
P1IFG=0X00;// because set up P1IES would make p1ifg change also
P1IE|=0XFF;//p1 module interrupt allow
_EINT();// system interrupt allow
int i;
while(1)
{
for(i=1;i<3200;i++)
P2OUT^=0X02;
}
}
#pragma vector=PORT1_VECTOR//p1 interrupt serve pragram
__interrupt void P1_INTERRUPT(void)
{
if(P1IFG==0X80)
{
P1IFG=0X00;//CLEAR INTERRUPT FLAG
P2OUT^=0X08;
}
else P1IFG=0X00;
}
此帖出自
小平头技术问答
懂了,谢谢~~~
一周热门 更多>