#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();
}
}
4 个解决方案
#1
can't open file “LCD1602.H”
options for targer-->c/c++标签下的include路径没设好,导致找不到lcd1602.h这个文件
missing“;”before tset
你的TSet前的uchar没定义, 你把uchar改成unsigned char
options for targer-->c/c++标签下的include路径没设好,导致找不到lcd1602.h这个文件
missing“;”before tset
你的TSet前的uchar没定义, 你把uchar改成unsigned char
#2
路径里面没有LCd_1602.h 所以uchar 的定义就找不到了。解决路径的.h 文件问题应该就好了
#3
能具体说一下嘛??这是我的毕设程序,改了好久,或者能请您帮我改一下,有偿的
#4
如果可以请联系我,QQ1026433216
#1
can't open file “LCD1602.H”
options for targer-->c/c++标签下的include路径没设好,导致找不到lcd1602.h这个文件
missing“;”before tset
你的TSet前的uchar没定义, 你把uchar改成unsigned char
options for targer-->c/c++标签下的include路径没设好,导致找不到lcd1602.h这个文件
missing“;”before tset
你的TSet前的uchar没定义, 你把uchar改成unsigned char
#2
路径里面没有LCd_1602.h 所以uchar 的定义就找不到了。解决路径的.h 文件问题应该就好了
#3
能具体说一下嘛??这是我的毕设程序,改了好久,或者能请您帮我改一下,有偿的
#4
如果可以请联系我,QQ1026433216