<rp id="3szxh"></rp>
    <em id="3szxh"></em><rp id="3szxh"></rp>
  1. <progress id="3szxh"></progress><progress id="3szxh"><track id="3szxh"></track></progress>
  2. 專注電子技術學習與研究
    當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

    msp430G2553時鐘選擇與分頻程序

    作者:佚名   來源:本站原創   點擊數:  更新時間:2014年08月31日   【字體:

    msp430G2553單片機的時鐘選擇和分頻程序如下:

    #include "msp430G2553.h"

    #define unchar unsigned char
    #define uint unsigned int
    uint Fre;
     
    int main( void )
    {
      // Stop watchdog timer to prevent time out reset
      WDTCTL = WDTPW + WDTHOLD;
      BCSCTL2 |=SELM_1+DIVM_0;
      P1DIR &=~BIT3;
      P1REN |=BIT3;
      P1OUT |=BIT3;
      P1DIR |=BIT0;
      P1IE  |=BIT3;
      P1IES &=~BIT3;
      _EINT();
      while(1)
      {
        P1OUT ^=BIT0;
        __delay_cycles(1000000);
      }
    }
    #pragma vector=PORT1_VECTOR
    __interrupt void PORTP13(void)
    {
      uint temp,pushkey=0;
      pushkey=BIT3 & (~P1DIR);
      __delay_cycles(100000);
     temp=P1IN; 
      if((~temp) & BIT3==pushkey)
      {
         Fre++;
         if(Fre>3) Fre=0;
         switch(Fre)
           {
      case 0: DCOCTL=CALDCO_1MHZ;BCSCTL1 = CALBC1_1MHZ;break;
      case 1: DCOCTL=CALDCO_8MHZ;BCSCTL1 = CALBC1_8MHZ;break;
      case 2: DCOCTL=CALDCO_12MHZ;BCSCTL1 = CALBC1_12MHZ;break;
      case 3: DCOCTL=CALDCO_16MHZ;BCSCTL1 = CALBC1_16MHZ;break;
          default:break;
           }
      }
     P1IFG &=~BIT3;
    }
    關閉窗口
    1区1区3区4区产品乱码不卡|印度人交乣女bbw|男人的天堂在线观看

      <rp id="3szxh"></rp>
      <em id="3szxh"></em><rp id="3szxh"></rp>
    1. <progress id="3szxh"></progress><progress id="3szxh"><track id="3szxh"></track></progress>