#include"reg51.h"
#define uchar unsigned char
#define uint unsigned int
#define out0 P0
#define out1 P1
#define out2 P2
uchar code table[] = {0x00,0x08,0x7F,0xFC,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x08,0x7F,0xFC,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0xFF,0xFE,0x00,0x00,
0x08,0x10,0x08,0x10,0x09,0x18,0xFF,0x94,0x08,0x10,0x09,0x14,0x7F,0xFE,0x55,0x10,
0x55,0x10,0x7F,0x10,0x49,0x28,0x7F,0x28,0x49,0x28,0x49,0x44,0x43,0x44,0x41,0x82,
0x3F,0xF8,0x04,0x00,0x08,0x10,0x1F,0xF8,0x28,0x10,0x48,0x10,0x8F,0xF0,0x04,0x04,
0xFE,0xFE,0x10,0x20,0x20,0x44,0x7E,0xFE,0xA3,0x44,0x22,0x44,0x3E,0x7C,0x20,0x40,
};
uchar code str[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,};
uchar code table1[]={
0x08,0x20,0x08,0x24,0xFF,0xFE,0x08,0x20,0x20,0x40,0x7C,0x28,0x45,0xFC,0x44,0x88,
0x7C,0x50,0x43,0xFE,0x7C,0x20,0x44,0x28,0x45,0xFC,0x7C,0x20,0x40,0x20,0x00,0x20};
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=120;j>0;j--);
}
void delay(uint j)
{
uchar i=250;
for(;j>0;j--)
{
while(--i);
i=100;
}
}
void main()
{
uint i,j,n;
while(1)
{
for(j=0;j<3;j++)
{
for(n=0;n<40;n++)
{
for(i=0;i<16;i++)
{
out1=str[i%16]; //选择行
out0=table[i*2+j*32];
out2=table[i*2+1+j*32];
delay(4);
out0=0x00;
out2=0x00;
}
}
}
}
}
|