您的位置 首页 动态

8*8的点阵驱动程序

此程序为8*8的点阵驱动程序,用点阵的关键在于明白其每一个发光二极管亮的原理,本人往往将其看做二维坐标系来处理更为简单,可以说只要熟

此程序为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

{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);//此处决议详细扫描哪一字的
}
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/dongtai/257928.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部