基于51单片机Proteus的8X8led点阵心滚动

Posted perseverance52

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于51单片机Proteus的8X8led点阵心滚动相关的知识,希望对你有一定的参考价值。

基于51单片机Proteus的8X8led点阵心滚动


实例代码

# include <reg52.h>
#include<intrins.h>

typedef unsigned int u16;
typedef unsigned char u8;

sbit SER=P3^4; //p3.4串行数据输入   DS
sbit CLK=P3^5;//串行输入时钟,上升沿有效    SHCP	第11脚	数据输入时钟线
sbit SRCLK=P3^6;//串行寄存器时钟,上升沿有效  STCP	第12脚	输出存储器锁存时钟线

u8 code ledwidth[][8]= {
    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00},
    {0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30,0x00},
    {0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18,0x00},
    {0x00,0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18},
    {0x00,0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30},
    {0x00,0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60},

    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00},
    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00},
    {0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30,0x00},
    {0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18,0x00},
    {0x00,0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18},
    {0x00,0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30},
    {0x00,0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60},

    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00},
    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00},
    {0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30,0x00},
    {0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18,0x00},
    {0x00,0x18,0x3C,0x1E,0x0F,0x1E,0x3C,0x18},
    {0x00,0x30,0x78,0x3C,0x1E,0x3C,0x78,0x30},
    {0x00,0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60},

    {0x60,0xF0,0x78,0x3C,0x78,0xF0,0x60,0x00}
};

u16 ledlength[]= {0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};


void delay_ms(u16 i)
{
    while(i--);
}

void send(u8 n)
{
    u8 i;
    CLK=0;
    SRCLK=0;
    for(i=0; i<8; i++)
    {
        SER=n>>7;
        n<<=1;
        SRCLK=0;
        SRCLK=1;

    }
    CLK=1;
}

int main()
{
    u16 n,i,j=0;
    while(1)
    {
        for(i=0; i<100; i++)
        {
            for(n=0; n<8; n++)
            {

                P1=ledlength[n];
                send(ledwidth[j][n]);
                delay_ms(100);
                P1=0xff;
                send(0x00);

            }
        }
        j++;
        j%=21;
    }
    return 0;
}


注意事项

  • 首先确定8*8led点阵的阴极和阳极端。确定方法,可以参照我上面仿真图中上方的方式,我已经把Proteus里面不同颜色的led点阵模块的方向都已经列出来了,阴极端接单片机的IO口端,阳极端接74HC595端。

以上是关于基于51单片机Proteus的8X8led点阵心滚动的主要内容,如果未能解决你的问题,请参考以下文章

Proteus仿真8x8Led点阵数字循环显示

51单片机的16×16点阵屏广告牌的滚动显示proteus仿真(源码+仿真+电路图+报告)

Proteus仿真51单片机+16X16点阵显示

51单片机 16X16点阵动态显示+Proteus仿真

Proteus仿真51单片机8X8点阵贪吃蛇游戏演示

51单片机8×8LED点阵屏显示数字动态显示+ Proteus仿真