新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 8*8的點(diǎn)陣驅(qū)動(dòng)程序

8*8的點(diǎn)陣驅(qū)動(dòng)程序

作者: 時(shí)間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
此程序?yàn)?strong>8*8的點(diǎn)陣驅(qū)動(dòng)程序,用點(diǎn)陣的關(guān)鍵在于明白其每一個(gè)發(fā)光二極管亮的原理,本人往往將其看做二維坐標(biāo)系來處理更為簡(jiǎn)單,可以說只要熟練應(yīng)用數(shù)組并明白其原理就可以按自己的要求驅(qū)動(dòng)了!!

#include
#define uncharunsigned char
#define uint unsigned int
unchar code se[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unchar code nero[18][8]={
{0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00}, //0

本文引用地址:http://m.butianyuan.cn/article/201611/321645.htm

{0x00,0x00,0x00,0x00,0x21,0x7f,0x01,0x00}, //1

{0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00}, //2

{0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00}, //3

{0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00}, //4

{0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00}, //5

{0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00}, //6

{0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00}, //7

{0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00}, //8

{0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}, //9

{0x00,0x00,0x7F,0x48,0x48,0x30,0x00,0x00}, //P

{0x00,0x00,0x7F,0x48,0x4C,0x73,0x00,0x00}, //R

{0x00,0x00,0x7F,0x49,0x49,0x49,0x00,0x00}, //E

{0x00,0x00,0x3E,0x41,0x41,0x62,0x00,0x00}, //C

{0x00,0x00,0x7F,0x08,0x08,0x7F,0x00,0x00}, //H

{0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00}, //I

{0x00,0x7F,0x10,0x08,0x04,0x7F,0x00,0x00}, //N

{0x7C,0x48,0x48,0xFF,0x48,0x48,0x7C,0x00}//中

};
unchar hse=0,sao=0;
uint count;
void main(void)
{
TMOD=0x01;
TH0=(65536-3000)/256;
TL0=(65536-3000)%6;
TR0=1;//開啟定時(shí)0
ET0=1;
EA=1;//開啟中斷
while(1)
{
;
}
}
void t0(void) interrupt 1 using 0
{

TH0=(65536-3000)/256;//定時(shí)器高位裝載數(shù)據(jù)
TL0=(65536-3000)%6;//定時(shí)器低位裝載數(shù)據(jù)
P2=0xff;
P0=nero[sao][hse];
P1=se[hse];
if(++hse>8)//此處負(fù)責(zé)掃描每一個(gè)字,通過定時(shí)count與中斷來決定此次掃描所持續(xù)的時(shí)間
hse=0;
if(++count>333)
{
count=0;
sao=(++sao);//此處決定具體掃描哪一字的
}
}



關(guān)鍵詞: 8*8點(diǎn)陣驅(qū)

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉