P1.7是中断源 控制P1.4灯 下面的程序对吗 上升沿触发 要下拉电阻吗
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= 0x10;
P1IE |= 0x80;
P1IES |= 0x00;
P1REN |= 0x80;
P1OUT = 0x10;
P1IFG &= ~0x80;
_BIS_SR(LPM4_bits + GIE);
}
// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1OUT ^= 0x10;
P1IFG &= ~0x80;
} |