📄 sht_demo.h
字号:
/**********************************************************************************************
* file name: sht_demo.h
* file func: the sht90 hunmidity/temperature demo header file
* file Description: the file is included in c file,and define some globle variables
* author: qcx
* time: 2009/4/30
* version: v1.1
***********************************************************************************************/
#ifndef SHT_DEMO_H
#define SHT_DEMO_H
#include <reg51.h>
typedef union
{ unsigned int i;
float f;
} value; //定义数据结构类型
//-------------------------------------------------------------------------
//modul-val
//-------------------------------------------------------------------------
extern enum {TEMP,HUMI};
#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
sbit DATA = P1^1;
sbit SCK = P1^0;
sbit m_succeed_led = P2^7;
//----------------------------------------------------------------------------------
extern char s_write_byte(unsigned char value);
extern char s_read_byte(unsigned char ack);
extern void s_transstart(void);
extern void s_connectionreset(void);
extern char s_softreset(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_measure(unsigned char *p_value,unsigned char *p_checksum,unsigned char mode);
extern void calc_sth(float *p_humidity,float *p_temperature);
extern float calc_dewpoint(float h,float t);
//---------------------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -