完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
错误都用红色注明了
#include #include"SHT.h" chengxu.c(2): warning C318: can't open file 'SHT.h' #include"lcd1602.h" chengxu.c(3): warning C318: can't open file 'lcd1602.h' unsigned char table[]="luyao"; unsigned char shtdatah,shtdatal; unsigned long shtdata; void jisuan_humidity(void) { unsigned long aa,bb; shtdatah&=0x0f; aa=(unsigned long)(shtdatah*256+shtdatal); bb=aa; aa=405*aa; aa/=100; bb=bb*bb; bb=28*bb; bb/=100000; shtdata=aa-400-bb; } void jisuan_temp(void) { unsigned long aa; shtdatah&=0x3f; aa=(unsigned long)(shtdatah*256+shtdatal); shtdata=aa-4000; } void sht_all(void) { unsigned int j; read_temp(); chengxu.c(30): warning C206: 'read_temp': missing function-prototype jisuan_temp(); j=3; if(shtdata/10000==0) {lcd_display(1,3,' ');} else{ lcd_display(1,j,0x30+shtdata/10000);j++;} lcd_display(1,j++,0x30+(shtdata/1000)%10); lcd_display(1,j++,0x30+(shtdata/100)%10); lcd_display(1,j++,0x30+(shtdata/10)%10); lcd_display(1,j++,0x30+(shtdata%10)); read_humidity(); jisuan_humidity(); j=11; if(shtdata/10000==0) lcd_display(1,11,' '); chengxu.c(33): warning C206: 'lcd_display': missing function-prototype chengxu.c(33): error C267: 'lcd_display': requires ANSI-style prototype else lcd_display(1,j++,0x30+shtdata/10000); lcd_display(1,j++,0x30+(shtdata/1000)%10); lcd_display(1,j++,0x30+(shtdata/100)%10); lcd_display(1,j++,0x30+(shtdata/10)%10); lcd_display(1,j++,0x30+(shtdata%10)); } void main(void) { unsigned char i; lcd_init(); sht_init(); lcd_display(1,1,'T'); lcd_display(1,2,':'); lcd_display(1,9,'H'); lcd_display(1,10,':'); for(i=0;i<8;i++) lcd_display(2,i+1,table); lcd_display(2,12,'S'); lcd_display(2,13,'H'); lcd_display(2,14,'T'); lcd_display(2,15,0X31); lcd_display(2,16,0X31); while(1) { delay(100); sht_all(); delay(100); } } #ifndef _lcd1602_h #define _lcd1602_h #include ***it lcde=P2^0; ***it lcdrs=P2^1; void delay(unsigned int z); void write_com(unsigned char cdate); void write_date(unsigned char date); void lcd_init(void); void lcd_display(unsigned char x,unsigned char y,unsigned char date); #endif #ifndef _sht_h #define _sht_h #include ***it SHT_sck=P2^6; ***it SHT_data=P2^7; extern unsigned char shtdatah,shtdatal; void delay_nms(unsigned int z); void SHT_start(void); void write_sht_byte(unsigned char sdata); void write_sht_command(unsigned char cmd); void sht_rst(void); void read_sht(void); void sht_init(void); void read_temp(void); void read_humidity(void); #endif |
|
相关推荐
5个回答
|
|
路径不对,没有包含这头文件
|
|
|
|
|
|
|
|
开始两个是没有头文件,后面是子程序没有声明,最好子程序放在前面,后面再调用!
|
|
|
|
刚学习看不太懂啊
|
|
|
|
怎么改啊 求救
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
4768 浏览 3 评论
6055 浏览 1 评论
6318 浏览 0 评论
Protues中自己封装的芯片元件无Program File、Clock Frequency选项怎么解决,求求大神了!
8067 浏览 1 评论
基于51单片机的车辆倒车雷达报警系统,HC-SR04超声波测距,全套资料
1235 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 09:07 , Processed in 0.668647 second(s), Total 84, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号