版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、无字库 12864 液晶屏滚动显示程序 转#include<reg52.h>#include<intrins.h>#include<absacc.h># define Lcd_Bus P0 /MCU P0<> LCM# define Disp_On 0x3f/ 开显示# define Disp_Off 0x3e/ 关显示# define Col_Add 0x40/ 列地址# define Page_Add 0xb8/ 页地址# define Start_Line 0xc0/ 起始页sbit cs1=P2A3; /Master chip enabl
2、esbit cs2=P2A4; /Slave chip enablesbit Enable=P2A2; / mode Enable singlesbit Di=P2A0; /Data or Instrument Selectsbit RW=P2A1; /Write or Readsbit Lcd_Rst=P2A5; /Lcm reset/*字模 , 此字体下对应的点阵为:宽x高= 16x16*unsigned char code Chinese_character32=0x02,0xF2,0x12,0x12,0x12,0xFE,0x12,0x12,0x12,0xFE,0x12,0x12,0x1
3、2,0xF2,0x02,0x00 ,0x00,0x7F,0x28,0x24,0x22,0x21,0x20,0x20,0x20,0x21,0x22,0x22,0x22,0x7F,0x00,0x00,/*" 西",0*/0x80,0x90,0x8C,0x84,0x84,0xF4,0xA5,0x86,0x84,0x84,0x84,0x84,0x94,0x8C,0x84,0x00,0x80,0x80,0x80,0x40,0x47,0x28,0x28,0x10,0x28,0x24,0x43,0xC0,0x40,0x00,0x00,0x00,/*" 安",1*/0x
4、00,0x42,0x62,0x5A,0xC6,0x10,0x54,0x54,0x54,0xFF,0x54,0x54,0x7C,0x10,0x10,0x00,0x40,0x23,0x14,0x08,0x17,0x28,0x29,0x49,0x49,0x7F,0x49,0x49,0x49,0x49,0x40,0x00,/*" 建",2*/0x10,0x48,0x47,0xCC,0x54,0x44,0x14,0xE8,0x27,0x24,0x2C,0xF4,0x04,0x04,0x04,0x00,0x10,0x30,0x10,0x0F,0x88,0x48,0x30,0x0F,0x
5、01,0x06,0x00,0x3F,0x40,0x40,0x70,0x00,/*" 筑",3*/0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0xCC,0x00,0x00,0xFF,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00,/*" 科",4*/0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0x
6、C8,0x48,0x08,0x00,0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x60,0x20,0x00,/*" 技",5*/0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x7F,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x01,0x06,0x08,0x30,0x60,0xC0,0x40,0x00,/*" 大",6*/0x
7、40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,/*" 学",4*/0x00,0x02,0x1C,0xE8,0x00,0x40,0x60,0x58,0x47,0x22,0x20,0x28,0x30,0xE0,0x40,0x00,0x02,0x02,0x7F,0x00,0x00,0x00,0x7F,0x21,0x
8、21,0x21,0x21,0x21,0x7F,0x00,0x00,0x00,/*" 冶",0*/0x40,0x40,0x20,0x20,0x50,0x48,0x44,0xC3,0x44,0x48,0x50,0x50,0x20,0x60,0x20,0x00,0x40,0x40,0x42,0x42,0x4A,0x72,0x42,0x7F,0x42,0x62,0x5A,0x42,0x42,0x40,0x40,0x00,/*" 金",1*/0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x
9、 02,0x02,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*" 工",2*/0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,/*" 程",3*/0
10、x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,0x00,0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,/*" 学",4*/0xFE,0x02,0x32,0x4A,0x86,0x0C,0x24,0x24,0x25,0x26,0x24,0x24,0x24,0x0C,0x04,0x00,0xFF,0x00,0x02,0x04,0x83,0x41,0x31,0x0F,0
11、x01,0x01,0x7F,0x81,0x81,0x81,0xF1,0x00,/*" 院",5*/0x10,0x10,0xD0,0xFE,0x50,0x90,0x00,0x10,0x10,0x10,0xD0,0xFE,0x10,0x10,0x10,0x00,0x08,0x06,0x01,0xFF,0x00,0x01,0x10,0x08,0x04,0x43,0x80,0x7F,0x00,0x00,0x00,0x00,/*" 材",0*/0x20,0x24,0xA8,0x70,0xFF,0x68,0xA4,0x20,0x42,0x8C,0x00,0x00,0
12、xFF,0x00,0x00,0x00,0x08,0x06,0x01,0x00,0xFF,0x00,0x01,0x02,0x02,0x03,0x02,0x02,0xFF,0x01,0x01,0x00,/*" 料",1*/0x00,0x08,0x08,0x08,0xFF,0x08,0x08,0xF8,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x20,0x40,0x3F,0x00,0x7F,0x10,0x10,0x10,0x3F,0x00,0x00,/*" 加",2*/0
13、x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*" 工",4*/0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xFE,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0
14、x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*" 工",4*/0x10,0x12,0xD2,0xFE,0x91,0x11,0x80,0xBF,0xA1,0xA1,0xA1,0xA1,0xBF,0x80,0x00,0x00,0x04,0x03,0x00,0xFF,0x00,0x41,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x40,0x00,/*" 程",5*/;unsigned char code E16=0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x
15、00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,/*"C",0*/ 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,/*"r",1*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,/*"a",2*/0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00
16、,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,/*"s",3*/0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,/*"y",4*/0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,/*"b",5*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x
17、00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,/*"o",6*/0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,/*"y",7*/0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,/*"e",8*/;/* 延时子程序*/void delay(unsigned int k)unsigned
18、 int i;第 12 页unsigned int j;for(i=0;i<k;i+) for(j=0;j<20;j+);/*写命令左 */void write_cmd_1(unsigned char command)cs1=1;cs2=0;Di=0;RW=0;Lcd_Bus=command; /P0 口delay(0);Enable=1;delay(0);Enable=0;/*写命令右 */void write_cmd_2(unsigned char command)cs1=0;cs2=1;Di=0;RW=0;Lcd_Bus=command;delay(0);Enable=1;d
19、elay(0);Enable=0;写数据左 */* void write_data_1(unsigned char dis_data)cs1=1;cs2=0;Di=1;RW=0;Lcd_Bus=dis_data;delay(0);Enable=1;delay(0);Enable=0;/*写数据右 */void write_data_2(unsigned char dis_data) cs1=0;cs2=1;Di=1;RW=0;Lcd_Bus=dis_data;delay(0);Enable=1;delay(0);Enable=0;/*清内存左 */void clear_1(void) unsi
20、gned char j,k;cs1=1;cs2=0;write_cmd_1(Page_Add+0);write_cmd_1(Col_Add+0);for(k=0;k<8;k+) write_cmd_1(Page_Add+k);for(j=0;j<64;j+)write_data_1(0x00);/*清内存右 */void clear_2(void)unsigned char j,k;cs1=0;cs2=1;write_cmd_2(Page_Add+0);write_cmd_2(Col_Add+0);for(k=0;k<8;k+) write_cmd_2(Page_Add+k)
21、;for(j=0;j<64;j+)write_data_2(0x00);/*显 示 汉 字 16*16*/void Chinese_disp_1(unsigned char pag,unsigned char col,unsignedchar n)unsigned char i=0;unsigned char j=0;cs1=1;cs2=0;for(i=0;i<2;i+)write_cmd_1(Page_Add+pag+i);write_cmd_1(Col_Add+col);for(j=0;j<16;j+)write_data_1(Chinese_charactern16*i
22、+j);/*显示汉字 16*16 右*/void Chinese_disp_2(unsigned char pag,unsigned char col,unsignedchar n)unsigned char i=0;unsigned char j=0;cs1=0;cs2=1;for(i=0;i<2;i+) write_cmd_2(Page_Add+pag+i);write_cmd_2(Col_Add+col);for(j=0;j<16;j+)write_data_2(Chinese_charactern16*i+j);/*显示英文16*8 左*/void E_disp_1(uns
23、igned char pag,unsigned char col,unsigned char n)unsigned char i=0;unsigned char j=0;cs1=1;cs2=0;for(i=0;i<2;i+) write_cmd_1(Page_Add+pag+i);write_cmd_1(Col_Add+col);for(j=0;j<8;j+)write_data_1(En8*i+j); void E_disp_2(unsigned char pag,unsigned char col,unsigned char n)/*显示英文16*8 右*/unsigned c
24、har i=0;unsigned char j=0;cs1=0;cs2=1;for(i=0;i<2;i+)write_cmd_2(Page_Add+pag+i);write_cmd_2(Col_Add+col);for(j=0;j<8;j+)write_data_2(En8*i+j); /* void init_lcd() Lcd_Rst=0;delay(100);Lcd_Rst=1; delay(100);write_cmd_1(Disp_Off);write_cmd_1(Page_Add+0);液晶屏初始化 */write_cmd_2(Disp_Off);write_cmd_2
25、(Page_Add+0);write_cmd_1(Start_Line+0); write_cmd_2(Start_Line+0);write_cmd_1(Col_Add+0);write_cmd_1(Disp_On);write_cmd_2(Col_Add+0);write_cmd_2(Disp_On);/*LCD显示子程序 */void display(void)unsigned char i;for(i=Start_Line;i<0xff;i+)第 14 页Chinese_disp_1(0,0, 0);Chinese_disp_1(0,16,1);Chinese_disp_1(0,32,2);Chin
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 江苏省扬州市2024-2025学年高二(上)学业水平合格性模拟考试物理试卷(含答案)
- 河北省衡水市2024-2025学年高三上学期期末物理试题(无答案)
- 2022年高考物理大一轮总复习(江苏专版-)题库-第二章-相互作用-第2课时
- 安徽省合肥第四十六中学2024-2025学年九年级第一学期12月份月考语文试卷(含答案)
- 【KS5U原创】新课标2021年高二物理暑假作业5《恒定电流二》
- 2021贵阳市高考英语阅读、阅读表达一轮自练题(5)-及答案
- 四年级数学(除数是两位数)计算题专项练习及答案
- 【全程复习方略】2021年春高中物理选修3-4-课时达标·效果检测-12.2-波的图像
- 2022部编版四年级语文下册全册一课一练同步练习(有答案)+知识点归纳
- 2025年0096北京美欣科技有限公司
- (2024年)《管理学》第四章组织
- 开题报告金融
- 心肺复苏知识培训总结与反思
- 楚雄师范学院-18级-葡萄酒专业-葡萄酒工艺学复习题及答案
- 高速公路机电工程标准化施工管理质量控制
- 助产士的述职报告
- 医保缴费问题排查整改报告
- 维护社会稳定规定
- 2024年黑龙江高中学业水平合格性考试数学试卷试题(含答案详解)
- 2024年度医院财务部述职报告课件
- 《牙髓血运重建术》课件
评论
0/150
提交评论