版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、/*/ /*文件名: 诺基亚5110液晶显示汉字程序 *功能说明:用STC单片机在5110液晶上显示"宁波北仑恒晶电子"8个汉字 *当前编译器版本:Keil 4 *单片机型号:STC89C52RC *开发环境:Keil 4 *晶震频率: 12M 外部晶体振荡器 *出处: 宁波北仑恒晶电子科技有限公司 *编写者: 代品川 *日期: 2012年5月11日 *备注: 提取字模用"Pctolcd2002完美版"软件,字模选项中的设置为 列行式+逆向+每行显示16*8+C51格式,可随意更改文字内容 本公司供应段码,笔段式LCD 开模定制 提供技术支持,承接单片机
2、控制板的 开发 *联系人: 代工 *声明: 本程序为测试程序,因用此程序造成的损失,本公司概不负责(禁止商业用途)*/*/#include <reg51.h>#include <string.h>#define uchar unsigned char#define uint unsigned intuchar flag,flag1;unsigned char buff14="0123456789abcd"unsigned char buff114="1000000"sbit RST_5110=P14; /low activesbi
3、t CE_5110=P13; /low activesbit DC_5110=P12; /0=command,1=datasbit SDI_5110=P11; /rise edge enablesbit SCK_5110=P10; /clock#define DATA 1/数据命令#define CMD 0/指令 命令/*字模*/unsigned char code asc26 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , / sp 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 , / ! 0x00, 0x00, 0x07, 0x00,
4、0x07, 0x00 , / " 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 , / # 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 , / $ 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 , / % 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 , / & 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 , / ' 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 , / ( 0x00, 0x00, 0x41, 0x22,
5、0x1c, 0x00 , / ) 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 , / * 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 , / + 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 , / , 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 , / - 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 , / . 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 , / / 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E ,
6、/ 0 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 , / 1 / 0x20,0x10,0x1A,0x20,0x40,0x80, 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 , / 2 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 , / 3 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 , / 4 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 , / 5 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 , / 6 0x00, 0x01, 0x71,
7、 0x09, 0x05, 0x03 , / 7 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 , / 8 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E , / 9 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 , / : 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 , / ; 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 , / < 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 , / = 0x00, 0x00, 0x41, 0x22, 0x1
8、4, 0x08 , / > 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 , / ? 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E , / 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C , / A 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 , / B 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 , / C 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C , / D 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 , /
9、E 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 , / F 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A , / G 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F , / H 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 , / I 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 , / J 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 , / K 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 , / L 0x00, 0x7F,
10、 0x02, 0x0C, 0x02, 0x7F , / M 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F , / N 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E , / O 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 , / P 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E , / Q 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 , / R 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 , / S 0x00, 0x01, 0x01, 0x7F,
11、0x01, 0x01 , / T 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F , / U 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F , / V 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F , / W 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 , / X 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 , / Y 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 , / Z 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 ,
12、/ 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 , / 55 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 , / 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 , / 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 , / _ 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 , / ' 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 , / a 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 , / b 0x00, 0x38
13、, 0x44, 0x44, 0x44, 0x20 , / c 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F , / d 0x00, 0x38, 0x54, 0x54, 0x54, 0x58 , / e 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 , / f 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C , / g 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 , / h 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 , / i 0x00, 0x40, 0x80, 0x84,
14、 0x7D, 0x00 , / j 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 , / k 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 , / l 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 , / m 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 , / n 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 , / o 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 , / p 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC ,
15、 / q 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 , / r 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 , / s 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 , / t 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C , / u 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C , / v 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C , / w 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 , / x 0x00, 0x
16、1C, 0xA0, 0xA0, 0xA0, 0x7C , / y 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 , / z 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 / horiz lines;/*汉子字模*/*unsigned char code hanzi16=0x10,0x10,0xF0,0x1F,0x10,0xF0,0x80,0x82,0x82,0x82,0xF2,0x8A,0x86,0x82,0x80,0x00,0x80,0x43,0x22,0x14,0x0C,0x73,0x20,0x00,0x40,0x80,0x7F,0x00,0
17、x00,0x00,0x00,0x00,/"好",00x10,0x10,0xF0,0x1F,0x10,0xF0,0x80,0x82,0x82,0x82,0xF2,0x8A,0x86,0x82,0x80,0x00,0x80,0x43,0x22,0x14,0x0C,0x73,0x20,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,/"好",10x40,0x30,0x10,0x12,0x5C,0x54,0x50,0x51,0x5E,0xD4,0x50,0x18,0x57,0x32,0x10,0x00,0x00,0x02
18、,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x00,/"学",20x00,0x00,0x02,0x02,0x0A,0x12,0x22,0x62,0x02,0x82,0x82,0x42,0x02,0xFE,0x00,0x00,0x00,0x00,0x04,0x0C,0x04,0x02,0x02,0x01,0x01,0x00,0x20,0x40,0x80,0x7F,0x00,0x00,/"习",30xFE,0x02,0x02,0x02,0xFE,0x00,0xFE,0x
19、42,0x42,0x42,0x7E,0x42,0x42,0x42,0xFE,0x00,0x07,0x01,0x01,0x01,0x03,0x00,0x3F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x70,0x00,/"吧",0; */unsigned char code hanzi16=0x00,0x90,0x8C,0x84,0x84,0x84,0x85,0x86,0x84,0x84,0x84,0x84,0x94,0x8E,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,
20、0x00,0x00,0x00,0x00,0x00,0x00,/*"宁",0*/* (16 X 16 , 宋体 )*/0x10,0x60,0x01,0xE6,0x00,0xF8,0x88,0x88,0x88,0xFF,0x88,0x88,0x88,0x18,0x08,0x00,0x04,0x04,0xFF,0x40,0x30,0x8F,0x80,0x41,0x26,0x18,0x18,0x26,0x61,0xC0,0x40,0x00,/*"波",1*/* (16 X 16 , 宋体 )*/0x00,0x20,0x20,0x20,0x20,0xFF,0x00
21、,0x00,0x00,0xFF,0x40,0x20,0x30,0x18,0x10,0x00,0x10,0x30,0x18,0x08,0x04,0x7F,0x00,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x78,0x00,/*"北",2*/* (16 X 16 , 宋体 )*/0x00,0x40,0x40,0x20,0xD0,0x08,0x04,0x03,0x04,0x88,0x10,0x30,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x44,0x44,0x42,0x43,0x41,0x41,0
22、x40,0x78,0x20,0x00,0x00,/*"仑",3*/* (16 X 16 , 宋体 )*/0x70,0x00,0xFF,0x08,0x30,0x02,0xF2,0x92,0x92,0x92,0x92,0x92,0xF2,0x02,0x00,0x00,0x00,0x00,0x7F,0x00,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x20,0x00,/*"恒",4*/* (16 X 16 , 宋体 )*/0x00,0x00,0x00,0x00,0x7E,0x2A,0x2A,0x2A,
23、0x2A,0x2A,0x2A,0x7E,0x00,0x00,0x00,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,0x00,0x7F,0x25,0x25,0x25,0x25,0x7F,0x00,/*"晶",5*/* (16 X 16 , 宋体 )*/0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x
24、4F,0x40,0x70,0x00,/*"电",6*/* (16 X 16 , 宋体 )*/0x00,0x00,0x02,0x02,0x02,0x02,0x02,0xE2,0x12,0x0A,0x06,0x02,0x00,0x80,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x41,0x81,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,/*"子",7*/* (16 X 16 , 宋体 )*/0x10,0x12,0x92,0x72,0xFE,0x51,0x91,0x00,0x22,0
25、xCC,0x00,0x00,0xFF,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0xFF,0x00,0x04,0x04,0x04,0x02,0x02,0x02,0xFF,0x01,0x01,0x00,/*"科",8*/* (16 X 16 , 宋体 )*/0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xC8,0x48,0x48,0x7F,0x48,0xC8,0x48,0x08,0x00,0x01,0x41,0x80,0x7F,0x00,0x40,0x40,0x20,0x13,0x0C,0x0C,0x12,0x21,0x6
26、0,0x20,0x00,/*"技",9*/* (16 X 16 , 宋体 )*/0x00,0x04,0x84,0x44,0xE4,0x34,0x2C,0x27,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0x00,0x02,0x01,0x00,0x00,0xFF,0x09,0x09,0x09,0x29,0x49,0xC9,0x7F,0x00,0x00,0x00,0x00,/*"有",10*/* (16 X 16 , 宋体 )*/0xFE,0x02,0x32,0x4E,0x82,0x00,0xFE,0x4A,0xCA,0x4A,0
27、x4A,0x4A,0x7E,0x00,0x00,0x00,0xFF,0x00,0x02,0x04,0x03,0x00,0xFF,0x40,0x20,0x03,0x0C,0x12,0x21,0x60,0x20,0x00,/*"限",11*/* (16 X 16 , 宋体 )*/0x00,0x00,0x80,0x40,0x30,0x0E,0x84,0x00,0x00,0x0E,0x10,0x60,0xC0,0x80,0x80,0x00,0x00,0x01,0x20,0x70,0x28,0x24,0x23,0x31,0x10,0x10,0x14,0x78,0x30,0x01,0x
28、00,0x00,/*"公",12*/* (16 X 16 , 宋体 )*/0x00,0x10,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x12,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x1F,0x04,0x04,0x04,0x04,0x04,0x04,0x0F,0x00,0x20,0x40,0x3F,0x00,0x00,/*"司",13*/* (16 X 16 , 宋体 )*/; /*函数名称:T延时函数函数功能;出入参数:*/ void Delay_us(uchar t)/延时wh
29、ile(-t);/*函数名称:写命令数据函数功能;出入参数:*/ void Write_Byte_5110(uchar Data ,bit CMD_DATA)uchar i;CE_5110=0; /Enable LCDDC_5110=CMD_DATA;/写命令还是写数据for(i=0;i<8;i+) SCK_5110=0; if(Data & 0x80) /MSB first高位优先 SDI_5110=1;/传输1 else SDI_5110=0;/传输0 SCK_5110=1;/始终为1时锁存 Data<<=1;SCK_5110=0;/时钟清零CE_5110=1;
30、/disable LCD关液晶使?/*函数名称:清屏函数功能;出入参数:*/ void Clear_5110(void)uint i;Write_Byte_5110(0x80,CMD);/写地址for(i=0;i<504;i+) Write_Byte_5110(0x00,DATA);/set the addr as 0x00/*函数名称:写地址函数功能;出入参数:*/void Set_R_C_5110(uchar R,uchar C) /R=05;C=083if(R<=5 && C<=83) Write_Byte_5110(0x40|R,CMD);/写行地址
31、Write_Byte_5110(0x80|C,CMD);/写列地址/*函数名称:LCD初始化函数功能;出入参数:*/ void Init_5110(void)Delay_us(1); /reset LCDRST_5110=0;/复位清零 Delay_us(1);RST_5110=1;Write_Byte_5110(0x21,CMD); /扩展指令Write_Byte_5110(0xc8,CMD); /设置偏压Write_Byte_5110(0x20,CMD); /标准指令Clear_5110();Write_Byte_5110(0x0c,CMD); /标准显示模?/*函数名称:写一个字节函数功
32、能;出入参数:*/ void Write_Char_5110(uchar Char)uchar i,j;i=Char-0x20;/从缓冲区的字符串自动转换成16进制进行查表取摸for(j=0;j<6;j+) Write_Byte_5110(asc2ij,DATA);/*函数名称:写一个字符串函数功能;出入参数:*/ void Write_String_5110(uchar *P)uchar i;for(i=0;i<strlen(P);i+) Write_Char_5110(Pi);/*函数名称:图片显示模式第一行函数功能;出入参数:*/ void Write_hanzis1_5110()uchar i,j;for(i=
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 二年级下册数学导学案-7 万以内数的认识第11课时 整百、整千数加减法(1)|人教新课标
- 2023-2024学年六年级下学期数学二 比和比例《观察与思考-图形的放大与缩小》教案
- 2021-2022学年四年级下学期数学《鸡兔同笼》(教案)
- 一年级下册数学教案-1.2 读数 写数 北京版
- 2024年光伏电站项目施工与环保监管合同
- 一年级下册数学教案-第5单元 4元角分的练习课∣人教新课标
- 《角的初步认识》(教案)2023-2024学年数学二年级上册
- 2024年修订版:企业公务车辆租赁合同
- 2024年全新设计专利许可合同
- 港口码头建设钢板桩支护施工方案
- 河北省衡水市药品零售药店企业药房名单目录
- 私域员工(私域流量私域运营)业绩考核指标标准
- 《卜算子·咏梅》(两首)课件
- 清华大学抬头信纸
- 管道安装检验批质量验收记录表
- 鲁教版高一化学必修一知识点总结
- 医保培训记录表
- 高考语文诗歌专题鉴赏之比较类诗歌鉴赏 课件24张
- 四年级上册数学教案 8 小数乘法 青岛版(五四学制)
- 小学数学苏教版六年级上册《认识比》课件(公开课)
- 需求阶段进度报告
评论
0/150
提交评论