DS18B20测温程序
2015-5-12 10:49:00 点击:
如有疑问联系客服,(程序下载在低端)程序开头如下:
#include "reg52.h"
#include "intrins.h"#define uchar unsigned char
#define uint unsigned int
sbit ds=P2^2;
sbit dula=P2^6;
sbit wela=P2^7;
uchar flag ;
uint temp; //参数temp一定要声明为 int 型
uchar code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,
0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; //不带小数点数字编码
uchar code table1[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,
0x87,0xff,0xef}; //带小数点数字编码
/*延时函数*/
void TempDelay (uchar us)
{
while(us--);
}
void delay(uint count) //延时子函数
{
uint i;
while(count)
{
i=200;
while(i>0)
i--;
count--;
}
}
更多优质传感器来自永阳新能源: PT100 http://www.szyyny.com
文件下载:20150512105022481.rar (点击即可下载)
- 上一篇:单法兰液位变送器使用常识 2015/5/13
- 下一篇:热电偶的常用结构普及 2015/5/11