用keil一直编译报错 各种定义报错 跪求大神们帮忙看看
#include<reg51.h>
#include<XPT2046.h>
#define uchar unsigned char
#define uint unsigned int
#define GPIO_DIG P0
sbit jiare=P1^7;
sbit jiashui=P1^6;
sbit queshui=P1^5;
sbit youshui=P2^4;
sbit baowen=P2^0;
sbit baojin=P2^1;
sbit jiashuifa=P2^2;
sbit jiaresi=P2^3;
sbit dishuiwei=P3^1;
sbit gaoshuiwei=P3^0;
sbit bee=P3^2;
sbit LSA=P2^5;
sbit LSB=P2^6;
sbit LSC=P2^7;
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
uchar DisplayData[3];
void DigDisplay(void);
void delay(void);
void lowdeal(void);
void middeal(void);
void highdeal(void);
void wdcontrol(void);
void main(void)
{
uchar L=0,H=0,num=0,t1;
uint temp,count,T;
TMOD=0x01;
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
EA=1;
ET0=1;
TR0=1;
bee=1;
while(1)
{ if(count==50)
{
count=0;
temp = Read_AD_Data(0x94);
}
count++;
T=temp/40.8;
DisplayData[0]=DIG_CODE[T/100];
DisplayData[1]=DIG_CODE[T%100/10];
DisplayData[2]=DIG_CODE[T%10/1];
DigDisplay();
if(dishuiwei=0)
{
lowdeal();
}
else
{ if(gaoshuiwei=0)
{
middeal();
}
else
{
highdeal();
}
}
wdcontrol();
}
}
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void highdeal()
{
if(H=0)
{
jiashuifa=0;
H=1;
youshui=1;
jiashui=0;
}
}
void middeal()
{
if(L=0)
{if(H=1)
H=0;}
else
{
L=0;
queshui=0;
jiaresi=1;
youshui=1;
JR=1;
}
}
void lowdeal()
{
if(L=0)
{queshui=1;
jiashuifa=1;
jiashui=1;
baowen=0;
youshui=0;
jiare=0;
L=0;
JR=0;
}
void wdcontrol()
{ uchar JR,BW;
if(L=0)
{ if(T<80)
{ if(JR=0)
{ jiaresi=1;
jiare=1;
JR=1;
baowen=0;
BW=0;
EA=1;
}
}
else
{ if(T<100)
{ if(BW=0)
{ if(JR=0)
{ jiaresi=1;
jiare=1;
JR=1;
baowen=0;
BW=0;
EA=1;
}
}
}
else
{ jiaresi=0;
jiare=0;
JR=0;
baowen=1;
BW=1;
EA=0;
}
}
}
}
void T0_time()interrupt 1
{
TH0=(65536-45872)/256;
TL0=(65536-45872)%256;
num++;
if(num==200)
{
num=0;
t1=T;
if(t1<=T)
{
bee=0;
while(1);
}
}
}
void DigDisplay(void)
{
unsigned char i;
unsigned int j;
for(i=0;i<3;i++)
{
switch(i)
{
case(0):
LSA=1;LSB=0;LSC=1; break;
case(1):
LSA=0;LSB=1;LSC=1; break;
case(2):
LSA=1;LSB=1;LSC=1; break;
}
GPIO_DIG=DisplayData[i];
j=50;
while(j--);
GPIO_DIG=0x00;
}
}
|