简易数字时钟

单片机实现简易数字时钟

#include <AT89X51.h>
#define uchar unsigned char
uchar num;
uha disp[8] = {1,2,3,4,5,6,7,8};

void display()
{
  uchar code dispcode[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x77,0x7C,0x39,0x5E,0x79,0x71};
  
  uchar i,j;
  for(i =0;i <8;i ++)
  {
    P2 =i;
    
    P0 =dispcode[disp[i]];
    for(j =250;j >0;j--);
    P0 =0;
  }
}
void main()
{
  while(1)
  {
    display();
    
    
  }
}

 

posted @ 2021-12-26 13:04  小kBlog  阅读(274)  评论(0编辑  收藏  举报