完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
本帖最后由 踏云之步 于 2015-1-22 15:45 编辑
Build target 'Target 1' compiling AD7705_eg1.c... ..GRADUAtiONPROJECTAD7705_EG1.C(54): error C141: syntax error near '=' ..GRADUATIONPROJECTAD7705_EG1.C(55): error C141: syntax error near 'unsigned' ..GRADUATIONPROJECTAD7705_EG1.C(55): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(58): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(60): error C141: syntax error near '<<=' ..GRADUATIONPROJECTAD7705_EG1.C(65): error C141: syntax error near '++' ..GRADUATIONPROJECTAD7705_EG1.C(72): error C141: syntax error near 'data', expected ';' ..GRADUATIONPROJECTAD7705_EG1.C(82): error C141: syntax error near '=' ..GRADUATIONPROJECTAD7705_EG1.C(83): error C141: syntax error near 'unsigned' ..GRADUATIONPROJECTAD7705_EG1.C(83): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(86): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(88): error C141: syntax error near '<<=' ..GRADUATIONPROJECTAD7705_EG1.C(91): error C202: 'AD_DOUT': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(93): error C141: syntax error near '++' ..GRADUATIONPROJECTAD7705_EG1.C(100): error C141: syntax error near 'data', expected ';' ..GRADUATIONPROJECTAD7705_EG1.C(110): error C141: syntax error near '=' ..GRADUATIONPROJECTAD7705_EG1.C(111): error C141: syntax error near 'unsigned' ..GRADUATIONPROJECTAD7705_EG1.C(111): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(114): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(116): error C141: syntax error near '<<=' ..GRADUATIONPROJECTAD7705_EG1.C(119): error C202: 'AD_DOUT': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(121): error C141: syntax error near '++' ..GRADUATIONPROJECTAD7705_EG1.C(128): error C141: syntax error near 'data', expected ';' ..GRADUATIONPROJECTAD7705_EG1.C(136): error C141: syntax error near ')' ..GRADUATIONPROJECTAD7705_EG1.C(138): error C141: syntax error near 'unsigned' ..GRADUATIONPROJECTAD7705_EG1.C(138): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(138): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(138): error C202: 'i': undefined identifier ..GRADUATIONPROJECTAD7705_EG1.C(138): error C141: syntax error near ')' ..GRADUATIONPROJECTAD7705_EG1.C(141): error C141: syntax error near 'data' ..GRADUATIONPROJECTAD7705_EG1.C(148): error C141: syntax error near 'data' ..GRADUATIONPROJECTAD7705_EG1.C(160): error C141: syntax error near ')' ..GRADUATIONPROJECTAD7705_EG1.C(166): error C141: syntax error near 'data' ..GRADUATIONPROJECTAD7705_EG1.C(173): error C141: syntax error near 'data' Target not created keil源程序如下: #include #include #include //#define DIN(x) { if((x)) P0^1=1;else P0^1=0;} //#define CLK(x) { if((x)) P0^2=1;else P0^2=0;} ***it DIN=P0^1; ***it CLK=P0^2; ***it DRDY=P0^3; ***it CS=P0^0; ***it DOUT=P0^4; //函数;delay() void delay3us(void) { _nop_(); } //函数;delay_ms void delay_ms(void) //误差 0us { unsigned char a,b,c; for(c=1;c>0;c--) for(b=142;b>0;b--) for(a=2;a>0;a--); } //函数:reset_AD7705 //功能:AD7705串行接口失步后将其复位。复位后要延时500us再访问 //参数:无 //返回:无 //变量:无 //备注:无 void reset_AD7705(void) { unsigned char i; DIN=1; for( i=0; i<36; i++ ) { CLK=0; delay3us(); CLK=1; delay3us(); } delay_ms(); } //函数:read_AD7705_byte //功能:从AD7705读一个字节的数据 //参数:无 //返回:读到的一字节数据 //变量:无 //备注:无 unsigned char read_AD7705_byte(void) { unsigned char data = 0; unsigned char i = 0; DRDY=0; CS=0; for( i=0; i<8; i++ ) { data <<= 1; CLK=0; delay3us(); if(DOUT) { data++; } CLK=1; delay3us(); } CS=1; DRDY=1; return data; } //函数:read_AD7705_word //功能:从AD7705读一个字的数据,共16bit //参数:无 //返回:读到的一字节数据 //变量:无 //备注:无 unsigned int read_AD7705_word(void) { unsigned int data = 0; unsigned char i = 0; DRDY=0; CS=0; for( i=0; i<16; i++ ) { data <<= 1; CLK=0; delay3us(); if(AD_DOUT) { data++; } CLK=1; delay3us(); } DRDY=1; CS=1; return data; } //函数:read_AD7705_dword //功能:从AD7705读一个24的数据 //参数:无 //返回:读到的一字节数据 //变量:无 //备注:AD7705是一个24位AD,选定刷新频率在16.7HZ下,有效位是19位,暂时读出全部24位数据 unsigned long int read_AD7705_dword(void) { unsigned long data = 0; unsigned char i = 0; DRDY=0; CS=0; for( i=0; i<24; i++ ) { data <<= 1; CLK=0; delay3us(); if(AD_DOUT) { data++; } CLK=1; delay3us(); } DRDY=0; CS=0; return data; } //函数:write_AD7705_byte //功能:往AD7705写8位数据 //参数:IN - uint8_t data,要写入AD7705的数据 //返回:无 //变量:无 //备注:无 void write_AD7705_byte(unsigned char data) { for(unsigned char i=0; i<8; i++) { CLK=0; if(data&0x80) DIN=1; else DIN=0; delay3us(); CLK=1; delay3us(); data <<= 1; } DIN=1; } //函数:write_AD7705_dword //功能:往AD7705写24位数据,因为AD7705是24位的器件 //参数:IN - int32_t data,要写入AD7705的数据 //返回:无 //变量:无 //备注:无 //------------------------------------------------------------------------------------------ void write_AD7705_dword(unsigned long int data) { unsigned char i; for( i = 0; i<24; i++) { CLK=0; if(data&0x800000) DIN=1; else DIN=0; delay3us(); CLK=1; delay3us(); data <<= 1; } DIN=1; } //Function : AD7705Init() void AD7705Init(void) { reset_AD7705(); //写时钟寄存器; Write(0x20); Write(0x07); //写设置寄存器; Write(0x10); Write(0x46); } //返回一次采样值 unsigned int ReturndataAD7705(void) { while(DRDY==1); Write(0x38); return Read(); } //平均温度值 unsigned int AverageTempAD7705(void) { unsigned long AverageTemp=0; unsigned int i=0; for(;i<1000;i++) { AverageTemp+=(unsigned long)ReturndataAD7795(); } return (unsigned long)(AverageTemp/1000); } |
|
相关推荐
1个回答
|
|
"data" 是保留字,不可当变数。
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
417 浏览 0 评论
430 浏览 1 评论
基于瑞萨FPB-RA4E2智能床头灯项目——1编译环境搭建与点亮驱动ws2812全彩LED
393 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-LCD显示图片编程示例之介绍mmap
974 浏览 0 评论
《DNESP32S3使用指南-IDF版_V1.6》第二章 常用的C语言知识点
1055 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11779 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 00:12 , Processed in 0.429640 second(s), Total 42, Slave 35 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号