|
效果圖如上,僅供大家學(xué)習(xí)參考。
附代碼:
#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;
}
}
|
|