|
- #include <msp430x42x0.h>
- #pragma vector = PORT1_VECTOR
- __interrupt void Port_1(void)
- {
- volatile unsigned int i; // volatile在编程源代码时,对这个变量不要使用优化
- 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_44; // to 3.44V
- }
- 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(;;);
- }
复制代码 请教大虾,这个程序,当我在主函数中开启Init_LCD(); 函数后,P1.4口不断的触发中断!
屏蔽Init_LCD(); 后
一切正常,采用的是MSP430F4250,求指教,非常感谢!
|
|