【2017年整理】诺基亚5110LCD驱动程序.doc
文本预览下载声明
/******************************************************************** NOKIA5110(3310)液晶屏驱动程序** 晶 振??频 率:11.0592M** 线路-单片机实验开发板A******************************************************************/????#include /*-- 定义 Nokia5110 引角 */??sbit sclk = P3^3;??sbit sdin = P3^4;??sbit dc?? = P3^5;??sbit sce = P3^7;??sbit res = P3^6;??void initNokia5110(void);???????????????????????? /* NOkia 5110 初始化?? */??void clearNokia5110(void);???????????????????????? /* 清除屏幕 整屏清空 */??void Display_char(unsigned char x,unsigned char y,char *s);?? /* 写字符 x 设置显示字符的X位置 ; y 设置显示字符的Y位置?? *s 显示字符的首地址 */??void Display_num(unsigned char x,unsigned char y,char s);?? /* 写数字 x 设置显示字符的X位置 ; y 设置显示字符的Y位置?? s 显示数字 */??void write_byte(unsigned char data1);???????????????? /* 发送1字节到 NOkia 5110 */??void setxy(unsigned char x,unsigned char y);?????????? /* 设置显示坐标 x 行坐标(0-83)?? unsigned char y 列坐标(0-5) */??void delay(unsigned int time);?? void main(void){????????initNokia5110();???????????????????????? /* NOkia 5110 初始化?? */????????clearNokia5110();???????????????????????? /* 清除屏幕 整屏清空 */????????Display_char(1,2,);?? /* 写字符 x 设置显示字符的X位置 ; y 设置显示字符的Y位置?? *s 显示字符的首地址 */????????Display_char(10,4,NOKIA5510);?? /* 写字符 x 设置显示字符的X位置 ; y 设置显示字符的Y位置?? *s 显示字符的首地址 */????????//Display_num(0,0,9);?? // 写数字while(1);}/****************************5110 0-9字模**************************//*函数原型:无/*函数功能:0-9字模/*输入参数:无/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/unsigned char code asc2tab[][6] ={????{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },// sp????{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 },// !????{ 0x00, 0x00, 0x07, 0x00, 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 }
显示全部