ds18b20温度采集与显示

时间:2014-02-26 07:47:52
【文件属性】:

文件名称:ds18b20温度采集与显示

文件大小:1KB

文件格式:RAR

更新时间:2014-02-26 07:47:52

ds18b20 显示

//安装目录下的EXE文件打开后可在电脑上显示当前温度值 #include #define uchar unsigned char #define uint unsigned int sbit DS=P2^2; //define interface uint temp; // variable of temperature uchar flag1; // sign of the result positive or negative sbit dula=P2^6; sbit wela=P2^7; unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; unsigned char code table1[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd, 0x87,0xff,0xef}; void delay(uint count) //delay { uint i; while(count) { i=200; while(i>0) i--; count--; } } ///////功能:串口初始化,波特率9600,方式1/////// void Init_Com(void) { TMOD = 0x20; PCON = 0x00; SCON = 0x50;//0101 0000即sm0=0,sm1=1,方式一,且REN=1。 TH1 = 0xFd; TL1 = 0xFd; TR1 = 1;//启动定时器1 }


【文件预览】:
DS18B20.txt

网友评论

  • 用keil编译后出现两个警告,需要自行改动,不能马上用……