编译后出现错误warning c318:can't open file “LCD1602.H”,error c129 missing“;”before tset

qq_42094111 2018-04-28 12:31:06
#ifndef KEY_H
#define KEY_H

#include<reg52.h>
#include"LCD1602.h"
#include"Timer0.h"

extern void TControl(void);

#endif
#ifndef TIMER0_H
#define TIMER0_H

#include<reg52.h>
#include"short.h"
#include"ADC.h"
#include"LCD1602.h"
sbit Heater=P2^4;
extern uchar TSet;
extern uchar T;
extern void Tim0Init(void);
#endif
#ifndef ADC_H
#define ADC_H

#include<reg52.h>
#include"short.h"
#include"lcd1602.h"

sbit ADC_WR=P3^0;
sbit ADC_RD=P3^1;
sbit ADC_CS=P3^2;
sbit ADC_INT=P3^3;

extern void ADCInit(void);
extern uchar ReadADC(void);
#endif
#ifndef LCD1602_H
#define LCD1602_H

#include<reg52.h>
#include"short.h"

sbit RS=P2^5;
sbit RW=P2^6;
sbit E =P2^7;

extern void Delayms(uint ms);
extern void WriteCmd(unsigned char com);
extern void WriteData(unsigned char dat);
extern void LCDInit();
extern void Display(long int x,uchar flag);
extern void StrDisplay(uchar *Str);
#endif
#ifndef SHORT_H
#define SHORT_H

#define uchar unsigned char
#define uint unsigned int

#endif
#include"ADC.h"

void ADCInit(void)
{
ADC_CS=1;
ADC_RD=1;
ADC_WR=1;
}

uchar ReadADC(void)
{
uchar V;
ADC_RD=1;
ADC_WR=1;
ADC_INT=1;
ADC_CS=0;
ADC_WR=0;
ADC_WR=1;
while(ADC_INT);
ADC_RD=0;
V=P1;
ADC_CS=1;
ADC_RD=1;
return V;
}
#include"lcd1602.h"

void Delay(void)
{
unsigned char i;
for(i=0;i<5;i++);
}

void Delayms(uint ms)
{
uint i,n;
for(n=0;n<ms;n++)
{
for(i=0;i<2000;i++);
}
}

void WriteCmd(unsigned char com)
{
RW=0;
Delay();
RS=0;
Delay();
E=1;
Delay();
P0=com;
Delay();
E=0;
Delay();
RW=1;
}

void LCDInit(void)
{
WriteCmd(0x3c);
WriteCmd(0x0c);
WriteCmd(0x01);
WriteCmd(0x06);
WriteCmd(0x80);
}

void WriteData(unsigned char dat)
{
RW=0;
Delay();
RS=1;
Delay();
E=1;
Delay();
P0=dat;
Delay();
E=0;
Delay();
RW=1;
}

void Display(long int x,uchar flag)
{
uchar n=1;
unsigned long int _data_,y=1;
if(flag==1)
{
WriteCmd(0x01);
Delayms(1);
}
if(x<0)
{
x=0-x;
WriteData('-');
}
_data_=x;
while(_data_/=10)
{
n++;
y*=10;
}
_data_=x;
while(n--)
{
WriteData((_data_%(y*10))/y+0x30);
y/=10;
}
}

void StrDisplay(uchar *Str)
{
while(*Str)
{
WriteData(*Str);
Str++;
}
}
#include"Timer0.h"

uchar TSet=100;
uchar T;

void Tim0Init(void)
{
ET0=1;
EA=1;
TMOD=0x01;
TH0=55535/256;
TL0=55525%256;
TR0=1;
}

void INTTim0(void) interrupt 1
{
static uchar i=0;
TH0=55535/256;
TL0=55525%256;
T=ReadADC();
if(T>TSet)
{
Heater=0;
}
else
{
Heater=1;
}
i++;
i%=50;
if(!i)
{
WriteCmd(0x01);
Delayms(2);
StrDisplay("T:");
Display(T/5,0);
StrDisplay(" C");
WriteCmd(0xc0);
StrDisplay("TSet:");
Display(TSet/5,0);
StrDisplay(" C");
}
}
#include"Key.h"

uchar KeyScan(void)
{
uchar Key;
uchar KeyValue;
while(Key==0x90)
{
Key=P3&0x90;
}
KeyValue=P3&0x90;
while(Key!=0x90)
{
Key=P3&0x90;
}
return KeyValue;
}

void TControl(void)
{
uchar KeyValue;
KeyValue=KeyScan();
switch(KeyValue)
{
case 0x80:if(TSet<200){TSet+=5;}break;
case 0x10:if(TSet>100){TSet-=5;}break;
default:break;
}
}
#include<reg52.h>
#include"lcd1602.h"
#include"ADC.h"
#include"short.h"
#include"Timer0.h"
#include"Key.h"



void main(void)
{
LCDInit();
ADCInit();
Tim0Init();
while(1)
{
TControl();
}
}
...全文
6842 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
of123 2018-07-06
  • 打赏
  • 举报
回复
引用 3 楼 qq_42094111 的回复:
能具体说一下嘛??这是我的毕设程序,改了好久,或者能请您帮我改一下,有偿的

是 keil 编译器吗?如果是,点击工具栏上 Options for Target 魔术棒图标,在弹出窗口中选 C/C++ 标签页,在 Include Paths 栏中填入 .h
文件路径。比如子目录名就是"h",那就要在栏中填入".\h"。
  • 打赏
  • 举报
回复
参考正点原子的添加头文件,
qq_42094111 2018-04-29
  • 打赏
  • 举报
回复
能具体说一下嘛??这是我的毕设程序,改了好久,或者能请您帮我改一下,有偿的
fly 100% 2018-04-29
  • 打赏
  • 举报
回复
路径里面没有LCd_1602.h 所以uchar 的定义就找不到了。解决路径的.h 文件问题应该就好了
qq_42094111 2018-04-29
  • 打赏
  • 举报
回复
如果可以请联系我,QQ1026433216
dceacho 2018-04-28
  • 打赏
  • 举报
回复
can't open file “LCD1602.H” options for targer-->c/c++标签下的include路径没设好,导致找不到lcd1602.h这个文件 missing“;”before tset 你的TSet前的uchar没定义, 你把uchar改成unsigned char

27,374

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 单片机/工控
社区管理员
  • 单片机/工控社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧