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.

CCS5.2 定义全局变量后,在函数内不可用



我在函数外部定义了一个全局变量,类型是结构体,但是在函数内部对其赋值时,编译会报错。麻烦帮忙看一下:

MCBSP_Config mcbsp_cfg;

void MCBSP_Set_Config(){    

                         mcbsp_cfg = {    

                         MCBSP_SPCR1_DEFAULT,    

                         MCBSP_SPCR2_DEFAULT,    

                         MCBSP_RCR1_DEFAULT,

                         ......}

}

mcbsp_cfg 这个结构体类型的变量已经在函数外部定义了,可是在函数内部却无法赋值,我之前也遇到过类似的问题,只能重写程序算法,但这不是长久之计啊。