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

📄 sensorlib.h

📁 一个数字温度计源代码 MCU是AT89S52 温度传感器是DS18B20 温度测量范围-30 - 100 精度0.5度
💻 H
字号:
//this file include the method provide by the sensorLib.c file
//Author:Decell.Zhou
//Version

#include "REG52.h"
#include "INTRINS.h"


//ROM Commands
#define SEARCH_ROM 0xf0
#define READ_ROM 0x33
#define MARCH_ROM 0x55
#define SKIP_ROM 0xcc
#define ALARM_SEARCH 0xec
//Function Commands
#define CONVERT_T 0x44
#define WRITE_RAM 0x4e
#define READ_RAM 0xbe
#define COPY_RAM 0x48
#define RECALL_E2 0xb8
#define READ_PWR 0xb4



//the DQ pin output  
sbit sensorDQ  = P3^7;



//===========[writeSensor]============
//Description:write a byte to the DS18B20
//Author:Decell.Zhou
//Version:
//Arg: value |  unsigned char  | the vaule you want to send to DS18B20
//Return:none
//==================================
void writeSensor(unsigned char value);

//==========[readSensor]==============
//Description:read  a value from the DS18B20
//Author:Decell.Zhou
//Version:
//Arg:none
//Return:the byte read read from the sensor | unsigned char
//===================================
unsigned char readSensor(void);

//==========[resetSensor]=============
//Description:generate a reset signal to the Sensor
//Author:Decell.Zhou
//Version;
//Arg:none
//Return:none
//====================================
void resetSensor(void);

⌨️ 快捷键说明

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