标题:
51单片机LED矩阵显示滚动ILOVEU
[打印本页]
作者:
LuminLyon
时间:
2023-5-25 19:38
标题:
51单片机LED矩阵显示滚动ILOVEU
效果图如上,仅供大家学习参考。
附代码:
#include <REGX51.H>
Iloveu[24+8+8]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xC3,0xFF,0X99,0x00,0x00,0x00,0x81,0xC3,0xE7,
0xFF,0xBD,0xBD,0xBD,0xBD,0xBD,0xBD,0xC9, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
void delay(unsigned char);
void delay2();
void show(unsigned char);
unsigned char position=0;
void main(void)
{
for(;;)
{
for(position=0;position<16+8+8;position++)
{
delay2();
}
}
}
void delay(unsigned char time)
{
unsigned char i;
unsigned int j;
for(i=0;i<time;i++)
for(j=0;j<1000;j++)
;
}
void delay2()
{
unsigned char i;
for(i=0;i<5;i++)
show(position);
}
void show(unsigned char position)
{
unsigned char i;
for(i=0;i<8;i++)
{
P0 = Iloveu[i+position];
P2 = 0x80>>i;
delay(1);
P2 = 0;
}
}
下载.png
(39.3 KB, 下载次数: 60)
下载附件
2023-5-25 19:40 上传
下载 (1).png
(32.18 KB, 下载次数: 57)
下载附件
2023-5-25 19:40 上传
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1