📄 3_ds.h
字号:
#include<reg52.h> //Microcontroller specific library, e.g. port definitions
#include <intrins.h> //Keil library (is used for _nop()_ operation)
#include <math.h> //Keil library
#include <stdio.h> //Keil library
#include <absacc.h>
typedef union
{ unsigned int i;
float f;
} value;
//----------------------------------------------------------------------------------
// modul-var
//----------------------------------------------------------------------------------
enum {TEMP,HUMI};
//#define DATA P1_0
//#define SCK P1_1
#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
#define uchar unsigned char
#define uint unsigned int
uchar tplsb,tpmsb; // 温度值低位、高位字节
uchar ds_num;
unsigned char xdata redata[8];
unsigned char xdata sedata[13];
//sbit DQ = P0^1; // 数据通信线DQ
union{
unsigned int ds1_temp;
unsigned char ds1_t[2];
}ds1;
union{
unsigned int ds2_temp;
unsigned char ds2_t[2];
}ds2;
union{
unsigned int ds3_temp;
unsigned char ds3_t[2];
}ds3;
union{
unsigned int s_temp;
unsigned char s_t[2];
}s;
sbit DATA=P1^0;
sbit SCK=P1^1;
//sbit int485=P3^2;
//unsigned char *tm;
//unsigned int s_temph,s_templ,ds_temph,ds_templ;
//float s_tem;
//float xdata ds1_tem,ds2_tem,ds3_tem;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -