单片机热敏电阻测温度c语言,51单片机热敏电阻测温程序.doc

该博客介绍了如何利用51单片机和DS18B20热敏电阻进行温度测量。通过C语言编程,详细展示了初始化、读写操作及温度读取的过程,包括单片机接口定义、延时函数、与DS18B20的通信协议等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//本程序是通过热敏电阻测温度(30c-50c

#include

#include

#include

#define uchar unsigned char

#define uint unsigned int

uchar smg[]={0x88,0xeb,0x4c,0x49,0x2b,0x19,0x18,0xcb,0x08,0x09};

uchar b,d;

uint shuju;

int a,temp;

sbit start=P2^7;

sbit ale=P2^7;

sbit addc=P2^6;

sbit addb=P2^5;

sbit adda=P2^4;

sbit eoc=P2^3;

sbit oe=P2^2;

sbit clk=P3^2;//0809时钟脚

sbit dat=P3^0; //串行数码管数据端

sbit clock=P3^1; //串行数码管时钟端

sbit DQ=P2^0;

/******************delay**************************/

void delay(uint x)

{

while(x--);

}

void delay1(uint x)

{

uint i,j;

for(i=0;i

for(j=0;j<110;j++);

}

/*******************ds18b20***********************/

void Init_DS18B20(void)

{

unsigned char x

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值