新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 8*8的点阵驱动程序

8*8的点阵驱动程序

作者:时间:2016-11-26来源:网络收藏
此程序为8*8点阵驱动程序,用点阵的关键在于明白其每一个发光二极管亮的原理,本人往往将其看做二维坐标系来处理更为简单,可以说只要熟练应用数组并明白其原理就可以按自己的要求驱动了!!

#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://www.eepw.com.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;//开启定时0
ET0=1;
EA=1;//开启中断
while(1)
{
;
}
}
void t0(void) interrupt 1 using 0
{

TH0=(65536-3000)/256;//定时器高位装载数据
TL0=(65536-3000)%6;//定时器低位装载数据
P2=0xff;
P0=nero[sao][hse];
P1=se[hse];
if(++hse>8)//此处负责扫描每一个字,通过定时count与中断来决定此次扫描所持续的时间
hse=0;
if(++count>333)
{
count=0;
sao=(++sao);//此处决定具体扫描哪一字的
}
}



关键词: 8*8点阵驱

评论


相关推荐

技术专区

关闭