MSP430编程时常犯的错误

错误1

  • Error[Pe127]: expected a statement E:\MSP430\Module\TFT\SD.c 95 
  • Error[Pe018]: expected a ")" E:\MSP430\Module\TFT\SD.c 132

解决:仔细检查下程序,看有没有一些语法上的错误,多加的" ; "就会使程序出现上述错误;或者一些常用语句表达错误。

Example1:宏定义的时候多加了“;”

#define SPI_DO_H  P1OUT |= BIT0;  //P1.0
#define SPI_DO_L  P1OUT &= ~BIT0;

 Example2:if()...else...语句不完整,缺少if()。

//if(Key2Value == IncreaseKey)
//{
//  UnionVar.Options.MinuteData ++; /* 时间值自加 */
//  Key2Value = 0; /* 清零Key2Value */
//}
else
{
  return;
}

 Example3: if()...else if...else 语句不完整,缺少if()。

    else if(MyFlag == 1)
    {
        .......        
    }
    else if(MyFlag == 2)
    {
        ......
    }
    else
       return;

错误2

  • Error[Pe130]: expected a "{"

出现问题的原因:

  1. 函数声明时缺少分号“;”

错误3

  • Error[Pe065]: expected a ";"  

出现问题的原因:

  1. 函数缺少一个括号“}”
  2. if语句少一个括号“}”

posted @ 2013-04-25 09:24  此岸幸福  阅读(2068)  评论(0)    收藏  举报