没有合适的资源?快使用搜索试试~ 我知道了~
18b20 的程序 测温 匹配 读ROM
需积分: 12 50 下载量 116 浏览量
2010-04-25
20:06:00
上传
评论
收藏 7KB TXT 举报
温馨提示
试读
11页
18b20 测温 单片机 多点 自己调试的 多点测温程序 读取序列 匹配rom
资源推荐
资源详情
资源评论
#include<AT89X52.h>
#define uint unsigned int
#define uchar unsigned char
sbit rs=P2^6;
sbit Lcden=P2^7;
uchar table1[]="## welcome!";
uchar table2[]="## **** TMP MCU~";
sbit DS=P2^0; //define interface
sbit key0=P1^0;
sbit key1=P1^1;
uint temp=0; // variable of temperature
uint keyvalue=0;
uint flag;
//unsigned char ID1[8]={0x28,0x49,0x31,0x08,0x02,0x00,0x00,0x0e7};
//unsigned char ID2[8]={0x28,0x15,0x32,0x2d,0x02,0x00,0x00,0x0b};
//unsigned char ID3[8]={0x28,0x7c,0x9a,0x0f6,0x01,0x00,0x00,0x22};
//unsigned char ID4[8]={0x28,0x05a,0x0f5,0x2c,0x02,0x00,0x00,0x0a6};
//unsigned char ID5[8]={0x28,0x8c,0x58,0x08,0x02,0x00,0x00,0x71};
//unsigned char ID6[8]={0x28,0x0f1,0x2e,0x2d,0x02,0x00,0x00,0x0a3};
//unsigned char ID7[8]={0x28,0x03,0x2b,0x08,0x02,0x00,0x00,0x9c};
//unsigned char ID8[8]={0x28,0x0af,0x49,0x08,0x02,0x00,0x00,0x2f};
//unsigned char ID9[8]={0x28,0x72,0x0f3,0x2c,0x02,0x00,0x00,0x2d};
unsigned char code SN1_9[9][8]={{0x28,0x49,0x31,0x08,0x02,0x00,0x00,0x0e7},
{0x28,0x15,0x32,0x2d,0x02,0x00,0x00,0x0b},
{0x28,0x7c,0x9a,0x0f6,0x01,0x00,0x00,0x22},
{0x28,0x0ed,0x52,0x08,0x02,0x00,0x00,0x38},
{0x28,0x8c,0x58,0x08,0x02,0x00,0x00,0x71},
{0x28,0x0f1,0x2e,0x2d,0x02,0x00,0x00,0x0a3},
{0x28,0x03,0x2b,0x08,0x02,0x00,0x00,0x9c},
{0x28,0x0af,0x49,0x08,0x02,0x00,0x00,0x2f},
#define uint unsigned int
#define uchar unsigned char
sbit rs=P2^6;
sbit Lcden=P2^7;
uchar table1[]="## welcome!";
uchar table2[]="## **** TMP MCU~";
sbit DS=P2^0; //define interface
sbit key0=P1^0;
sbit key1=P1^1;
uint temp=0; // variable of temperature
uint keyvalue=0;
uint flag;
//unsigned char ID1[8]={0x28,0x49,0x31,0x08,0x02,0x00,0x00,0x0e7};
//unsigned char ID2[8]={0x28,0x15,0x32,0x2d,0x02,0x00,0x00,0x0b};
//unsigned char ID3[8]={0x28,0x7c,0x9a,0x0f6,0x01,0x00,0x00,0x22};
//unsigned char ID4[8]={0x28,0x05a,0x0f5,0x2c,0x02,0x00,0x00,0x0a6};
//unsigned char ID5[8]={0x28,0x8c,0x58,0x08,0x02,0x00,0x00,0x71};
//unsigned char ID6[8]={0x28,0x0f1,0x2e,0x2d,0x02,0x00,0x00,0x0a3};
//unsigned char ID7[8]={0x28,0x03,0x2b,0x08,0x02,0x00,0x00,0x9c};
//unsigned char ID8[8]={0x28,0x0af,0x49,0x08,0x02,0x00,0x00,0x2f};
//unsigned char ID9[8]={0x28,0x72,0x0f3,0x2c,0x02,0x00,0x00,0x2d};
unsigned char code SN1_9[9][8]={{0x28,0x49,0x31,0x08,0x02,0x00,0x00,0x0e7},
{0x28,0x15,0x32,0x2d,0x02,0x00,0x00,0x0b},
{0x28,0x7c,0x9a,0x0f6,0x01,0x00,0x00,0x22},
{0x28,0x0ed,0x52,0x08,0x02,0x00,0x00,0x38},
{0x28,0x8c,0x58,0x08,0x02,0x00,0x00,0x71},
{0x28,0x0f1,0x2e,0x2d,0x02,0x00,0x00,0x0a3},
{0x28,0x03,0x2b,0x08,0x02,0x00,0x00,0x9c},
{0x28,0x0af,0x49,0x08,0x02,0x00,0x00,0x2f},
{0x28,0x72,0x0f3,0x2c,0x02,0x00,0x00,0x2d}
};
unsigned int T[9]={0x00,0x00,0x00,0x00};
void write_T(uint tt);
///////18b20延时///////
void delay(uint count) //delay
{
uint i;
while(count)
{
i=200;
while(i>0)
i--;
count--;
}
}
///////1602延时///////
void delay0(uint a)//1ms延时
{
uint x,y;
for(x=a;x>0;x--)
for(y=110;y>0;y--);
}
///////1602写命令///////
void write_com(uchar com)
{
P0=com;
rs=0;
Lcden=0;
delay0(5);
};
unsigned int T[9]={0x00,0x00,0x00,0x00};
void write_T(uint tt);
///////18b20延时///////
void delay(uint count) //delay
{
uint i;
while(count)
{
i=200;
while(i>0)
i--;
count--;
}
}
///////1602延时///////
void delay0(uint a)//1ms延时
{
uint x,y;
for(x=a;x>0;x--)
for(y=110;y>0;y--);
}
///////1602写命令///////
void write_com(uchar com)
{
P0=com;
rs=0;
Lcden=0;
delay0(5);
剩余10页未读,继续阅读
资源评论
sun2006_20
- 粉丝: 315
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功