第2个回答 2011-11-30
粘贴不了图片,宏定义里看得出来硬件电路。
#include <reg51.h>
#define uint unsigned int
#define uchar unsigned char
#define l1 P0
#define l2 P2
#define r1 P3
#define r2 P1
uchar ln=0x01;
bit l1_2=0;
uchar code tab[]=
{
// 应(0) 用(1) 电(2) 子(3) 技(4) 术(5)
0x00,0x40,0x00,0x78,0xFC,0x3F,0xFC,0x27,0xC4,0x20,0x84,0x2F,0x14,0x2F,0x35,0x24,
0xE7,0x23,0xC6,0x33,0x84,0x3C,0x04,0x2F,0xE4,0x23,0xE4,0x20,0x44,0x20,0x00,0x20, /*应*/
0x00,0x80,0x00,0xC0,0x00,0x70,0xFE,0x3F,0xFE,0x0F,0x22,0x02,0x22,0x02,0x22,0x02,
0xFE,0xFF,0xFE,0xFF,0x22,0x02,0x22,0x42,0x22,0xC2,0xFE,0xFF,0xFE,0x7F,0x00,0x00, /*用*/
0x00,0x00,0x00,0x00,0xF8,0x0F,0xF8,0x0F,0x48,0x04,0x48,0x04,0x48,0x04,0xFF,0x3F,
0xFF,0x7F,0x48,0x44,0x48,0x44,0x48,0x44,0xF8,0x4F,0xF8,0x4F,0x00,0x70,0x00,0x70, /*电*/
0x00,0x01,0x00,0x01,0x02,0x01,0x02,0x01,0x02,0x01,0x02,0x41,0x02,0xC1,0xE2,0xFF,
0xF2,0x7F,0x1A,0x01,0x0E,0x01,0x06,0x01,0x02,0x01,0x80,0x01,0x80,0x01,0x00,0x01, /*子*/
0x08,0x01,0x08,0x41,0x88,0xC1,0xFF,0xFF,0xFF,0x7F,0x68,0x40,0x2,0x40,0xC8,0x60,
0xC8,0x33,0x48,0x1F,0x7F,0x0C,0x7F,0x1E,0xC8,0x33,0xC8,0x61,0x48,0x60,0x08,0x20, /*技*/
0x10,0x10,0x10,0x10,0x10,0x18,0x10,0x0C,0x10,0x06,0x90,0x03,0xD0,0x01,0xFF,0x7F,
0xFF,0x7F,0xD0,0x00,0x92,0x01,0x16,0x07,0x14,0x0E,0x10,0x1C,0x10,0x18,0x10,0x08, /*术*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/////////////////////////////////////////////////////
void delay()
{
uchar br1,br2;
for(br1=0;br1<120;br1++)
for(br2=0;br2<5;br2++);
}
////////////////////////////////////////////////////////
void lnf()
{
if(!l1_2) l1=ln;else l2=ln;
ln<<=1;
if(ln==0)
{
l1_2=~l1_2;
ln=0x01;
}
}
///////////////////////////////////////////////////////////
/*********************************************************/
void main()
{
uchar i,j,k,rx1;
l1=0;
l2=0;
r1=0;
r2=0;
while(1)
{
for(k=0;k<111;k++)
{
for(j=0;j<4;j++)
{
for(i=0;i<16;i++)
{
lnf();
rx1=2*(i+k);
if(rx1>221)rx1=rx1-222;
r1=~tab[rx1 ];
r2=~tab[rx1+1];
delay();
}
l1=0;
l2=0;
}
}
}
}