仿真原理图如下(proteus仿真工程文件可到本帖附件中下载) |
#include<reg51.h>
#define uchar unsigned char
#define unit unsigned int
#define out0 P0
#define out2 P2
#define out1 P1
void delay(unit j)
{
uchar i=250;
for(;j>0;j--)
{
while(--i);
i=100;
}
}
uchar code string[]={
0xC3,0xBD,0xBD,0xBD,0xBD,0xBD,0xBD,0xC3
0xEF,0x8F,0xEF,0xEF,0xEF,0xEF,0xEF,0x01
0xC3,0xBD,0xBD,0xFB,0xF7,0xEF,0xDF,0x81
0xC3,0xBD,0xFD,0xE1,0xE3,0xFD,0xBD,0xC3
0xF7,0xE7,0xD7,0xB7,0x77,0x01,0xF7,0xF7
0xC1,0xDF,0xDF,0xC3,0xFD,0xFD,0xBD,0xC3
0xC3,0xBF,0xBF,0x83,0xBD,0xBD,0xBD,0xC3
0x81,0xBD,0xFB,0xF7,0xEF,0xEF,0xEF,0xEF
0xC3,0xBD,0xBD,0xC3,0xC3,0xBD,0xBD,0xC3
0xC3,0xBD,0xBD,0xBD,0xC1,0xFD,0xFD,0xC3
}
void main()
{
uchar i,j,n;
while(1)
{
for(j=0;j<10;j++)
{
for(n=0;n<100;n++)
{
for(i=0;i<8;i++)
{
out1=i%8;
out0=string[i*2+j*32];
delay(4);
out0=0xff;
out2=0xff;
}
}
}
}
}
|