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.

F5529定时器与F149的对应关系

Other Parts Discussed in Thread: MSP430F5529

刚刚学习msp430F5529但是看的教程什么的都是F149的,现在弄一个模块。一编译一堆错误~~~晕死。应该是f149寄存器的名字和f5529的不一样,有没有资料解释一下他们的关系。

void main( void )
{
    unsigned char i ;
    WDTCTL= WDTPW + WDTHOLD; //关闭看门狗 
    BCSCTL1 &= ~XT2OFF;  //基础时钟控制寄存器BCSCTL1的第7位置0,使XT2启动 
     do 
  { 
    IFG1 &= ~OFIFG;         
    for(i= 0xff; i>0; i--); 
  }  
 
  while ((IFG1 & OFIFG)!=0);  
   
  BCSCTL2 |= SELS;


  TACTL=TACLR+ID0+ID1+TASSEL1;                      //SMCLK为时钟源,清TAR
  CCR0 =0xffff;
  CCTL0 = CCIE;
  init();
  P2SEL = 0X00;    
  P2DIR = 0XFE;
  P2OUT = 0X00;
  P2IE=0X01;
  P2IES=0X00;
  P2IFG=0;
  _EINT();
  DispNChar(1,0,12,tab1);
  while(1)
   {
     if(flag==0)
      {P2OUT |= SEG2;
       delay_ms(12);
       P2OUT &= ~SEG2;
       delay_ms(12);
      }
     Disp1Char(1,1,tab[temp/1000]);
     Disp1Char(2,1,'.');
     Disp1Char(3,1,tab[temp/100%10]);
     Disp1Char(4,1,tab[temp/10%10]);
     Disp1Char(5,1,tab[temp%10]);
     Disp1Char(6,1,'M');
  }
  
}

  #pragma vector =PORT2_VECTOR           //p2中断服务
__interrupt void anjian(void)
{
  if(UG==1)
  {
   TACTL |=MC0;  //停止模式
   TAR=0;
   _DINT(); 
   P2OUT=0X00;
   P2IES=0X01; //P2.0 下降沿触发
   P2IE=0;    //不允许中断
   P2IFG=0;   //没有中断
   P2IE=1;   //允许中断
    UG=0;   
   _EINT(); 
   flag=1;
  }
  else
  {
   TACTL &= ~MC0; 
   temp=TAR;   //读取数据
   temp=temp*0.172;
   UG=1;
   P2IES=0X00;
   P2IE=0;
   P2IFG=0;
   P2IE=1;
   flag=0;
  }
}

 
x 出现错误。请重试或与管理员联系。