以前调DHT11是比较纠结,在操作IIC时还要保持总线状态很久时间,具体细节忘记了,下面是代码,STM32 ,MDK, 软件模拟IIC(PS:硬件IIC我弄很久都搞不定).
u16 Get_SHT11(void)
{ static u16 step=0,dey;
static value humi_val,temp_val;
float dew_point;
static unsigned char error =0;
unsigned char Hbyte,Lbyte,crc;
OsTaskStart();
s_transstart(); //transmission start
//send command to sensor
error+=s_write_byte(MEASURE_TEMP);
OsDelay(30,1);
//for (i=0;i