主要实现MSP430F1101A单片机的时钟设置及按键对应LED的显示
单片机源程序如下:
- #include <msp430x11x1.h>
- int main( void )
- {
- // Stop watchdog timer to prevent time out reset
- WDTCTL = WDTPW + WDTHOLD;
- P2DIR |= 0X01;
- P2OUT |= BIT0;
- P1DIR &= ~BIT0;
- P1IE |= 0X01;
- P1IES |= 0X01;
- P1IFG &= ~0X01;
- _BIS_SR(LPM4_bits+GIE);
- }
- # pragma vector=PORT1_VECTOR
- __interrupt void port_1(void)
- {
- unsigned int i;
- if (!(P1IN & BIT0))
- {
- for(i=0;i<8000;i++);
- if (!(P1IN & BIT0))
- {
- P2OUT &= ~BIT0;
- while(!(P1IN & BIT0));
- P2OUT |= BIT0;
- }
- }
- //P2OUT ^= 0X01;
- P1IFG &= ~0X01;
- }
复制代码
所有资料51hei提供下载:
MSP430F1101A_KEY_LED.zip
(68.25 KB, 下载次数: 8)
|