找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1125|回复: 0
打印 上一主题 下一主题
收起左侧

动态数码管

[复制链接]
跳转到指定楼层
楼主
动态数码管,滚动显示日期!
#include<REGX51.h>
void main(void)
{
    const unsigned char design[17]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,
                           0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff};
unsigned char DisplayBuffer[24]={16,16,16,16,16,16,16,16,2,0,1,7,0,3,2,2,16,16,16,16,16,16,16,16};
unsigned int a;
unsigned char b;
unsigned char w;
unsigned char n;
unsigned char j;
    do{
     for(n=1;n<17;n++)
      {
    for(j=1;j<20;j++)
    {
       w=1;
   
     for(b=0;b<8;b++)
       {
      for(a=0;a<500;a++);      //延时一段时间
   P0=255;         //灭显示
   P2=~design[DisplayBuffer[b+n]];
   P0=~w;
      w=w<<1;    //逻辑左移
        }
     }
   }
      }while(1);
}

jj.jpg (88.94 KB, 下载次数: 18)

jj.jpg
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表