⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sht.h

📁 DS18B20用来测温度十分方便
💻 H
字号:
//***********************************************************************
//FILE: sht.h
//功能:	定义与SHT11有关的变量及相关的处理函数(SHT11硬件I2C不兼容,采用模I2C口)
//***********************************************************************

//***********************************************************************

sbit	DATA= P0^5;  //DATA=  	P0^1;开发板用
sbit	SCK=  P0^4;  //SCK=   	P0^0;开发板用

#define noACK 0
#define ACK   1
                            //adr  command  r/w
#define STATUS_REG_W 0x06   //000   0011    0    //读状态寄存器
#define STATUS_REG_R 0x07   //000   0011    1    //写状态寄存器
#define MEASURE_TEMP 0x03   //000   0001    1    //测温命令
#define MEASURE_HUMI 0x05   //000   0010    1    //测湿度命令
#define RESET        0x1e   //000   1111    0    //软复位命令

typedef union 
{ unsigned int i;
  float f;
} value;

//***********************************************************************
extern char s_write_byte(unsigned char tvalue);
extern char s_read_byte(unsigned char ack);
extern void s_transstart(void);
extern void s_connectionreset(void);
extern char s_read_statusreg(unsigned char *p_value, unsigned char *p_checksum);
//extern char s_write_statusreg(unsigned char *p_value);
//extern char s_softreset(void);
extern char s_humi(uchar *p_value, uchar *p_checksum);
extern char s_temp(uchar *p_value, uchar *p_checksum);
extern void calc_sth11(float *p_humidity ,float *p_temperature);
//extern float calc_dewpoint(float h,float t);
//*******************************END*************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -