单片机学习小组
直播中

山中老虎

8年用户 897经验值
擅长:制造/封装
私信 关注

新手求助怎样才能让8位共阳数码管滚动显示单个数字呢

新手求助怎样才能让8位共阳数码管滚动显示单个数字呢?如何去实现呢?

回帖(1)

宋文剑

2022-2-23 11:15:08
8位共阳数码管滚动显示单个数字

代码:

#include
#include
#define uchar unsigned char
#define uint unsigned int

uchar code DSY_CODE[]=
{
        0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90
};

void DelayMS(uint x)
{
        uchar i;
        while(x--)
        {
                 for(i=200;i>0;i--);
        }
}

void main()
{
        uchar i,k=0x80;
        while(1)
        {
                 for(i=8;i>0;i--)
                {
                         P2=0xff;
                        k=_crol_(k,1);
                        P0=DSY_CODE[8-i];
                        P2=k;
                        DelayMS(3);
                }
        }
}


硬件连接:
举报

更多回帖

发帖
×
20
完善资料,
赚取积分