数码管电子钟(可调时)程序(Digital tube electronic clock (adjustable time) program).doc

数码管电子钟(可调时)程序(Digital tube electronic clock (adjustable time) program).doc

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数码管电子钟(可调时)程序(Digital tube electronic clock (adjustable time) program)

数码管电子钟(可调时)程序(Digital tube electronic clock (adjustable time) program) * project requirements: K1 key is to adjust the selection key, according to a second, then a transfer points, then a transfer, then a normal travel time. K2, K3 key is to adjust the + - key Each time the adjustment of the corresponding key position flashing * / /*********************************************************** Experiment Name: electronic clock (can be adjusted) Author: Zhang Wei Class: 11 class electric inspirational class Date: 2013-9-30 Yibin University Yu Ming studio all rights reserved. ***********************************************************/ #includereg51.h #includeintrins.h #define uint unsigned int #define uchar unsigned char #define M 24 Sbit k1=P3^0; Sbit k2=P3^1; Sbit k3=P3^2; Uchar hour=9, min=43, sec=0, buf[8], k=0, key=0, kk=0, ss=0; Uchar a[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf}; / / digital code //0~9, - Uchar b[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; / / position control code The following is the time separation procedures ***********/ /********** Void (timerpaly) { Buf[0]= sec%10; Buf[1]= sec/10; Buf[2]= 10; Buf[3]= min%10; Buf[4]= min/10; Buf[5]= 10; Buf[6]=hour%10; Buf[7]=hour/10; } The following /********** timer initialization procedure ***********/ Void (Timert) { TMOD=0x11; / / working mode 1. TH1=0xdc; TL1=0x00; / / 10ms timing TH0=0xdc; TL0=0x00; / / 10ms timing EA=1; / / open interrupt ET1=1; / / ET0=1; / / allow timer interrupt TR1=1; / / T1 TR0=0; / / t0 } The following /********** delay procedures ***********/ Void Delayms (uint XMS) { Uint I, j; For (i=0; i=xms; i++) For (j=115; j0; j--); } The following is a /********** time display program ***********/ Void (Dispaly) { Uchar temp, i; For (i=0; i8; i++) { P1=0; / / vanishing Temp=buf[i]; P0=a[temp]; //p0 control code Temp=b[i]; If (SS) { If (key==1 (i==1|i==0)) temp=0x00; If (key==2 (i==4|i==3)) temp=0x00; If (key==3 (i==6|i==7)) temp=0x00; } P1=temp; //p1 position control Del

您可能关注的文档

文档评论(0)

jgx3536 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:6111134150000003

1亿VIP精品文档

相关文档