#include#defineucharunsignedchar#defineuintunsignedtuinthum,temp,I;//定义湿度和温度全局Ucharhum_h,hum_l,temp_h,temp_l,check,CNT=0;//湿度8位,温度8位,奇偶校验位ucharbai,shi,ge,bai1,shi1,ge1//数码管,CNT=0charcodetable={0xfb,0xfd,0xFe};//位选择数组ucharcodetable1={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//UcharcodeTable2不带小数点={0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0xef};//有一个小数点sbitdht=p2^4;/********************************************************************************************forfor;****************************************************delay_us;//下拉延时500微秒,发送启动信号DHT=1;//释放总线,延时30微秒delay_us而;//下拉并等待while//等待高,马上就要传输数据了}/*********************************************************,for{whiledelay_us//理论上28us。
1、stc90c51单片机开发板和sht11温湿度 传感器连接测量温湿度的具体程序_百...# include # defineucharunsignedchar # defineuintunsigned tuin thum,temp,I;//定义湿度和温度全局Uchar hum _ h,hum _ l,temp _ h,temp _ l,check,CNT = 0;//湿度8位,温度8位,奇偶校验位ucharbai,shi,ge,bai1,shi1,ge1//数码管,CNT = 0charcodetable = {0xfb,0xfd,0x Fe };//位选择数组ucharcodetable1 = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f };//UcharcodeTable2不带小数点= {0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0x ef };//有一个小数点sbitdht=p2^4;/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * for for;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * delay _ us;//下拉延时500微秒,发送启动信号DHT = 1;//释放总线,延时30微秒delay _ us而;//下拉并等待while//等待高,马上就要传输数据了}/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *,for { whiledelay _ us//理论上28u。
文章TAG:HUM 传感器 HUM在传感器上是什么意思