/*****************************************************
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 --*/
上一篇:TM1812的原控制程序
下一篇:16x16点阵显示 两种显示效果(移动+卷动)
设计资源 培训 开发板 精华推荐
- LTC3525-3.3,锂离子至 5V 转换器提供 175mA 的负载电流,纹波小于 0.5%
- LTC1155 的典型应用 - 双路高端微功率 MOSFET 驱动器
- LTC4096/LTC4096X 的典型应用 - 双输入独立锂离子电池充电器
- 基于SB628的可调升压电路
- DC1814A-D,使用 LTC4274A-4、90W 单路 LTPoE++ PSE 控制器的演示板
- AM1D-0505SH30-RZ 5V 1W DC/DC 转换器的典型应用
- 两个 LTC3610 并联可提供 24A 输出电流
- STM32FEBKC6T6 通用控制板 带OLED屏幕五向开关
- ADR392A 4.096 Vout 微功率、低噪声精密电压基准的典型应用
- 具有 10.5V SEPIC 转换器的 LTC3859AHFE 高效率、1.2V/3.3V 降压转换器的典型应用电路
- CGD和Qorvo将共同革新电机控制解决方案
- 是德科技 FieldFox 手持式分析仪配合 VDI 扩频模块,实现毫米波分析功能
- 贸泽开售可精确测量CO2水平的 英飞凌PASCO2V15 XENSIV PAS CO2 5V传感器
- 玩法进阶,浩亭让您的PCB板端连接达到新高度!
- 长城汽车研发新篇章:固态电池技术引领未来
- 纳芯微提供全场景GaN驱动IC解决方案
- 解读华为固态电池新专利,2030 叫板宁德时代?
- 让纯电/插混车抓狂?中企推全球首款-40℃可放电增混电池,不怕冷
- 智驾域控知多少:中低端车型加速上车,行泊一体方案占主体
- Foresight推出六款先进立体传感器套件 彻底改变工业和汽车3D感知