在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 23385|回复: 1

[原创] CCS报错 error: expected an expression如何解决?

[复制链接]
发表于 2011-2-20 15:13:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 cjsb37 于 2013-4-29 09:00 编辑

我按照参考书上的示例程序编写自己的初始化程序:void init_board(void)
{

*(volatile unsigned int *)CLKMD=0x0000;

while(*(volatile unsigned int *)CLKMD & 0x0001){};

*(volatile unsigned int *)CLKMD=CLKMD_VAL;

*(volatile unsigned int *)PMST=PMST_VAL;

*(volatile unsigned int *)SWWSR=SWWSR_VAL;

*(volatile unsigned int *)SWCR=SWCR_VAL;

*(volatile unsigned int *)BSCR=BSCR_VAL;

*(volatile unsigned int *)ST1=ST1_VAL;
//设置CPU寄存器

*(volatile unsigned int *)SPSA0=SPCR10;
//以下初始化MCBSP0

*(volatile unsigned int *)SPSD0=SPCR10_VAL;

*(volatile unsigned int *)SPSA0=SPCR20;

*(volatile unsigned int *)SPSD0=SPCR20_VAL;

*(volatile unsigned int *)SPSA0=RCR10;

*(volatile unsigned int *)SPSD0=RCR10_VAL;

*(volatile unsigned int *)SPSA0=RCR20;

*(volatile unsigned int *)SPSD0=RCR20_VAL;

*(volatile unsigned int *)SPSA0=XCR10;

*(volatile unsigned int *)SPSD0=XCR10_VAL;

*(volatile unsigned int *)SPSA0=XCR20;

*(volatile unsigned int *)SPSD0=XCR20_VAL;

*(volatile unsigned int *)SPSA0=SRGR10;

*(volatile unsigned int *)SPSD0=SRGR10_VAL;

*(volatile unsigned int *)SPSA0=SRGR20;

*(volatile unsigned int *)SPSD0=SRGR20_VAL;

*(volatile unsigned int *)SPSA0=PCR0;

*(volatile unsigned int *)SPSD0=PCR0_VAL;

}

结果每一行都报错:
"initialize.h", line 5: error: expected an expression
"initialize.h", line 6: error: expected a ")"
"initialize.h", line 7: error: expected an expression
"initialize.h", line 8: error: expected an expression
"initialize.h", line 9: error: expected an expression
"initialize.h", line 10: error: expected an expression
"initialize.h", line 11: error: expected an expression
"initialize.h", line 12: error: expected an expression
"initialize.h", line 13: error: expected an expression
"initialize.h", line 14: error: expected an expression
"initialize.h", line 15: error: expected an expression
"initialize.h", line 16: error: expected an expression
"initialize.h", line 17: error: expected an expression
"initialize.h", line 18: error: expected an expression
"initialize.h", line 19: error: expected an expression
"initialize.h", line 20: error: expected an expression
"initialize.h", line 21: error: expected an expression
"initialize.h", line 22: error: expected an expression
"initialize.h", line 23: error: expected an expression
"initialize.h", line 24: error: expected an expression
"initialize.h", line 25: error: expected an expression
"initialize.h", line 26: error: expected an expression
"initialize.h", line 27: error: expected an expression
"initialize.h", line 28: error: expected an expression
"initialize.h", line 29: error: expected an expression
"initialize.h", line 30: error: expected an expression
26 errors detected in the compilation of "control.c".

寄存器名是在另一个头文件中定义的,如:
#define ST1 0x0007;//Status register 0
#define ST0 0x0006;//Status register 1
#define PMST 0x001d;//Processor mode status (PMST) register
#define SWWSR 0x0028;//Software Wait-State Register
#define SWCR 0x002b;//Software Wait-State Control Register
#define BSCR 0x0029;//Bank-Switching Control Register
#define CLKMD 0x0058;//Clock Mode Register (CLKMD)

请高手解答 我用的是CCS 2.21





 楼主| 发表于 2011-2-21 10:31:54 | 显示全部楼层
回复 1# congfeiyu

自己回答:原来是由于我在宏定义后面加了分号,去掉后就正常了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-21 14:15 , Processed in 0.018249 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表