/*
STC15L系列单片机
11.0592M晶振、3.3V
20150612mos
*/
#include
#include
#define add_w 0x80 //传感器地址 + 写操作
#define add_r 0x81 //传感器地址 + 读操作
#define T_code 0xe3//温度 测量指令
#define RH_code 0xe5//湿度 测量指令
#define user_code_w 0xe6//用户寄存器 写指令
#define user_code_r 0xe7//用户寄存器 读指令,可读电池电压是否小于2.25V。(测量后才可查看)
#define RST_code 0xfe//软复位,寄存器服务。
#define uchar unsigned char
#define uint unsigned int
sbit sda=P1^3;//数据线
sbit scl=P1^4;//时钟线
/***********延时程序***********/
//11.0592MHz 1T 时钟周期0.09042us 机器周期0.09042us,根据当前配置计算延时程序。
//测量分辨率 RH 12 BIT、T 14 BIT,测量时间RH29ms、T85ms
//测量分辨率 RH 8 BIT、T 12 BIT,测量时间RH4 ms、T22ms
//SCL时钟,延时2us
void delay85ms(void) //误差 -0.000000000011us
{
unsigned char a,b,c;
for(c&#