首先是main.c内容:

include <REGX52.H>

include "delay.h"

include "matrix.h"

unsigned char code donghua[]=
{
0x18,0x18,0x3D,0x5A,0x98,0x28,0x28,0x28,
0x5A,0x5A,0x3C,0x18,0x18,0x28,0x18,0x08,
0x30,0x18,0x3C,0x1C,0x18,0x18,0x18,0x08,
0x30,0x98,0x7C,0x18,0x18,0x28,0x18,0x08,
0x10,0x18,0x3C,0x3C,0x18,0x28,0x28,0x08,
0x30,0x18,0x3C,0x3C,0x18,0x24,0x24,0x44,
0x30,0x18,0x3C,0x38,0x18,0x28,0x24,0x44,

0x18,0x0C,0x1E,0x1C,0x0C,0x14,0x24,0x44,
0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,
0x00,0xC0,0x60,0xF0,0xF0,0x30,0x48,0x44,

0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,

0x18,0x0C,0x1E,0x1C,0x0C,0x14,0x24,0x44,
0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,
0x00,0xC0,0x60,0xF0,0xF0,0x30,0x48,0x44,

0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,

0x18,0x0C,0x1E,0x1C,0x0C,0x14,0x24,0x44,
0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,
0x00,0xC0,0x60,0xF0,0xF0,0x30,0x48,0x44,

0x00,0x30,0x18,0x3C,0x1C,0x38,0x28,0x44,
0x18,0x0C,0x1E,0x1C,0x0C,0x14,0x24,0x44,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
};

int main()
{

unsigned char i,offset,count=0;
void matrix_init();
while(1)
{
    for(i=0;i<8;i++)
    {
        matrix_showcol(i,donghua[i+offset]);
    }
    count++;
    if(count>40)
    {
        count=0;
        offset+=8;
        if(offset>160)
        {offset=0;}
    }
}

}
其次是delay.h内容:
void delay(unsigned int xms)
{

while(xms)
{
        unsigned char x,y,z;

x=1;
y=2;
z=2;
do
    {
        do
        {
            while(--z);
        }
        while(--y);
    }
    while(--x);
xms=xms-1;}    

}
附带的delay.c内容:

ifndef delay_h

define delay_h

void delay(unsigned int xms);

endif

推荐文章

07_字符串格式化

"""class_num = 20avg_salary...

《葬送的芙莉莲》

几十年寿命的人类爱上几千年寿命的精灵,会有什么结果。 ...

评论区(暂无评论)

我要评论

昵称
邮箱
网址
0/200
没有评论
可按 ESC 键退出搜索

0 篇文章已搜寻到~