c语言程序错误,数据校验那,编译时说............那有语法错误,求大神帮忙
//主函数文件
#include <reg52.h>
#include <intrins.h>
#include <stdio.h>
#define LCD_DATA P1 //LCD1602 data transfer define
#define uint unsigned int
#define uchar unsigned char
sbit LCD_RS = P3^7; //1602 control define
sbit RW = P3^6;
sbit LCD_E = P3^5;
void LCD_write_char(uchar cd,uchar ab);
void LCD_set_xy( X, Y );
void LCD_byte(ab);
//下面是红外线控制步进电机的程序定义
#define MOTOR_SPEED 3
#define MOTOR_R 500
uint R_dat=MOTOR_R;
uchar code clockWise[]={0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x09}; //八拍方式驱动,顺序为A AB B BC C CD D DA//
uchar code clockWise1[]={0x09,0x01,0x03,0x02,0x06,0x04,0x0c,0x08};
sbit IN1=P0^1;
sbit speeb=P0^0;//蜂鸣器
sbit key1=P3^3;//变频按键
sbit kaimen=P3^0;
sbit guanmen=P3^1;
//sbit key2=P0^2;//防挤压按键
uchar num1,num2=10;
void delay2(uchar z);
void delay3(uchar o);
void zhengzhuan(uchar s);
void fanzhuan();
void Control();
//DS18b20的程序定义
#include<intrins.h>
void delay(uint i);
void delay1(uint a);
sbit DQ=P3^4;
uint temp;
/*******************************DS18b20的程
**********************************/
//延时程序
void delay(unsigned int i)
{
char j;
for(i; i > 0; i--)
for(j = 200; j > 0; j--);
}
void delay1(uint a)
{
while(--a);
}
void init_18b20()
{
DQ=1;
delay1(8);
DQ=0;
delay1(90);
DQ=1;
_nop_();
_nop_();
delay1(100);
DQ=1;
}
void weite(uchar dat)
{
uchar i;
for(i=0;i<8;i++)
{
DQ=0;
DQ=dat&0x01;
delay1(5);
DQ=1;
dat>>=1;
}
}
uchar read()
{
uchar i,dat=0;
DQ=1;
_nop_();
for(i=0;i<8;i++)
{
DQ=0;
_nop_();
_nop_();
dat>>=1;
DQ=1;
_nop_();
_nop_();
if(DQ)
dat|=0x80;
delay1(30);
DQ=1;
}
return dat;
}
uchar read_tu()
{
uchar a,b;
init_18b20();
weite(0xcc);
weite(0x44);
init_18b20();
weite(0xcc);
weite(0xbe);
a=read();
b=read();
b<<=4;
b+=(a&0xf0)>>4;
return b;
}
/**********************DHT11*****************************************/
sbit bit11=P3^3;
unsigned char U8T_data_H,U8T_data_L,U8RH_data_H,U8RH_data_L,U8checkdata;
float F16T,F16RH; //用于最终读取的温湿度数据
void Delay_ms(unsigned int n)//n毫秒延时//延时函数文件
{
unsigned char j;
while(n--)
{
for(j=0;j<125;j++);
}
}
void Delay_us(unsigned char n) //N us延时函数
{
n=n/2;
while(--n);
}
char COM(void)
{
char i,U8temp,U8comdata;
for(i=0;i<8;i++)
{
while(!bit11);//表示读取的高电位延时大于20多us则读取的是1否则读取的是0
Delay_us(35);//通过U8FLAG 可判断bit11显示数据的脉长
U8temp=0;
if(bit11)U8temp=1;
while(bit11);
U8comdata<<=1;
U8comdata|=U8temp;
}//rof
return U8comdata;
}
void getDHT11(void)
{
GO1: bit11=0;//主机拉低18ms
Delay_ms(20);
bit11=1;
Delay_us(60);//总线由上拉电阻拉高 主机延时20us
if(!bit11) //T !
{
while(!bit11);//wait DHT goto high
while(bit11);
//数据接收状态
U8RH_data_H=COM();
U8RH_data_L=COM();
U8T_data_H=COM();
U8T_data_L=COM();
U8checkdata=COM();
bit11=1;
//数据校验
if((U8T_data_H+U8T_data_L+U8RH_data_H+U8RH_data_L)!=U8checkdata) ................
goto GO1;
}//fi
F16T=U8T_data_H+(float)U8T_data_L/256;//change integer to float
F16RH=U8RH_data_H+(float)U8RH_data_L/256;
}
/*****************************LCD1602文件***********************************/
void Init_Lcd() //LCD初始化
{
LCD_write_char(0x38,0);
Delay_ms(1);
LCD_write_char(0x38,0);
Delay_ms(1);
LCD_write_char(0x38,0);
Delay_ms(1);
LCD_write_char(0x0c,0);
Delay_ms(1);
LCD_write_char(0x06,0);
Delay_ms(1);
LCD_write_char(0x0c,0);
Delay_ms(1);
}
void LCD_write_str(unsigned char X,unsigned char Y,unsigned char *s)//LCD_write_str(uchar X,uchar Y,uchar *s)主函数调用
{
LCD_write_char(0,' ');
LCD_set_xy( X, Y ); //写地址
while (*s) //写显示字符
{
LCD_write_char( 0, *s );
s ++;
}
}
void LCD_set_xy( uchar x, uchar y ) //写地址函数LCD_set_xy( uchar x, uchar y )
{
unsigned char address;
if (y == 0) address = 0x80 + x;
else
address = 0xc0 + x;
LCD_write_char( address, 0 );
}
void LCD_en_write(void) //液晶使能LCD_en_write(void)
{
_nop_();
LCD_E=1;//EN=1
_nop_();
LCD_E=0;//EN=0
}
void LCD_write_char(uchar cd,uchar ab) //写数据LCD_write_char(uchar cd,uchar ab)
{
Delay_us(20);
if(cd==0)
{
LCD_RS=1; //RS=1,写显示内容
LCD_byte(ab);
}
else
{
LCD_RS=0; //RS=0,写命令
LCD_byte(cd);
}
}
void LCD_byte(unsigned char abc) // LCD_byte(abc);
{
RW = 0;
LCD_E = 0;
LCD_DATA = abc;
LCD_en_write();
}
//在液晶中显示浮点数函数
LCD_value(unsigned char x,unsigned char y,float f)
{
unsigned char str[15]; //不能定义为char* str,数组长度一定要大于浮点数的总位数
sprintf(str,"%.1f",f); //1表示小数位数小数太多自动四舍五入
LCD_write_str( x, y, str);
return 0;
}
/**************************************主程序*******************************/
void main ()
{
Init_Lcd();
LCD_write_str(0,1,"abc"); //液晶预显示测试
LCD_value(0,0,34.345);
Delay_ms(2000);
Init_Lcd();
while(1)
{
if(IN1==0)
{Control();}
getDHT11();
LCD_write_str(0,0,"T=");
LCD_value(3,0,F16T); LCD_write_str(7,0,”\”);// 字符"应用转义格式
temp=read_tu();
LCD_value(11,0,temp);
LCD_write_str(0,1,"RH=");
LCD_value(4,1,F16RH); LCD_write_str(8,1,"%");
Delay_ms(500);
}
}
/**************下面是红外线控制步进电机的程序******************************/
void delay2(uchar z)
{
uchar x,y;
for(x=0;x<z;x++)
for(y=0;y<110;y++);
}
void delay3(uchar o)
{
uchar x,y;
x=0;x<3;x++)
for(y=0;y<o;y++);
}
/**************步进电机正转函数****************/
void zhengzhuan(uchar s)
{
uchar i;
for(i=0;i<8;i++)
{
P2=clockWise[i];
delay3(s);
}
}
/************步进电机反转函数*****************/
void fanzhuan()
{
uchar i;
for(i=0;i<8;i++)
{
P2=clockWise1[i];
delay3(40);
}
}
/************步进电机控制函数*****************/
void Control()
{
uchar num=120;
uint i,j,z;
if(IN1==0)
{
delay2(8);
if(IN1==0)
{
delay2(8);
if(IN1==0)
{
kaimen=0;
for(z=10;z>0;z--)
{
delay2(500);
}
kaimen=1;
for(z=10;z>0;z--)
{
delay2(500);
}
for(j=500;j>0;j--)//for(;R_dat>0;R_dat--)
{speeb=1;
if(key1==1)
{
zhengzhuan(40);
}
else
{
for(;R_dat>0;R_dat--)
{speeb=1;
zhengzhuan(num);//变频程序
if(key1==0)
{
while(!key1);
num=num-20;
}
speeb=0;
}
}
speeb=0;
//while(IN1==0);
}
//speeb=0;
}
}
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
delay2(500);
/*******************防挤程序在关门时被挤到时门开一段时间在闭上*******/
EA=1;
EX0=1;
IT0=1;
guanmen=0;
for(z=20;z>0;z--)
{
delay2(500);
}
guanmen=1;
for(z=10;z>0;z--)
delay2(500);
}
kaimen=0;
for(z=10;z>0;z--)
{delay2(500);}
kaimen=1;
for(z=10;z>0;z--)
{delay2(500);}
for(i=500;i>0;i--)//for(;R_dat<MOTOR_R;R_dat++)
{ speeb=1;
fanzhuan();
speeb=0;
}
guanmen=0;
for(z=20;z>0;z--)
{delay2(500);}
guanmen=1;
}
void int0() interrupt 0
{
uint j=300;
for(;j>0;j--)
{
zhengzhuan(40);
}
Control();
}