This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F4250中断问题!!!!求大虾指教!非常感谢!!!

Other Parts Discussed in Thread: MSP430F4250

MSP430F4250中断问题

采用的是MSP430F4250 P1.4,P1.3,P1.2为中断按键; Init_LCD()为LCD初始化函数; 当在主函数中启用Init_LCD()后,P1.4管脚不停的中断执行中断函数中的if(P1IFG == BIT4)P6OUT ^= BIT7;; 当在主函数中屏蔽Init_LCD()后,工作正常; 于是怀疑是对Init_LCD()内的语句逐条屏蔽,发现当屏蔽LCDAVCTL1 = VLCD_3_32; 此条语句时,按键工作正常!但是LCD无法正常工作! 再次改善程序,屏蔽P1.4中断,开启P1.3和P1.2中断,开启Init_LCD()函数,发现中断按键无法正常工作!(怀疑可能是中断仍然在触发!)


#include   #pragma vector = PORT1_VECTOR __interrupt void Port_1(void) { volatile unsigned int i; for (i = 0; i < 30000; i++); // Delay for 32 kHz crystal to if(P1IFG == BIT4)P6OUT ^= BIT7; if(P1IFG == BIT3)P6OUT ^= BIT7; if(P1IFG == BIT2)P6OUT ^= BIT7; P1IFG = 0X00; } //------------------------------------------------------------------------------ // LCD初始化函数 //------------------------------------------------------------------------------ void Init_LCD() { P5SEL = 0xFF; // Set COM pins for LCD P2SEL = 0xFF; LCDACTL = LCDON + LCD4MUX + LCDFREQ_64; // 4mux LCD, ACLK/64 LCDAPCTL0 = 0x0F; // Segs S0-S15 = outputs LCDAVCTL0 = LCDCPEN; // Enable LCDA charge pump LCDAVCTL1 = VLCD_3_32; } void main(void) { volatile unsigned int i; // volatile在编程源代码时,对这个变量不要使用优化 WDTCTL = WDTPW + WDTHOLD; // 停止看门狗 FLL_CTL0 |= XCAP14PF; for (i = 0; i < 10000; i++); // Delay for 32 kHz crystal to P6DIR |= BIT7; //P6.7为输出; P6OUT &= ~BIT7; //P6.7输出0; P1IE |=0X1C; //P1.4、P1.3、P1.2中断开启; P1IES &= ~0X1C; //下降沿触发中断; P1IFG &= ~0X1C; //清除中断标志位; _EINT(); Init_LCD(); //LCD初始化函数 for(;;); } 

求大虾指教!非常感谢!!!求大虾指教!非常感谢!!!