16*128 LED点阵屏C程序

发布者:真诚的友谊最新更新时间:2022-12-27 来源: zhihu关键字:LED点阵屏  C程序 手机看文章 扫描二维码
随时随地手机看文章

/*****************************************************

16*128 LED点阵屏 C 程序

******************************************************

声明:

本程序供大家学习之用,用勿用于商业用途。尊重版权。

编写:邓椿薪

时间:2006年1月20日 晚

邮箱:love2151@xinhuanet.com

*******************************************************

//595连级输出数据,138行驱动。P0_1为移动速度高速/*点阵显示汉字程串口输出字符数据,

//P2口输出行扫描信号,P2_7输出595锁存信号。*/


#include

#define uchar unsigned char

#define uint unsigned int

uchar yid,h; //YID为移动计数器,H为行段计数器。

uint zimuo; //字模计数器

uchar code hanzi[]; //汉字字模

uchar BUFF[18]; //缓存

void in_data(void); //调整数据

void rxd_data(void); //发送数据

void sbuf_out(); //16段扫描

unsigned code sw[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; /*16行段码*/


//{0x60,0x62,0x64,0x66,0x68,0x6a,0x6c,0x6e,

//0x70,0x72,0x74,0x76,0x78,0x7a,0x7c,0x7e}; /*16行段码*/

/********************************************/

void main(void)

{

uchar i,d=10;

yid=0;

zimuo=0;

while(1)

{

while(yid<16) //数据移位。

{

for(i=0;i{

sbuf_out();

}

yid++; //移动一步

}

yid=0;

zimuo=zimuo+32; //后移一个字,

if(zimuo>=3386) //总数减7个字。

zimuo=0;

}

}

/********************************/

void sbuf_out()

{

for(h=0;h<16;h++) //16行扫描

{

in_data(); //调整数据

rxd_data(); //串口发送数据

P1=0x7f; //关闭显示。

P1_7=1; //锁存为高,595锁存信号

P1=sw[h]; //送段码

}

}


/******************************************************/

void in_data(void)

{

char s;

for(s=8;s>=0;s--) //h为向后先择字节计数器,zimuoo为向后先字计数器

{

BUFF[2*s+1]=hanzi[zimuo+32*s+2*h]; //把第一个字模的第一个字节放入BUFF0中,第二个字模和第一个字节放入BUFF2中

BUFF[2*s]=hanzi[zimuo+1+32*s+2*h]; // 把第一个字模的第二个字节放入BUFF1中,第二个字模的第二个字节放入BUFF3中

}

}


/*******************************************************/

void rxd_data(void) //串行发送数据

{

char s;

uchar inc,tempyid,temp;

if(yid<8)

inc=0;

else

inc=1;

for(s=0+inc;s<16+inc;s++) //发送8字节数据

{

if(yid<8)

tempyid=yid;

else

tempyid=yid-8;

temp=(BUFF[s]>>tempyid)|(BUFF[s+1]<<(8-tempyid)); //h1左移tempyid位后和h2右移8-tempyid相或,取出移位后的数据。

//temp=255-temp;

SBUF=temp;//把BUFF中的字节从大到小移位相或后发送输出。

while(!TI);TI=0; //等待发送中断

}

}

/*******************************************************/

uchar code hanzi[]=

{

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

//=============================================================================

/*-- 调入了一幅图像:这是您新建的图像 --*/

/*-- 宽度x高度=16x16 --*/

0x00,0x00,0x38,0x3C,0x7E,0x7E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0x7F,0xFE,0x3F,0xFC,0x1F,0xF8,0x0F,0xF0,0x07,0xE0,0x03,0xC0,0x00,0x00,

/*-- 文字: 欢 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x01,0x00,0x01,0x00,0x01,0x3F,0x7F,0xA0,0x20,0xA1,0x12,0x52,0x02,0x14,0x02,0x08,

0x02,0x18,0x06,0x18,0x05,0x24,0x09,0x24,0x18,0x82,0x70,0x61,0x20,0x1C,0x00,0x00,


/*-- 文字: 迎 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x02,0x01,0x84,0x3E,0x6C,0x22,0x24,0x22,0x20,0x22,0x20,0x22,0x27,0x22,0x24,

0x22,0xA4,0x2A,0x64,0x12,0x24,0x02,0x04,0x02,0x04,0x00,0x0A,0x7F,0xF1,0x00,0x00,


/*-- 文字: 来 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x00,0x80,0x3F,0xFC,0x00,0x80,0x0C,0x90,0x04,0xA0,0x02,0xC0,0x7F,0xFE,

0x01,0x80,0x02,0xC0,0x04,0xA0,0x18,0x90,0x70,0x8C,0x20,0x83,0x00,0x80,0x00,0x80,


/*-- 文字: 到 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x20,0x00,0x21,0xFE,0x20,0x10,0x24,0x48,0x24,0x84,0x25,0xFE,0x24,0xA4,0x24,0x20,

0x24,0x20,0x25,0xFE,0x24,0x20,0x24,0x20,0x21,0xA0,0x20,0x70,0x28,0x0E,0x10,0x04,

/*-- 文字: 单 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x04,0x10,0x0C,0x60,0x02,0x20,0x1F,0xFC,0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,

0x1F,0xFC,0x10,0x84,0x00,0x80,0x7F,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,


/*-- 文字: 片 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x02,0x00,0x02,0x08,0x02,0x08,0x22,0x08,0x7F,0xF8,0x00,0x08,0x00,0x08,0x00,0x08,

0x0F,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x04,0x08,0x04,0x08,0x02,0x08,0x01,


/*-- 文字: 机 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x08,0x1F,0x08,0x11,0x08,0x11,0x7F,0x11,0x08,0x11,0x08,0x11,0x1C,0x11,0x2C,

0x11,0x2A,0x11,0x0A,0x10,0x89,0x50,0x88,0x50,0x48,0x50,0x48,0x60,0x28,0x00,0x08,


/*-- 文字: 爱 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x1F,0x00,0x09,0xFC,0x08,0x48,0x04,0x90,0x7F,0xFC,0x40,0x44,0x00,0x42,0x3F,0xFC,

0x00,0x20,0x0F,0xE0,0x04,0x30,0x02,0xD0,0x03,0x08,0x0C,0xC6,0x70,0x31,0x20,0x0C,


/*-- 文字: 好 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x08,0x3F,0x88,0x10,0x08,0x08,0x08,0x04,0x3F,0x04,0x24,0x04,0x24,0x7F,0xE4,

0x04,0x22,0x04,0x26,0x04,0x18,0x04,0x10,0x04,0x28,0x04,0x64,0x05,0x22,0x02,0x01,


/*-- 文字: 者 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x10,0x80,0x37,0xFC,0x08,0x80,0x04,0x80,0x7F,0xFE,0x01,0x00,0x00,0xC0,

0x1F,0xE0,0x10,0x38,0x10,0x27,0x1F,0xE0,0x10,0x20,0x10,0x20,0x1F,0xE0,0x10,0x20,


/*-- 文字: D --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x22,0x00,0x42,0x00,0x42,0x00,0x42,

0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x00,0x22,0x00,0x1F,0x00,0x00,0x00,0x00,


/*-- 文字: I --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,

0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3E,0x00,0x00,0x00,0x00,


/*-- 文字: Y --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x77,0x00,0x22,0x00,0x22,0x00,0x14,0x00,0x14,

0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x1C,0x00,0x00,0x00,0x00,


/*-- 文字: 网 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x3F,0xFE,0x20,0x02,0x20,0x82,0x28,0x8A,0x39,0x52,0x2A,0x22,0x24,0x22,

0x24,0x52,0x2A,0x52,0x29,0x8A,0x20,0x86,0x20,0x02,0x38,0x02,0x10,0x02,0x00,0x00,


/*-- 文字: 站 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x04,0x00,0x04,0x04,0x04,0x08,0x04,0x08,0x7C,0x7F,0x04,0x20,0x04,0x22,0x04,0x24,

0x3F,0x94,0x20,0x94,0x20,0x88,0x20,0xBC,0x20,0x83,0x3F,0x80,0x20,0x80,0x00,0x00,


/*-- 文字: 论 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x02,0x02,0x02,0x04,0x05,0x0C,0x09,0x04,0x10,0x80,0x60,0x40,0x20,0xA7,0x08,0x84,

0x1C,0x84,0x03,0x84,0x00,0x84,0x00,0xA4,0x20,0x94,0x20,0x8C,0x3F,0x04,0x00,0x00,


/*-- 文字: 坛 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x3F,0x88,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x3F,0x7F,0xC8,0x02,0x08,

0x06,0x08,0x01,0x08,0x11,0x38,0x20,0x8C,0x7E,0x43,0x63,0xE0,0x20,0x40,0x00,0x00,


/*-- 文字: , --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x08,0x00,0x04,0x00,0x00,


/*-- 文字: 这 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x01,0x00,0x06,0x02,0x02,0x0C,0x3F,0xE8,0x08,0x00,0x08,0x40,0x04,0x8F,0x05,0x08,

0x02,0x08,0x02,0x08,0x05,0x08,0x08,0x88,0x10,0x48,0x00,0x14,0x7F,0xE2,0x00,0x01,


/*-- 文字: 里 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x1F,0xFC,0x10,0x84,0x10,0x84,0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,0x1F,0xFC,

0x00,0x80,0x00,0x80,0x1F,0xFC,0x00,0x80,0x00,0x80,0x00,0x80,0x7F,0xFF,0x00,0x00,


/*-- 文字: 有 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x00,0x80,0x7F,0xFE,0x00,0x40,0x00,0x20,0x0F,0xF0,0x08,0x18,0x08,0x14,

0x0F,0xF2,0x08,0x11,0x08,0x10,0x0F,0xF0,0x08,0x10,0x09,0x10,0x0E,0x10,0x04,0x10,


/*-- 文字: 众 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x00,0x80,0x00,0x80,0x01,0x40,0x02,0x20,0x0C,0x10,0x70,0x0C,0x24,0x13,

0x04,0x10,0x04,0x10,0x04,0x10,0x0A,0x28,0x12,0x44,0x31,0x42,0x10,0x81,0x00,0x00,


/*-- 文字: 多 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x1F,0x80,0x10,0x40,0x08,0x20,0x04,0xD0,0x03,0x08,0x00,0xC0,0x01,0x30,

0x7F,0x8E,0x20,0x40,0x10,0xB0,0x09,0x0C,0x06,0x00,0x01,0x80,0x00,0x70,0x00,0x0E,


/*-- 文字: 的 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x01,0x08,0x01,0x08,0x01,0x04,0x3F,0x3E,0x20,0xA2,0x20,0xA2,0x20,0x62,0x21,0x3E,

0x22,0x22,0x26,0x22,0x24,0x22,0x20,0x22,0x20,0x3E,0x14,0x22,0x08,0x02,0x00,0x00,


/*-- 文字: 单 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x04,0x10,0x0C,0x60,0x02,0x20,0x1F,0xFC,0x10,0x84,0x1F,0xFC,0x10,0x84,0x10,0x84,

0x1F,0xFC,0x10,0x84,0x00,0x80,0x7F,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,


/*-- 文字: 片 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x02,0x00,0x02,0x08,0x02,0x08,0x22,0x08,0x7F,0xF8,0x00,0x08,0x00,0x08,0x00,0x08,

0x0F,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x04,0x08,0x04,0x08,0x02,0x08,0x01,


/*-- 文字: 机 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x08,0x1F,0x08,0x11,0x08,0x11,0x7F,0x11,0x08,0x11,0x08,0x11,0x1C,0x11,0x2C,

0x11,0x2A,0x11,0x0A,0x10,0x89,0x50,0x88,0x50,0x48,0x50,0x48,0x60,0x28,0x00,0x08,


/*-- 文字: 爱 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x1F,0x00,0x09,0xFC,0x08,0x48,0x04,0x90,0x7F,0xFC,0x40,0x44,0x00,0x42,0x3F,0xFC,

0x00,0x20,0x0F,0xE0,0x04,0x30,0x02,0xD0,0x03,0x08,0x0C,0xC6,0x70,0x31,0x20,0x0C,


/*-- 文字: 好 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x08,0x3F,0x88,0x10,0x08,0x08,0x08,0x04,0x3F,0x04,0x24,0x04,0x24,0x7F,0xE4,

0x04,0x22,0x04,0x26,0x04,0x18,0x04,0x10,0x04,0x28,0x04,0x64,0x05,0x22,0x02,0x01,


/*-- 文字: 者 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x10,0x80,0x37,0xFC,0x08,0x80,0x04,0x80,0x7F,0xFE,0x01,0x00,0x00,0xC0,

0x1F,0xE0,0x10,0x38,0x10,0x27,0x1F,0xE0,0x10,0x20,0x10,0x20,0x1F,0xE0,0x10,0x20,


/*-- 文字: 。 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x12,0x00,0x12,0x00,0x0C,0x00,0x00,0x00,0x00,


/*-- 文字: 来 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

0x00,0x80,0x00,0x80,0x3F,0xFC,0x00,0x80,0x0C,0x90,0x04,0xA0,0x02,0xC0,0x7F,0xFE,

0x01,0x80,0x02,0xC0,0x04,0xA0,0x18,0x90,0x70,0x8C,0x20,0x83,0x00,0x80,0x00,0x80,


/*-- 文字: 到 --*/

/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/

[1] [2] [3]
关键字:LED点阵屏  C程序 引用地址:16*128 LED点阵屏C程序

上一篇:TM1812的原控制程序
下一篇:16x16点阵显示 两种显示效果(移动+卷动)

小广播
设计资源 培训 开发板 精华推荐

最新单片机文章
  • 学习ARM开发(16)
    ARM有很多东西要学习,那么中断,就肯定是需要学习的东西。自从CPU引入中断以来,才真正地进入多任务系统工作,并且大大提高了工作效率。采 ...
  • 学习ARM开发(17)
    因为嵌入式系统里全部要使用中断的,那么我的S3C44B0怎么样中断流程呢?那我就需要了解整个流程了。要深入了解,最好的方法,就是去写程序 ...
  • 学习ARM开发(18)
    上一次已经了解ARM的中断处理过程,并且可以设置中断函数,那么它这样就可以工作了吗?答案是否定的。因为S3C44B0还有好几个寄存器是控制中 ...
  • 嵌入式系统调试仿真工具
    嵌入式硬件系统设计出来后就要进行调试,不管是硬件调试还是软件调试或者程序固化,都需要用到调试仿真工具。 随着处理器新品种、新 ...
  • 最近困扰在心中的一个小疑问终于解惑了~~
    最近在驱动方面一直在概念上不能很好的理解 有时候结合别人写的一点usb的例子能有点感觉,但是因为arm体系里面没有像单片机那样直接讲解引脚 ...
  • 学习ARM开发(1)
  • 学习ARM开发(2)
  • 学习ARM开发(4)
  • 学习ARM开发(6)
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved