您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 51单片机可调时钟
  所属分类: Solaris
  开发工具:
  文件大小: 219kb
  下载次数: 0
  上传时间: 2013-05-08
  提 供 者: u0106*****
 详细说明: #include #define uchar unsigned char #define uint unsigned int; uint aa,ee,ff,temp; uchar miao,shi,fen,num,num1,flag; uchar code table0[]={0x80,0x90,0xb0,0xc0,0xe0,0xf0}; uchar code table6[]={0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89}; uchar code table5[]={0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99}; uchar code table4[]={0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9}; uchar code table3[]={0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9}; uchar code table2[]={0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe 6,0xe7,0xe8,0xe9}; uchar code table1[]={0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9}; void delay(uchar z) { uchar x,y; for(x=z;x>0;x--) for(y=110;y>0;y--); } void init() { miao=58; fen=58; shi=23; TMOD=0X11; TH1=(65536-50000)/256; TL1=(65536-50000)%6; EA=1; ET1=1; TR1=1; } void displaymiao(uchar date) { uchar shiwei,ge; shiwei=date/10; ge=date; P0=table2[shiwei]; delay(2); P0=table1[ge]; delay(2); } void displayfen(uchar date) { uchar shiwei,ge; shiwei=date/10; ge=date; P0=table4[shiwei]; delay(2); P0=table3[ge]; delay(2); } void displayshi(uchar date) { uchar shiwei,ge; shiwei=date/10; ge=date; P0=table6[shiwei]; delay(2); P0=table5[ge]; delay(2); } void keyb() { P2=0xfe; temp=P2; temp=temp&0xf8; while(temp!=0xf8) { delay(10); temp=temp&0xf8; switch(temp) { case 0xf0:num=1; break; case 0xe8:num=2; break; case 0xd8:num=3; break; } while(temp!=0xf8) { temp=P2; temp=temp&0xf8; } } P2=0xfd; temp=P2; temp=temp&0xf8; while(temp!=0xf8) { delay(10); temp=temp&0xf8; switch(temp) { case 0xf0:num=4; break; case 0xe8:num=5; break; case 0xd8:num=6; break; } while(temp!=0xf8) { temp=P2; temp=temp&0xf8; } } P2=0xfb; temp=P2; temp=temp&0xf8; while(temp!=0xf8) { delay(10); temp=temp&0xf8; switch(temp) { case 0xf0:num=7; break; case 0xe8:num=8; break; case 0xd8:num=9; break; } while(temp!=0xf8) { temp=P2; temp=temp&0xf8; } } if(num==1) { num=0; TR1=0; } if(num==2) { num=0; TR1=1; } if(num==3) { num=0; TR1=0; { fen++; if(fen==60) { fen=0; } } } if(num==4) { num=0; TR1=0; delay(50000); shi++; if(shi==24) { shi=0; } } } void main() { init(); while(1) { keyb(); if(aa==20) { aa=0; miao++; if(miao==60) { miao=0; fen++; if(fen==60) { fen=0; shi++; if(shi==24) { shi=0; } } } } displaymiao(miao); displayfen(fen); displayshi(shi); } } void timer1() interrupt 3 { TH1=(65536-50000)/256; TL1=(65536-50000)%6; aa++; } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 单片机
 输入关键字,在本站1000多万海量源码库中尽情搜索: