BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / cpp / #44554同步于 2010/10/9
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖

从KEIL c51 到avr遇到的问题

WSSYJ
2010/10/9镜像同步1 回复
一个温度传感器的程序,在KEIL c51里的代码为: #include<reg51.h> //包含单片机寄存器的头文件 #include<intrins.h> //包含_nop_()函数定义的头文件 unsigned char code digit[10]={"0123456789"}; //定义字符数组显示数字 unsigned char code Error[]={"Error!Check!"}; //说明没有检测到DS18B20 unsigned char code Temp[]={"Temp:"}; 在AVR里用mega16时头文件改为#include<iom16v.h>,avr里不存在intrins.h,把第二个头文件删除后出现一堆语法错误 #include<iom16v.h> unsigned char code digit[10]={"0123456789"}; //定义字符数组显示数字 unsigned char code Error[]={"Error!Check!"}; //说明没有检测到DS18B20 unsigned char code Temp[]={"Temp:"}; //说明显示的是温度 !E C:\iccv7avr\examples.avr\18B20\18B20.c(3): syntax error; found `digit' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(3): invalid initialization type; found `pointer to char' expected `int' !E C:\iccv7avr\examples.avr\18B20\18B20.c(4): syntax error; found `Error' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(4): invalid initialization type; found `pointer to char' expected `int' !E C:\iccv7avr\examples.avr\18B20\18B20.c(5): syntax error; found `Temp' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(5): invalid initialization type; found `pointer to char' expected `int' !E C:\iccv7avr\examples.avr\18B20\18B20.c(9): syntax error; found `RS' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(9): undeclared identifier `P0' !E C:\iccv7avr\examples.avr\18B20\18B20.c(9): initializer must be constant !E C:\iccv7avr\examples.avr\18B20\18B20.c(10): syntax error; found `RW' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(10): initializer must be constant !E C:\iccv7avr\examples.avr\18B20\18B20.c(11): syntax error; found `E' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(11): initializer must be constant !E C:\iccv7avr\examples.avr\18B20\18B20.c(18): syntax error; found `BusyTest' expecting `;' !W C:\iccv7avr\examples.avr\18B20\18B20.c(20):[warning] expression with no effect elided !E C:\iccv7avr\examples.avr\18B20\18B20.c(20): syntax error; found `result' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(20): undeclared identifier `result' !W C:\iccv7avr\examples.avr\18B20\18B20.c(20):[warning] expression with no effect elided !E C:\iccv7avr\examples.avr\18B20\18B20.c(45): undeclared identifier `P2' !E C:\iccv7avr\examples.avr\18B20\18B20.c(76): undeclared identifier `P2' !W C:\iccv7avr\examples.avr\18B20\18B20.c(93):[warning] calling a function without prototype may cause runtime errors if the function does not return int or unsigned int !E C:\iccv7avr\examples.avr\18B20\18B20.c(109): syntax error; found `DQ' expecting `;' !E C:\iccv7avr\examples.avr\18B20\18B20.c(109): undeclared identifier `P3' !E C:\iccv7avr\examples.avr\18B20\18B20.c(109): too many errors C:\iccv7avr\bin\imakew.exe: Error code 1 Done: there are error(s). Exit code: 1. Sat Oct 09 10:12:00 2010 这是什么原因呢,急切求教
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复
kissme机器人#1 · 2010/10/9
好像是:不知code为何物。你把code去掉试试。