×

8位数码管显示的电子时钟

消耗积分:1 | 格式:rar | 大小:72KB | 2017-05-17

mengsiu

分享资料个

采用8位数码管显示,DS1302时钟芯片,89S51单片机。 四个输入按键,已加入调时程序。电路已运行测试走时稳定。

  #include 《reg52.h》

  #include 《intrins.h》

  #define uchar unsigned char

  #define uint unsigned int

  sbit IO =P3^0;

  sbit CLK =P3^1;

  sbit RST =P3^2;

  sbit TEMP1 =P3^6;

  sbit TEMP2 =P3^7;

  sbit K1 =P1^0;

  sbit K2 =P1^1;

  sbit K3 =P1^2;

  sbit K4 =P1^3;

  uchar n=0;

  uchar set=0;

  uchar seting;

  uchar DateTime[]={14,3,1,1,12,34,56};

  // 年周月日 时 分 秒

  uchar DSP_NUM[]={0,0,11,0,0,11,0,0};

  uchar code DSP_CODE[]={

  0xC0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff,0xbf,0xb7,0x9c,0xc6,0x92,0x86,0x87};

  // 0 1 2 3 4 5 6 7 8 9 空 - = o C S E t

  // 0 5 10 15

  void DelayMS(uint ms) //毫秒延时

  {

  uchar t;

  while(ms--){

  for(t=120;t》0;t--);

  }

  }

  void DelayUS(uint us) //微秒延时

  {

  uchar t;

  for(t=us;t》0;t--);

  }

  void WriteData(uchar x,y) // 单字节写子程序

  {
8位数码管显示的电子时钟

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

评论(1)
发评论
怪兽跑啊跑 2018-05-13
0 回复 举报
protues打开不了,写不进程序 1条回复 收起回复
不忘初心23333 0
头文件尖括号打错了

下载排行榜

全部1条评论

快来发表一下你的评论吧 !