简体   繁体   English

错误:预期为标识符,在C中使用MSP430的CCS

[英]Error: Expected an identifier, in C with CCS for MSP430

I'm currently taking over a project for MSP430 that was previously compiled with MSPGCC, and I was asked to update it so it works with TI's C compiler using CCSv6. 我目前正在接管一个以前用MSPGCC编译过的MSP430项目,并被要求对其进行更新,使其可与TI的使用CCSv6的C编译器一起使用。 However, I'm getting a set of errors that I don't really understand. 但是,我遇到了一系列我不太了解的错误。 Here's a sample of my code where there are some errors: 这是我的代码示例,其中存在一些错误:

struct UART_UCxxCTL_BITS
{
    UINT8_T UCSWRST : 1;    /**< R/W Software reset enable                  */
    UINT8_T UCTXBRK : 1;    /**< R/W Transmit break                         */
    UINT8_T UCTXADDR: 1;    /**< R/W Transmit address                       */
    UINT8_T UCDORM  : 1;    /**< R/W Dormant                                */
    UINT8_T UCBRKIE : 1;    /**< R/W Receive break character interrupt      */
    UINT8_T UCRXEIE : 1;    /**< R/W Receive eroneous-character interrupt   */
    UINT8_T UCSSEL  : 2;    /**< R/W USCI clock source select               */
    UINT8_T UCSYNC  : 1;    /**< R/W Synchronous mode select    */
    UINT8_T UCMODE  : 2;    /**< R/W Mode select                */
    UINT8_T UCSPB   : 1;    /**< R/W Stop bit select            */
    UINT8_T UC7BIT  : 1;    /**< R/W Character length           */
    UINT8_T UCMSB   : 1;    /**< R/W MSB first select           */
    UINT8_T UCPAR   : 1;    /**< R/W Parity select              */
    UINT8_T UCPEN   : 1;    /**< R/W Parity enable              */
};

For all these lines inside the struct, except for UCMODE and UCSSEL , I'm getting the error: "#41 expected an identifier" In total, I have 38 errors #41 in my project, all of them on structs, but not every struct and not every declarations inside them. 对于struct内部的所有这些行,除了UCMODEUCSSEL ,我都收到错误:“#41期望一个标识符”总共,我的项目中有38个错误#41,所有这些都在结构上,但不是每个struct,而不是其中的每个声明。 They appear in two header files, one for the UART and one for the SPI. 它们出现在两个头文件中,一个用于UART,一个用于SPI。 These two files are not linked though. 这两个文件没有链接。 In both files structs are declared, some of them quite similar. 在两个文件中都声明了结构,其中一些非常相似。

For instance, in both files, UCMODE and UCSSEL aren't considered as errors, but the rest is. 例如,在这两个文件中, UCMODEUCSSEL都不被视为错误,而其余部分则被视为错误。 That's what I find strange. 那就是我觉得奇怪的地方。

Please note that UINT8_T is an unsigned char . 请注意, UINT8_Tunsigned char

Do you know what could bring these errors ? 您知道什么可能带来这些错误吗?

Thanks a lot. 非常感谢。

失败的关键字已在CCS环境中的处理器标头文件msp430f6725.h中定义。

#define UCRXEIE                (0x0020)       /* RX Error interrupt enable */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM