新闻中心

EEPW首页>嵌入式系统>设计应用> 单片机试验8X8 LED点阵显示技术

单片机试验8X8 LED点阵显示技术

作者: 时间:2013-04-02 来源:网络 收藏

6 C语言源程序

#include AT89X52.H>

unsigned char code taba[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};

unsigned char code tabb[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};

void delay(void)

{

unsigned char i,j;

for(i=10;i>0;i--)

for(j=248;j>0;j--);

}

void delay1(void)

{

unsigned char i,j,k;

for(k=10;k>0;k--)

for(i=20;i>0;i--)

for(j=248;j>0;j--);

}

void main(void)

{

unsigned char i,j;

while(1)

{

for(j=0;j3;j++)  //from left to right 3 time

{

for(i=0;i8;i++)

{

P3=taba[i];

P1=0xff;

delay1();

}

}

for(j=0;j3;j++)  //from right to left 3 time

{

for(i=0;i8;i++)

{

P3=taba[7-i];

P1=0xff;

delay1();

}

}

for(j=0;j3;j++)  //from top to bottom 3 time

{

for(i=0;i8;i++)

{

P3=0x00;

P1=tabb[7-i];

delay1();

}

}

for(j=0;j3;j++)  //from bottom to top 3 time

{

for(i=0;i8;i++)

{

P3=0x00;

P1=tabb[i];

delay1();

}

}

}

}


上一页 1 2 3 下一页

评论


相关推荐

技术专区

关闭