新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 8X8點陣原理及驅動

8X8點陣原理及驅動

作者: 時間:2016-11-25 來源:網絡 收藏

與8*8LED連接如下:
顯示0~59
C語言代碼:
#include
#define uchar unsigned char
#define uint unsigned int

void Ser_IN(uchar Data)
{
uchar i;
for(i=0;i<8;i++)
{
SH_CP=0; //先置為低
DS=Data&0x80;//取數據的最高位
Data<<=1; //講數據的次高位移到最高位,為下一次取數據做準備
SH_CP=1; // 再置為高,產生移位時鐘上升沿,儲存器里的數據移位,數據輸入
}
}

void Par_OUT(void)
{
ST_CP=0;//先置為低
ST_CP=1;//再置為高,產生時鐘上升沿,上升沿時,數據并行輸出
}

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},
};
uint timecount;
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;
}
}
}

上一頁 1 2 下一頁

關鍵詞: 8X8點陣原理驅

評論


技術專區(qū)

關閉