文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 工学 > 1602时钟和温度显示
侵权投诉

1602时钟和温度显示

温度和时钟同时经1602显示 ,很有使用价值哦

/***************************************************************************
1602时钟和温度显示
*****************************************************************************/

#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit lcdrs=P2^6;
sbit lcden=P2^7;
sbit k1=P0^0;
sbit k2=P0^1;
sbit k3=P0^2;
sbit key1=P0^3 ;
sbit k4=P0^4;
sbit k5=P0^6;
sbit DQ=P3^2;
sbit D1=P0^7;
sbit dula=P2^0;
sbit D2=P2^1;
sbit D3=P2^2;
sbit D4=P2^4;
sbit D5=P2^3;
uchar code table[]="2011-05-15 Sun";
uchar code table1[]="00:00:00";
uchar code table2[]="0123456789";
uchar code table3[]="Sun";
uchar code table4[]="Mon";
uchar code table5[]="Tue";
uchar code table6[]="Wed";
uchar code table7[]="Thu";
uchar code table8[]="Fri";
uchar code table9[]="Sat";
uchar code table10[]="pulse measure:" ;
uchar code table11[]="times/min";
uchar code table12[]="2011-05-25 Wed";
uchar code table13[]="08:10:50";
char hour,munite,second,day=15,month=5,year=11,num;
uchar t0,t1,t2,n0,n1,i=2,x,a;
/*********************************************************************
短延时函数
**********************************************************************/

void delay1(uint i)
{
while(--i);

}

/***************************************************************************
延时函数
*****************************************************************************/
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);

} /*********************************************************************
ds18b20初始化
**********************************************************************/

void init_18b20()
{
uchar a;
DQ=1;
delay1(8);
DQ=0;
delay1(90);
DQ=1;
delay1(5);
a=DQ;
delay1(100);
DQ=1;
}

/*********************************************************************
ds18b20 写字节
**********************************************************************/

void write_bit(uchar dat)
{
uchar i;
for(i=0;i<8;i++)
{
DQ=0;
DQ=dat&0x01;
delay1(5);
DQ=1;
dat>>=1;

}

}
/*********************************************************************
ds18b20 读字节
**********************************************************************/
uchar read_bit()
{
uchar i,dat=0;
DQ=1;
_nop_();
// delay1(2);
for(i=0;i<8;i++)
{
DQ=0;
_nop_();
_nop_();
// delay1(4);
dat>>=1;
DQ=1;
_nop_();
_nop_();
//delay1(4);
if(DQ)
dat|=0x80;
delay1(30);
DQ=1;
}
return dat;

}
/*********************************************************************
ds18b20 读温度 整数部分
**********************************************************************/

uchar read_18b20_temp()
{
uchar a,b;
init_18b20();
write_bit(0xcc);
write_bit(0x44);

init_18b20();
w

第1页

热门文档

相关文档

  • 1602显示时钟温度及星期

    引言在开始的时候只是想用 1602 显示成数字温度计,可是在做完温度计之后发现 1602 屏 上还有足够的空间用来显示时钟,所以就在原来的数字温度的程序上进行了扩展,...

  • ds18b20LCD1602时钟温度显示

    ds18b20LCD1602时钟温度显示_信息与通信_工程科技_专业资料 暂无评价0人阅读0次下载举报文档 ds18b20LCD1602时钟温度显示_信息与通信_工程科技_专业资料。DS1302...

  • LCD1602显示时间和温度

    LCD1602显示时间和温度_电子/电路_工程科技_专业资料 暂无评价0人阅读0次下载举报文档 LCD1602显示时间和温度_电子/电路_工程科技_专业资料。/*** * 标题: ...

  • 1602液晶显示DS1302+S51时钟+温度显示

    1602液晶显示DS1302+S51时钟+温度显示1602液晶显示DS1302+S51时钟+温度显示隐藏>> 1602 液晶显示 DS1302+S51 时钟 温度显示 时钟+温度显示 单片机 DIY 2008-...

  • 使用1602液晶显示DS1302+S51时钟+温度显示_cytrm

    使用1602液晶显示DS1302+S51时钟+温度显示_cytrm 使用1602液晶显示DS1302+S51时钟+温度显示_cytrm使用1602液晶显示DS1302+S51时钟+温度显示_cytrm隐藏>> ===*/...

  • 温度时钟测距lcd1602显示程序

    //实时时钟数据线引脚 sbit DS1302_RST = P2^7; //实时时钟复位线引脚 sbit ACC0 = ACC^0; sbit ACC7 = ACC^7; sbit DQ = P2^0; //温度传送...

  • 1602 时钟温度

    /*** *** LCD1602 显示时间 显示当前 程序名称: 温度 版本: VER1.0 适用板本: PL-51 学习板 *** ***/ /*头文件*/ #include...

  • 1602时钟+温度报警.txt

    1602时钟+温度报警.txt_信息与通信_工程科技_专业资料。时钟采用专用时钟芯片DS1302,显示采用LCD1602,数字温度采用DS18B20。具有良好的人机交互方式。...

  • 基于51单片机的1602液晶显示温度和时间的C程序

    (); /***lcd1602 程序***/ void delay1ms(unsigned int ms)//延时 1 毫秒...读取温度 ds1820disp();//显示 time(); //时间程序 display();//时间显示...

  • 带温度的LCD1602电子时钟设计

    二、实验要求(1) 利用 lcd1602 液晶显示屏作为显示模块, AT89C52 进行控 用制,用 ds18b02 测量显示即时温度,温度报警,用 ds1302 时 钟芯片为单片机提供时间...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email