微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机8×8LED点阵显示数字与字符

51单片机8×8LED点阵显示数字与字符

时间:11-28 来源:互联网 点击:
#include "AT89X52.H"

unsigned charcode tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};

unsigned charcode digittab[][8]={

{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//" ",0*/

{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//" ",0*/

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF},//"_",0*/

{0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF},//"_",0*/

{0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF},//"_",0*/

{0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF},//"_",0*/

{0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF},//"_",0*/

{0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//"_",0*/

{0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//"_",0*/

{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//"_",0*/

{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},//"|",0*/

{0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02},//"|",0*/

{0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04},//"|",0*/

{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},//"|",0*/

{0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10},//"|",0*/

{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20},//"|",0*/

{0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40},//"|",0*/

{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80},//"|",0*/

{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF},//" ",0*/

//图形1

{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00},//"未命名文件",0*/

{0x00,0x00,0x3C,0x24,0x24,0x3C,0x00,0x00},//"未命名文件",0*/

{0x00,0x7E,0x42,0x42,0x42,0x42,0x7E,0x00},//"未命名文件",0*/

{0xFF,0x81,0x81,0x81,0x81,0x81,0x81,0xFF},//"未命名文件",0*/

//图形2

{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00},

{0x00,0x00,0x24,0x18,0x18,0x24,0x00,0x00},

{0x00,0x42,0x24,0x18,0x18,0x24,0x42,0x00},

{0x81,0x42,0x24,0x18,0x18,0x24,0x42,0x81},

//图形3

{0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00},

{0x00,0x00,0x24,0x18,0x18,0x24,0x00,0x00},

{0x00,0x10,0x24,0x1A,0x58,0x24,0x08,0x00},

{0x08,0x10,0x24,0x9A,0x59,0x24,0x08,0x10},

{0x0C,0x10,0xA4,0x9A,0x59,0x25,0x08,0x30},

{0x0E,0x90,0xA4,0x9A,0x59,0x25,0x09,0x70},

{0x8F,0x90,0xA4,0x9A,0x59,0x25,0x09,0xF1},

{0x0C,0x12,0x12,0x12,0x12,0x12,0x0C,0x00},

{0x04,0x06,0x04,0x04,0x04,0x04,0x0E,0x00},

{0x0C,0x12,0x10,0x08,0x04,0x02,0x1E,0x00},

{0x0C,0x12,0x10,0x0C,0x10,0x12,0x0C,0x00},

{0x08,0x0C,0x0C,0x0A,0x0A,0x1E,0x08,0x00},

{0x1E,0x02,0x02,0x0E,0x10,0x10,0x0E,0x00},

{0x0C,0x12,0x02,0x0E,0x12,0x12,0x0C,0x00},

{0x1E,0x12,0x10,0x08,0x04,0x04,0x04,0x00},

{0x0C,0x12,0x12,0x0C,0x12,0x12,0x0C,0x00},

{0x0C,0x12,0x12,0x1C,0x10,0x12,0x0C,0x00},

{0x0C,0x12,0x12,0x12,0x1E,0x12,0x12,0x00},

{0x0E,0x12,0x12,0x0E,0x12,0x12,0x0E,0x00},

{0x0C,0x12,0x02,0x02,0x02,0x12,0x0C,0x00},

{0x0E,0x12,0x12,0x12,0x12,0x12,0x0E,0x00},

{0x1E,0x02,0x02,0x0E,0x02,0x02,0x1E,0x00},

{0x1E,0x02,0x02,0x0E,0x02,0x02,0x02,0x00},

{0x0C,0x12,0x02,0x1A,0x12,0x12,0x0C,0x00},

{0x12,0x12,0x12,0x1E,0x12,0x12,0x12,0x00},

{0x0E,0x04,0x04,0x04,0x04,0x04,0x0E,0x00},

{0x10,0x10,0x10,0x10,0x12,0x12,0x0C,0x00},

{0x12,0x12,0x0A,0x06,0x0A,0x12,0x12,0x00},

{0x02,0x02,0x02,0x02,0x02,0x02,0x1E,0x00},

{0x12,0x1E,0x1E,0x12,0x12,0x12,0x12,0x00},

{0x12,0x16,0x16,0x1A,0x1A,0x12,0x12,0x00},

{0x1E,0x12,0x12,0x12,0x12,0x12,0x1E,0x00},

{0x0E,0x12,0x12,0x0E,0x02,0x02,0x02,0x00},

{0x0C,0x12,0x12,0x12,0x16,0x1A,0x1C,0x00},

{0x0E,0x12,0x12,0x0E,0x06,0x0A,0x12,0x00},

{0x0C,0x12,0x02,0x0C,0x10,0x12,0x0C,0x00},

{0x1E,0x04,0x04,0x04,0x04,0x04,0x04,0x00},

{0x12,0x12,0x12,0x12,0x12,0x12,0x0C,0x00},

{0x12,0x12,0x12,0x12,0x0C,0x0C,0x0C,0x00},

{0x12,0x12,0x12,0x12,0x1E,0x1E,0x12,0x00},

{0x12,0x12,0x0C,0x0C,0x0C,0x12,0x12,0x00},

{0x11,0x11,0x0A,0x04,0x04,0x04,0x04,0x00},

{0x1E,0x10,0x08,0x0C,0x04,0x02,0x1E,0x00},

};

unsignedinttimecount;

unsignedcharcnta;

unsignedcharcntb;

voidmain(void)

{

TMOD=0x01;

TH0=(65536-3000)/256;

TL0=(65536-3000)%6;

TR0=1;

ET0=1;

EA=1;

while(1)

{;

}

}

voidt0(void) interrupt 1using0

{

TH0=(65536-2000)/256;

TL0=(65536-2000)%6;

P1=0XFF;//消除显示重影问题

P0=~digittab[

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top