#include <reg51.h>
#include "lcd.h"
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#define NACK 0
#define ACK 1
#define MEASURE_TEMP 0x03 //000 0001 1
#define MEASURE_HUMI 0x05 //000 0010 1
#define STATUS_REG_W 0x06 //000 0011 0
#define STATUS_REG_R 0x07 //000 0011 1
#define RESET 0x1E //000 1111 0
ulong volt;//测量的电压值
sbit Data=P2^3; //定义数据线
sbit CLK=P3^3;//定义时钟信号口
sbit DIN=P3^1;//定义2543数据写入口
sbit DOUT=P3^0;//定义2543数据读取口
sbit CS=P3^2;//定义2543片选信号口
sbit zuoLed = P1^0;
sbit youLed = P1^1;
sbit froLed = P1^2;
sbit lastLed = P1^3;
sbit zuoKey = P1^4;
sbit youKey = P1^5;
sbit froKey = P1^6;
sbit lastKey = P1^7;
uchar cc,ee;
bit zuoFlag = 0,youFlag = 0, froFlag = 0, lastFlag = 0,lightFlag = 0;
sbit BEEP =P2^5;
uchar rec_dat[9]; //用于显示的接收数据数组
ulong C2_max = 3500000;
ulong C2_now = 0;
int display = 0;
void delayus(uint x) { while(x--); }
void delay_50us(unsigned int t) //延时函数
{
unsigned int j,k;
for (;t>0;t--)