单片机DS18B20温度计C语言程序
- 格式:pdf
- 大小:454.14 KB
- 文档页数:16
单片机DS18B20温度计C语言程序
#include
#include
#include //要用到取绝对值函数abs()
//通过DS18B20测试当前环境温度, 并通过数码管显示当前温度值, 目前显
示范围: -55~ +125度
sbit wela = P2; //数码管位选
sbit dula = P2; //数码管段选
sbit ds = P2 ;
int tempValue;
//0-F数码管的编码(共阳极)
unsigned char code table[]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};