8X8點陣原理及驅動
與8*8LED連接如下:
顯示0~59
C語言代碼:
#include
#define uchar unsigned char
#define uint unsigned int
void Ser_IN(uchar Data)
{
}
void Par_OUT(void)
{
}
uchar code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; //列
uchar code tabdigit[60][8]={ //字模取模方向 陰碼 逆向逐列式
{0x00,0x3E,0x41,0x41,0x3E,0x00,0x00,0x00},
{0x00,0x42,0x7F,0x40,0x00,0x00,0x00,0x00},
{0x00,0x62,0x51,0x49,0x46,0x00,0x00,0x00},
{0x00,0x22,0x49,0x49,0x36,0x00,0x00,0x00},
{0x00,0x38,0x26,0x7F,0x20,0x00,0x00,0x00},
{0x00,0x4F,0x49,0x49,0x31,0x00,0x00,0x00},
{0x00,0x3E,0x49,0x49,0x32,0x00,0x00,0x00},
{0x00,0x03,0x71,0x09,0x07,0x00,0x00,0x00},
{0x00,0x36,0x49,0x49,0x36,0x00,0x00,0x00},
{0x00,0x26,0x49,0x49,0x3E,0x00,0x00,0x00},
{0x02,0xFF,0x00,0x00,0xFF,0x81,0xFF,0x00},
{0x02,0xFF,0x00,0x02,0xFF,0x00,0x00,0x00},
{0x02,0xFF,0x00,0xF3,0x91,0x99,0xCF,0x00},
{0x02,0xFF,0x00,0x42,0x89,0x89,0x89,0x76},
{0x02,0xFF,0x00,0x1C,0x13,0x10,0xFF,0x10},
{0x02,0xFF,0x00,0x4F,0x89,0x89,0x89,0x71},
{0x02,0xFF,0x00,0x7C,0x92,0x91,0x91,0x60},
{0x02,0xFF,0x00,0x01,0xF9,0x05,0x03,0x00},
{0x02,0xFF,0x00,0x76,0x89,0x89,0x89,0x76},
{0x02,0xFF,0x00,0x4E,0x91,0x91,0x91,0x7E},
{0xE2,0x91,0x89,0x86,0x00,0xFF,0x81,0xFF},
{0xE2,0x91,0x89,0x86,0x00,0x02,0xFF,0x00},
{0x79,0x49,0x4F,0x00,0x7A,0x4A,0x4E,0x00},
{0x79,0x49,0x4F,0x00,0x49,0x49,0x49,0x36},
{0x79,0x49,0x4F,0x00,0x1E,0x10,0xFF,0x10},
{0x79,0x49,0x4F,0x00,0x4E,0x4A,0x7A,0x00},
{0x79,0x49,0x4F,0x00,0xFE,0x92,0x92,0x60},
{0x79,0x49,0x4F,0x00,0x79,0x05,0x03,0x00},
{0x79,0x49,0x4F,0x00,0x76,0x89,0x89,0x76},
{0x79,0x49,0x4F,0x00,0x4E,0x91,0x91,0x7E},
{0x42,0x89,0x89,0x76,0x00,0xFE,0x82,0xFE},
{0x42,0x89,0x89,0x76,0x00,0x02,0xFF,0x00},
{0x42,0x89,0x89,0x76,0x00,0xF9,0x89,0x8F},
{0x42,0x89,0x89,0x76,0x00,0x89,0x89,0xFF},
{0x42,0x89,0x89,0x76,0x00,0x0F,0x08,0xFF},
{0x42,0x89,0x89,0x76,0x00,0x9E,0x92,0xF2},
{0x42,0x89,0x89,0x76,0x00,0xFF,0x89,0xF9},
{0x42,0x89,0x89,0x76,0x01,0x01,0xFD,0x03},
{0x42,0x89,0x89,0x76,0x00,0xFF,0x89,0xFF},
{0x42,0x89,0x89,0x76,0x00,0xCF,0x89,0xFF},
{0x1F,0x10,0xFF,0x00,0x7E,0x81,0x81,0x7E},
{0x1F,0x10,0xFF,0x00,0x02,0xFF,0x00,0x00},
{0x1F,0x10,0xFF,0x00,0xE2,0x91,0x89,0xC6},
{0x1F,0x10,0xFF,0x00,0x42,0x89,0x89,0x76},
{0x1F,0x10,0xFF,0x00,0x1E,0x10,0xFF,0x10},
{0x1F,0x10,0xFF,0x00,0x8F,0x89,0x89,0xF9},
{0x1F,0x10,0xFF,0x00,0xFF,0x89,0x89,0xF9},
{0x1F,0x10,0xFF,0x00,0x03,0xF9,0x05,0x03},
{0x0F,0x08,0xFF,0x00,0x76,0x89,0x89,0x76},
{0x1F,0x10,0xFF,0x00,0x4E,0x91,0x91,0x7E},
{0x4F,0x49,0x79,0x00,0x3E,0x41,0x41,0x3E},
{0x4F,0x49,0x79,0x00,0x00,0x02,0x7F,0x00},
{0x4F,0x49,0x79,0x00,0x62,0x51,0x49,0x46},
{0x4F,0x49,0x79,0x00,0x42,0x89,0x89,0x76},
{0x4F,0x49,0x79,0x00,0x1E,0x10,0x7E,0x10},
{0x4F,0x49,0x79,0x00,0x4F,0x49,0x79,0x00},
{0x4F,0x49,0x79,0x00,0x7F,0x49,0x79,0x00},
{0x4F,0x49,0x79,0x00,0x01,0x7D,0x03,0x01},
{0x4F,0x49,0x79,0x00,0x76,0x89,0x89,0x76},
{0x4F,0x49,0x79,0x00,0x0E,0x91,0x91,0x7E},
};
uchar code tabdigit[60][8]={
{0x00,0x3E,0x41,0x41,0x3E,0x00,0x00,0x00},
{0x00,0x42,0x7F,0x40,0x00,0x00,0x00,0x00},
{0x00,0x62,0x51,0x49,0x46,0x00,0x00,0x00},
{0x00,0x22,0x49,0x49,0x36,0x00,0x00,0x00},
{0x00,0x38,0x26,0x7F,0x20,0x00,0x00,0x00},
{0x00,0x4F,0x49,0x49,0x31,0x00,0x00,0x00},
{0x00,0x3E,0x49,0x49,0x32,0x00,0x00,0x00},
{0x00,0x03,0x71,0x09,0x07,0x00,0x00,0x00},
{0x00,0x36,0x49,0x49,0x36,0x00,0x00,0x00},
{0x00,0x26,0x49,0x49,0x3E,0x00,0x00,0x00},
{0x02,0xFF,0x00,0x00,0xFF,0x81,0xFF,0x00},
{0x02,0xFF,0x00,0x02,0xFF,0x00,0x00,0x00},
{0x02,0xFF,0x00,0xF3,0x91,0x99,0xCF,0x00},
{0x02,0xFF,0x00,0x42,0x89,0x89,0x89,0x76},
{0x02,0xFF,0x00,0x1C,0x13,0x10,0xFF,0x10},
{0x02,0xFF,0x00,0x4F,0x89,0x89,0x89,0x71},
{0x02,0xFF,0x00,0x7C,0x92,0x91,0x91,0x60},
{0x02,0xFF,0x00,0x01,0xF9,0x05,0x03,0x00},
{0x02,0xFF,0x00,0x76,0x89,0x89,0x89,0x76},
{0x02,0xFF,0x00,0x4E,0x91,0x91,0x91,0x7E},
{0xE2,0x91,0x89,0x86,0x00,0xFF,0x81,0xFF},
{0xE2,0x91,0x89,0x86,0x00,0x02,0xFF,0x00},
{0x79,0x49,0x4F,0x00,0x7A,0x4A,0x4E,0x00},
{0x79,0x49,0x4F,0x00,0x49,0x49,0x49,0x36},
{0x79,0x49,0x4F,0x00,0x1E,0x10,0xFF,0x10},
{0x79,0x49,0x4F,0x00,0x4E,0x4A,0x7A,0x00},
{0x79,0x49,0x4F,0x00,0xFE,0x92,0x92,0x60},
{0x79,0x49,0x4F,0x00,0x79,0x05,0x03,0x00},
{0x79,0x49,0x4F,0x00,0x76,0x89,0x89,0x76},
{0x79,0x49,0x4F,0x00,0x4E,0x91,0x91,0x7E},
{0x42,0x89,0x89,0x76,0x00,0xFE,0x82,0xFE},
{0x42,0x89,0x89,0x76,0x00,0x02,0xFF,0x00},
{0x42,0x89,0x89,0x76,0x00,0xF9,0x89,0x8F},
{0x42,0x89,0x89,0x76,0x00,0x89,0x89,0xFF},
{0x42,0x89,0x89,0x76,0x00,0x0F,0x08,0xFF},
{0x42,0x89,0x89,0x76,0x00,0x9E,0x92,0xF2},
{0x42,0x89,0x89,0x76,0x00,0xFF,0x89,0xF9},
{0x42,0x89,0x89,0x76,0x01,0x01,0xFD,0x03},
{0x42,0x89,0x89,0x76,0x00,0xFF,0x89,0xFF},
{0x42,0x89,0x89,0x76,0x00,0xCF,0x89,0xFF},
{0x1F,0x10,0xFF,0x00,0x7E,0x81,0x81,0x7E},
{0x1F,0x10,0xFF,0x00,0x02,0xFF,0x00,0x00},
{0x1F,0x10,0xFF,0x00,0xE2,0x91,0x89,0xC6},
{0x1F,0x10,0xFF,0x00,0x42,0x89,0x89,0x76},
{0x1F,0x10,0xFF,0x00,0x1E,0x10,0xFF,0x10},
{0x1F,0x10,0xFF,0x00,0x8F,0x89,0x89,0xF9},
{0x1F,0x10,0xFF,0x00,0xFF,0x89,0x89,0xF9},
{0x1F,0x10,0xFF,0x00,0x03,0xF9,0x05,0x03},
{0x0F,0x08,0xFF,0x00,0x76,0x89,0x89,0x76},
{0x1F,0x10,0xFF,0x00,0x4E,0x91,0x91,0x7E},
{0x4F,0x49,0x79,0x00,0x3E,0x41,0x41,0x3E},
{0x4F,0x49,0x79,0x00,0x00,0x02,0x7F,0x00},
{0x4F,0x49,0x79,0x00,0x62,0x51,0x49,0x46},
{0x4F,0x49,0x79,0x00,0x42,0x89,0x89,0x76},
{0x4F,0x49,0x79,0x00,0x1E,0x10,0x7E,0x10},
{0x4F,0x49,0x79,0x00,0x4F,0x49,0x79,0x00},
{0x4F,0x49,0x79,0x00,0x7F,0x49,0x79,0x00},
{0x4F,0x49,0x79,0x00,0x01,0x7D,0x03,0x01},
{0x4F,0x49,0x79,0x00,0x76,0x89,0x89,0x76},
{0x4F,0x49,0x79,0x00,0x0E,0x91,0x91,0x7E},
};
uint timecount;
uchar a;
uchar b;
uchar a;
uchar b;
void main(void)
{
TR0=0;
TMOD=0x01;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
EA=1;
ET0=1;
TR0=1;
while(1);
}
{
}
void t0(void) interrupt 1
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
Ser_IN(tab[a]); //8X8點陣列掃描
Ser_IN(tabdigit[b][a]);//送行掃描數據
Par_OUT(); //顯示
a++;
if(a==8)
{
a=0;
}
timecount++;
if(timecount==1000)
{
timecount=0;
b++;
if(b==60)
{
b=0;
}
}
}
{
}
關鍵詞:
8X8點陣原理驅
評論