下载此文档

1602液晶电子时钟程序51单片机.doc


文档分类:通信/电子 | 页数:约6页 举报非法文档有奖
1/6
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/6 下载此文档
文档列表 文档介绍
[日期:2009-06-11 ] [ 作者:佚名] [字体:大中小] (投递新闻)
连线图:
; DB0--- DB4--- RS-------------
; DB1--- DB5--- RW-------------
; DB2--- DB6--- E--------------
; DB3--- DB7--- VLCD接10K可调电阻到GND*
#include ""//头文件
#include ""
#define uchar unsigned char//宏定义
#define uint unsigned int//宏定义
sbit RS=P1^2;//定义I/O的硬件接口
sbit RW=P1^3;
sbit E=P1^4;
sbit led_1=P1^7;//;;;LED秒闪烁
uchar Hours=0;//定义小时
uchar Minutes=0;//定义分钟
uchar Seconds=0;//定义秒
bit Seconds_Scintillation=1;//定义秒闪烁标志
#define DPDR P0//并行数据接口定义

uchar code DispTab_1[]={'0','1','2','3','4','5','6','7','8','9'};//1602:0-9 数字
uchar code DispTab_2[]={'A','B','C','D','E','a','b','c','d','e'};//1602:A-e 字母
uchar DispBuf[8]; //8字节的显示缓冲区
char char_char_1[]={" "};//定义字符串
char char_char_2[]={" "};//定义空字符串
void delay(uint z)//1ms延时
{
uchar x,x1;
for(;z>0;z--)
{
for(x=0;x<114;x++)
{
for(x1=0;x1<1;x1++);
}
}
}
void Timer0() interrupt 1
{
static uchar Count_50;//
uchar temp;
TH0=0xb7;
TL0=0xff;//定时时间为20ms,每20ms中断一次
Count_50++;
if(Count_50==50)//20ms*50=1秒
{ Seconds_Scintillation=~Seconds_Scintillation;
led_1=~led_1;
Count_50=0;
Seconds++;
if(Seconds==60)
{
Seconds=0;
Minutes++;
if(Minutes==60)
{
Minutes=0;
Hours++;
if(Hours==24)
{
Hours=0;
}
}
}
}
if(Seconds_Scintillation==1)//秒闪烁标志判断
DispBuf[6]=':';
else
Di

1602液晶电子时钟程序51单片机 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数6
  • 收藏数0 收藏
  • 顶次数0
  • 上传人fy3986758
  • 文件大小26 KB
  • 时间2018-11-02