資源簡介
dht11 庫文件 溫濕度庫文件dht11 庫文件 溫濕度庫文件dht11 庫文件 溫濕度庫文件dht11 庫文件 溫濕度庫文件
代碼片段和文件信息
/****************************************************************************/
//收發信號檢測,數據讀取
/****************************************************************************/
#include?
#include?“dht11.h“
#include?“1602.h“
char?receive()
{????
?????????unint8?i;
?????????com_data=0;
?????????for(i=0;i<=7;i++)????
?????????{
??????????????????respond=2;
??????????????????while((!TRH)&&respond++);
??????????????????DelayUs(5);
??????????????????DelayUs(5);
??????????????????DelayUs(5);
??????????????????if(TRH)
??????????????????{
???????????????????????????temp=1;
???????????????????????????respond=2;
???????????????????????????while((TRH)&&respond++);?
??????????????????}?
??????????????????else
???????????????????????????temp=0;
??????????????????com_data<<=1;
??????????????????com_data|=temp;????
?????????}
?????????return(com_data);??
}
/****************************************************************************/
/****************************************************************************/
//濕度讀取子程序?
//溫度高8位==?TL_data
//溫度低8位==?TH_data
//濕度高8位==?RH_data
//濕度低8位==?RH_data
//校驗?8位?==?CK_data
//調用的程序有?delay();?Delay_5us();RECEIVE();?
/***************************************************************************/
void?read_TRH()
{
?????????//主機拉低18ms?
????????TRH=0;
?
評論
共有 條評論