刚来 也发点东西吧 呵呵 大家一起学习学习,关于LED点阵显示驱动!8X8显示程序。
#include <AT89X52.H>
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code digittab[64]={0x00,0x00,0x00,0x00,
0x4c,0x34,0x34,0xdc,0x4e,0x3c,0x44,0x8c,0x00, //欢
0x49,0x7a,0xbc,0xa2,0xfd,0xa4,0xbc,0x80,0x00, //迎
0x88,0x8a,0xfc,0x0f,0xfc,0x8b,0x88,0xc0,0x00, //光
0x38,0xfe,0xe8,0xa6,0xec,0xac,0xf4,0x00,0x00, //临
0x00,0x00,0x00 };
unsigned int timecount;
unsigned char cnta;
unsigned char n;
void main(void)
{
TMOD=0x01;
TH0=(65536-3000)/256;
TL0=(65536-3000)%256;
TR0=1;
ET0=1;
EA=1;
while(1)
{;
}
}
void t0(void) interrupt 1 using 0
{
TH0=(65536-3000)/256;
TL0=(65536-3000)%256;
P2=tab[cnta];
P0=digittab[cnta+n];
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==100)
{
timecount=0;
n++;
if(n>42)
{
n=0;
}
}
}