这是个别人给的官方程序,应该是实现按键led灯翻转的,但是下载到板子上后按键无反应
- #include
- void main(void)
- {
- WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
- P1DIR |= BIT0; // Set P1.0 to output direction
- P1IES |= BIT3; // P1.3 Hi/lo edge
- P1IFG &= ~BIT3; // P1.3 IFG cleared
- P1IE |= BIT3; // P1.3 interrupt enabled
- _BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt
- }
- // Port 1 interrupt service routine
- #pragma vector=PORT1_VECTOR
- __interrupt void Port_1(void)
- {
- if (P1IFG & BIT3)
- {
- P1OUT ^= BIT0; // P1.0 = toggle
- P1IFG &= ~BIT3; // P1.3 IFG cleared
- }
- }
复制代码弱菜一枚求指教
此帖出自
小平头技术问答
一周热门 更多>