51单片机LED 8*8点阵屏显示动画

时间:2025-03-07 10:34:05

通过设置变量,让LED点阵屏一帧一帧的显示,对于显示字的数组,用文字取模软件提取

文件

#include <>
#include ""
#include ""

//不加code是存放在RAM中,加code是存放在Flash中,Flash中空间更大,只读不写
unsigned char code Animation[]={
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0xFF,0x10,0x10,0x10,0xFF,0x00,0x00,0x1C,
	    0x2A,0x2A,0x1A,0x00,0x00,0xFE,0x01,0x01,
        0x01,0x02,0x00,0x00,0xFE,0x01,0x01,0x01,
	    0x02,0x00,0x1C,0x22,0x22,0x1C,0x00,0xFD,
		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

void main()
{
	unsigned char i,Offset=0,Count=0;
  MatixLED_Init();
	while(1)
	{
			for(i=0;i<8;i++)
			{
				MatrixLED_ShowColumn(i,Animation[i+Offset]);
			}
			Count++;
			if(Count>10)
			{
				Count=0;
				Offset++;
				if(Offset>40)//
				{
					Offset=0;
				}
			}
//			MatrixLED_ShowColumn(0,Animation[0]);
//			MatrixLED_ShowColumn(1,Animation[1]);
//			MatrixLED_ShowColumn(2,Animation[2]);
//			MatrixLED_ShowColumn(3,Animation[3]);
//			MatrixLED_ShowColumn(4,Animation[4]);
//			MatrixLED_ShowColumn(5,Animation[5]);
//			MatrixLED_ShowColumn(6,Animation[6]);
//			MatrixLED_ShowColumn(7,Animation[7]);
	}
}