51单片机电子时钟--程序.doc

上传人:恋****泡 文档编号:873363 上传时间:2019-08-12 格式:DOC 页数:3 大小:28.50KB
返回 下载 相关 举报
51单片机电子时钟--程序.doc_第1页
第1页 / 共3页
51单片机电子时钟--程序.doc_第2页
第2页 / 共3页
点击查看更多>>
资源描述

《51单片机电子时钟--程序.doc》由会员分享,可在线阅读,更多相关《51单片机电子时钟--程序.doc(3页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、#include#define uint unsigned int #define uchar unsigned char#define s_count_max 60 #define min_cou_max 60 #define h_count_max 24unsigned int inttrupt_count=0; unsigned int s_count=0; unsigned int min_cou=0; unsigned int h_count=0; uchar code LED_table10=0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,

2、0x6f;/相应 段码 uchar code bittable6=0xf8,0xf4,0xec,0xdc,0xbc,0x7c; /相应位码 uchar clockstr6=0,0,0,0,0,0;void dl_ms() uint j;for(j=0;j200;j+);/延时 void display() uchar i; for(i=0;i6;i+) /6 个数码管 P0=(clockstri);P2=bittablei;dl_ms(); void update_clockstr(void)clockstr0=LED_tables_count%10; clockstr1=LED_table(

3、int)(s_count/10); clockstr2=LED_tablemin_cou%10; clockstr3=LED_table(int)(min_cou/10);clockstr4=LED_tableh_count%10;clockstr5=LED_table(int)(h_count/10); /*/display();void main() /测试 h_count=23;min_cou=59;s_count=50; inttrupt_count=0; EA=1; /中断 ET0=1; TMOD=0X01; TH0=-20000/256; TL0=-20000%256; TR0=1;for(;) update_clockstr(); void timer0() interrupt 1 using 1 /完成 1s 定时 20ms 定时 共 50 次 inttrupt_count+; TH0=-20000/256; TL0=-20000%256; if (inttrupt_count=50) inttrupt_count=0;s_count+;if(60=s_count) /(60=s_count)s_count=0;min_cou+;if(60=min_cou)min_cou=0;h_count+;if(24=h_count) h_count=0;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 技术总结

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com