MSP430 LauchPad 按键中断调试问题,求解答
[复制链接]
下面是我在IAR IDE中编写的代码,仿真调试的时候发现,全速运行,按下按键相应的LED不会亮,如果在中断处设置一个断点,再全速运行,按下按键可以进中断.搞了一上午,高手给你解答.
#include<msp430g2231.h>
#pragma vector=PORT1_VECTOR __interrupt void INT_P1(void){ if(P1IN&(1<<3)){ //断点设置在此处 P1OUT |= (1<<0); } P1IFG = 0; }
void main(void){
WDTCTL = WDTPW + WDTHOLD; //stop watchdog timer P1DIR |= (1<<0); //set p1.0 is output low level. P1OUT &= ~(1<<0); P1IFG = 0; P1DIR &= ~(1<<3); P1IE |= (1<<3); P1IES |= (1<<3); _BIS_SR(GIE); while(1); }
|