#include "msp430g2553.h"
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
P1DIR|=BIT0;
P1DIR&=~BIT3;
P1REN|=BIT3;//启动电阻
P1OUT|=BIT3;//上拉
P1IES|=BIT3;//下降沿触发;
P1IE|=BIT3;//中断允许;
_EINT(); //开总中断;
LPM3;
}
#pragma vector = PORT1_VECTOR
__interrupt void P1_ISR(void)
{
if(P1IFG&BIT3)
{
P1OUT|=BIT0;
P1IFG=0;
}
else P1OUT&=~BIT0;
}
本文来自论坛,点击查看完整帖子内容。