诺基亚5110液晶使用说明+实例应用

合集下载

nokia5110_nokia3310中文数据手册

nokia5110_nokia3310中文数据手册

PCD8544�
1999 年 4 月 12 日
3
Philips 半导体
产品说明书
48x84点矩阵LCD控制/驱动
PCD8544
1 特征
单芯片 LCD 控制/驱动 48 行,84 列输出 显示数据 RAM 48*84 位 芯片集成: ——LCD 电压发生器(也可以使用外部电压供应) ——LCD偏置电压发生器 ——振荡器不需要外接元件(也可以使用外部时钟) 外部 RES(复位)输入引脚 串行界面最高 4.0Mbits/S CMOS 兼容输入 混合速率:48 逻辑电压范围 VDD 到 VSS:2.7V~3.3V 显示电压范围 VLCD 到 VSS: ——6.0~8.5V LCD内部电压发生器(充许电压发生器) ——6.0~9.0V LCD 外部电压供应(电压发生器关闭) 低功耗,适用于电池供电系统 关于 VLCD 的温度补偿 使用温度范围:-25~70℃
Philips 半导体
产品说明书
48x84点矩阵LCD控制/驱动
6.1.8 SCLK: 串行时钟线 输入:时钟信号: 0.0 ~ 4.0 Mbits/s. 6.1.9 D/C: 模式选择 输入:选择命令/地址或输入数据 6.1.10 SCE: 芯片使能 使能引脚充许输入数据,低电平有效。 6.1.11 OSC:振荡器
偏置电压 发生器
数据锁存器
移位寄存器 复位
RES OSC
VLCD1
发生器
VLCD
振荡器 显示数据存储器
(DDRAM) 48 × 84
VDD1 to VDD2 VSS1 to VSS2 T1 T2 T3 T4
时钟 发生器 显示 地址 计数器
地址计数器 数据 寄存器
I/O
PCD8544

诺基亚5110学习(含字库,免财富)

诺基亚5110学习(含字库,免财富)

0x3C, 0x4A, 0x49, 0x49, 0x30, 0x01, 0x71, 0x09, 0x05, 0x03, 0x36, 0x49, 0x49, 0x49, 0x36, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x36, 0x36, 0x00, 0x00, 0x00, 0x56, 0x36, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x41, 0x22, 0x14, 0x08, 0x02, 0x01, 0x51, 0x09, 0x06, 0x32, 0x49, 0x59, 0x51, 0x3E, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x7F, 0x41, 0x41, 0x22, 0x1C, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x46, 0x49, 0x49, 0x49, 0x31, 0x01, 0x01, 0x7F, 0x01, 0x01, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x63, 0x14, 0x08, 0x14, 0x63, 0x07, 0x08, 0x70, 0x08, 0x07, 0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x7F, 0x41, 0x41, 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55, 0x00, 0x41, 0x41, 0x7F, 0x00, 0x04, 0x02, 0x01, 0x02, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x01, 0x02, 0x04, 0x00, 0x20, 0x54, 0x54, 0x54, 0x78,

毕业设计基于Nokia5110的液晶屏模块设计

毕业设计基于Nokia5110的液晶屏模块设计

电气信息学院基于Nokia5110的液晶屏模块设计摘要:本设计是以单片机STC89C52RC为核心器件的基于Nokia5110液晶屏的电子指南针。

整个系统主要由单片机最小系统,电源输入模块,LCD液晶显示模块,磁阻传感器模块和串口电路部分构成。

通过用C语言编程使单片机处理磁阻传感器接收到的X轴和Y轴上的磁场分量,转换为距南方的角度后,通过Nokia5110动态显示。

Nokia5110是一块84×48 的LCD点阵型液晶显示屏,如果字模是12×16 大小的字符,则能显示3 行,每行显示7个汉字。

每个字符都分为上下两部分进行扫描,在每行扫描时以一列8位为单位进行扫描。

通过原理图设计、软件仿真、制作硬质板电路,硬件调试,证明了本设计的可行性。

关键词:Nokia5110,STC89C52RC,磁阻传感器HMC5883L,电子指南针Abstract: This design is a digital compass based on Nokia5110, with the MCU STC89C52RC as its core. The system mainly consists of a MCU minimum system, a power input module, a LCD module, a magnetic sensor module and a serial port module. Through C language programming, the MCU processes the data on the X and Y axes, which is collected by the magnetic sensor. Then it is transformed into an angle indicating its relative direction to the south pole in degrees. Finally, it is shown on the Nokia5110 dynamically. The Nokia5110 is an LCD with 84×48 dots, if a character is displayed with 12×16 dots, then it can display 3 lines, with each line comprising 7 characters. The characters are scanned in two halves, the upper half and the lower half. For each half, 8 bits( a byte)are scanned as a unit at a time. Through schematic design, software simulation, making the printed circuit board and hardware debugging, the feasibility of this design has been proved.Keywords:Nokia5110, STC89C52RC, magnetic sensor, digital compass目录1 前言 .............................................................................................. 错误!未定义书签。

XS128单片机实验诺基亚5110液晶显示

XS128单片机实验诺基亚5110液晶显示

XS128单片机实验:诺基亚5110液晶显示/*********包含的头文件*****************************/#include ;/* common defines and macros */#include &quot;derivative.h&quot;/* derivative-specific definitions */#include &quot;WQ.h&quot;#include &quot;Font6_8.h&quot;#include &quot;Bitmap.h&quot;#include &quot;Font16_16.h&quot;#include &quot;Font8_16.h&quot;/****************宏定义*****************************/#define SCLKPTM_PTM4#define SDINPTM_PTM3#define LCD_DC PTM_PTM5#define LCD_CE PTM_PTM2#define LCD_RES PTM_PTM1#define LEDPTM_PTM0/****************函数申明***************************/void LCD_int(void);void LCD_write_byte(uchar dt,uchar command); void LCD_write_char(uchar *font);void LCD_set_XY(uchar x,uchar y);void LCD_clear(void);/*1.********************************************* *****/// LCD_write_byte: 使用spi接口写数据到LCD// 输入参数:dt 写入的数据// 使用I/o口模拟SPI总线通讯发送一个字节数据到LCD显示// Command : 写数据/命令选择// Data: 2013、4、26/************************************************ ***/void LCD_write_byte(uchar dt,uchar command) { uchar i;LCD_CE=0;//使能LCDdelay_us(40);//延时30us;if(command==0)//判断发送数据还是发送命令LCD_DC=0;elseLCD_DC=1;delay_us(40);//延时30us;for(i=0;i<8;i++){if(dt&0x80)SDIN=1;// 发送高位elseSDIN=0;delay_us(40);//延时30us;SCLK=0;dt=dt<<1;SCLK=1;}LCD_CE=1;//关闭LCD}/*2.********************************************* ****/// 函数 :LCD_set_xy// 功能 :设置LCD坐标函数// 说明:x:横坐标 Y纵坐标// Date:2013/4/26/************************************************ */void LCD_set_XY(uchar x,uchar y){LCD_write_byte(0x40|y,0);//列按位或设置y坐标LCD_write_byte(0x80|x,0);//行按位或设置x坐标}/*3.********************************************/ // LCD_write_char() ;显示英文字符// 输入参数:C:显示的字符// Date:2013/4/26/********************************************/void LCD_write_char (uchar *font) {uint i;for(i=0;i<6;i++)LCD_write_byte(font[i],1);}/*4.********************************************* /// 函数:LCD_clear// 功能:清屏// 参数:无// Date:2013/4/26/************************************************ /void LCD_clear(void) {uint i;LCD_write_byte(0x0c,0);LCD_write_byte(0x80,0);for(i=0;i<504;i++) {LCD_write_byte(0,1);}}/************************************************ */// LCD_init: LCD初始化// 输入参数无// Date :2013、4、26/************************************************ /void LCD_int(void) {LCD_RES=0;delay_ms(2);LCD_RES=1;LCD_write_byte(0x21,0);//初始化LCD,功能设定使用扩充指令LCD_write_byte(0xd0,0);//设定液晶偏置电压; LCD_write_byte(0x20,0);//使用基本指令LCD_write_byte(0x0c,0);//设定显示模式,正常显示}/************************************************ ****/// 主函数:void mian// 功能:在诺基亚5110液晶屏上显示字符// 作者:wangqi// 时间;2013、4、26/************************************************ ****/void main(){unsigned charA[6]={0x00,0x7c,0x12,0x11,0x12,0x7c};unsigned charB[6]={0x00,0x7f,0x49,0x49,0x49,0x36};DDRM = 0xFF;LCD_int();LCD_clear();LED=1;delay_s(5);LED=0;while(1){LCD_set_XY(0,1); LCD_write_char(A); delay_ms(100);LCD_set_XY(10,1);LCD_write_char(A);delay_ms(100);LCD_set_XY(0,3); LCD_write_char(B); delay_ms(100);LCD_set_XY(10,4) ; LCD_write_char(B);}}。

Nokia5110程序

Nokia5110程序

#include <hidef.h> /* common defines and macros */#include "derivative.h" /* derivative-specific definitions */#define uchar unsigned char#define uint unsigned int#define lcd12864_date PORTB //数据口#define lcd12864_rs PTT_PTT5// PTT_PTT5; //寄存器选择输入#define lcd12864_rw PTT_PTT3 //液晶读/写控制#define lcd12864_e PTT_PTT2 //液晶使能控制#define DQ PORTA_PA0 // 定义DQ引脚为P3.3 #define DQ_HIGH() DDRA=0 //设置数据口为输入#define DQ_LOW() DDRA=1;DQ=0; //设置数据口为输出//uint temp; //温度值variable of temperature uchar A1,A2,A3;void delay2(uint i);void Init_Ds18b20(void);uchar Read_One_Byte();void Write_One_Byte(uchar dat);uint Get_Tmp();void DisplayTemp(uint temp) ;void delay(unsigned int t){uint i,j;for(i=t;i>0;i--)for(j=1000;j>0;j--);}void lcd12864_write_cmd(unsigned char command) //写指令{lcd12864_rs=0;lcd12864_rw=0;lcd12864_e=0;lcd12864_date=command;delay(5);lcd12864_e=1;lcd12864_e=0;delay(5);}void lcd12864_write_data(unsigned char data) // 写数据写入一个字符{lcd12864_rs=1;lcd12864_rw=0;lcd12864_e=0;lcd12864_date=data;delay(5);lcd12864_e=1;lcd12864_e=0;delay(5);}void lcd12864_pos(unsigned char x,unsigned char y) //确定位置{unsigned char pos;if (x==1){x=0x80;}else if (x==2){x=0x90;}else if (x==3){x=0x88;}else{x=0x98;}pos=x+y-1;lcd12864_write_cmd(pos); //显示地址}void io_init(){lcd12864_write_cmd(0x30); //基本指令操作lcd12864_write_cmd(0x0C); //显示开,关光标lcd12864_write_cmd(0x01); //清除LCD的显示内容位置计数器调整为0x00 }void lcd12864_wrtie_string( char *str) //写字符串{while(*str!='\0') //未结束{lcd12864_write_data(*str++);}}void init_LCD(){delay(20);lcd12864_write_cmd(0x30);delay(20);lcd12864_write_cmd(0x30);delay(20);lcd12864_write_cmd(0x0c);//开显示,不显示光标,且不闪烁delay(20);lcd12864_write_cmd(0x01); //清屏delay(20);lcd12864_write_cmd(0x06); //每次写入数据后地址指针加1delay(20);}/**/void Display1(){lcd12864_pos(1,2);lcd12864_wrtie_string("温度调节系统");lcd12864_pos(2,1);lcd12864_wrtie_string("菜单1:当前温度");lcd12864_pos(3,1);lcd12864_wrtie_string("菜单2:目标温度");lcd12864_pos(4,1);lcd12864_wrtie_string("菜单3:温度曲线");}void Display2(){lcd12864_pos(1,2);lcd12864_wrtie_string("温度调节系统");lcd12864_pos(2,1);lcd12864_wrtie_string("当前温度:**度");lcd12864_pos(3,1);lcd12864_wrtie_string("目标温度:**度");lcd12864_pos(4,2);lcd12864_wrtie_string(" Welcome ! ");}void main(void){delay(5);DDRB=0xff;DDRT=0xff;// io_init();init_LCD();lcd12864_pos(2,2);lcd12864_wrtie_string(" Welcome To ! ");lcd12864_pos(3,2);lcd12864_wrtie_string("温度调节系统");delay(2000);lcd12864_write_cmd(0x01); //清屏delay(20);while(1){DisplayTemp(Get_Tmp());lcd12864_pos(2,3);lcd12864_write_data(0x30+A1);lcd12864_pos(2,4);lcd12864_write_data(0x30+A2);lcd12864_pos(2,5);lcd12864_write_data(0x2e);lcd12864_pos(2,6);lcd12864_write_data(0x30+A3);/*Display1() ; */}}/*************精确延时函数*****************/ void delay2(unsigned int i){i=10*i;while(--i);}/****************************************** 此延时函数针对的是12Mhz的晶振delay(0):延时518us 误差:518-2*256=6delay(1):延时7us (原帖写"5us"是错的)delay(10):延时25us 误差:25-20=5delay(20):延时45us 误差:45-40=5delay(100):延时205us 误差:205-200=5delay(200):延时405us 误差:405-400=5*******************************************//*****************DS18B20******************/void Init_Ds18b20(void) //DS18B20初始化send reset and initialization command{char presence=1;while(presence){//DQ = 1; //DQ复位,不要也可行。

诺基亚手机用户指南说明书

诺基亚手机用户指南说明书

Philips5000 series Smart UltraHDTV55" class/po4K UHD 2160pHDRWireless LAN 802.11ac MIMO55PFL5703 ArraySmart 4K UltraHDTVYour favorite online content in UltraHDEnjoy true 4K streaming performance with built-in HEVC and VP9 decoders enabling 4Kstreaming on Netflix, YouTube and more services in the future. With a 4K upscaling engine,even your HD videos have never looked better.Enjoy the beauty of 4K Ultra HD•120 Perfect Motion Rate for increased pixel response times•Enjoy HD content in 4K UHD with a 4K upscaling engine•An intelligent dimming backlight for dynamic contrast•Pixel Plus UltraHD for vivid, natural, and real pictures•The beauty of 4K UltraHD TV is in savoring every detail•Expanding the possibilities of visual perceptionComplete digital TV connectivity made simple.•Wireless LAN 802.11ac with MIMO for seamless streaming of 4K•NetTV with Wireless access to online services on your TV•Wirelessly mirror the screen of smart device on your TV•Stunning BrightnessAuthentic and clear sound experience.•20 Watts RMS of rich surround sound to complement 4K images•Immersive sound with clear voice designed by sonic emotionHighlights4K UltraHD4 times the resolution of Full HD brings your viewing experience to the whole new level. Enjoy every detail and the breathtaking beauty of the pictures.High Dynamic RangeHigh Dynamic Range (HDR10) is a technology lets you experience more detail and captivating colors for an even more engaging television experience. More perceivable shades of blacks, whites and all other colors. This boils down to greater perceived brightness and contrast with darker shadows creating a breathtaking image.Pixel Plus Ultra HDExperience Ultra-HD sharpness from Philips. Now you can enjoy your favorite action filmsand sporting events in stunning 4K Ultra HD resolution. And whether you stream online or watch a DVD, Philips' Pixel Plus Ultra-HD Engine delivers sharper images with brighter whites and blacker blacks.Bright ProBrightPro backlith boosts brighter areas of the image by up to twice as much as a regular LED backlight. Bright Pro enables to display exceptional brightness and contrast even in brightly lit rooms. Video scenes which feature bright light sources such as sunlight, fireworks, police lights, flashlights, etc. look more realistic and lifelike.Macro dimmingUsing a proprietary video processing algorithm which measures average luminance level of each video frame, Philips' Macro Dimming intelligent backlight dims the backlight to match every video frame to ensure you have a strain-free life-like viewing experience with bright whites, vivid colors and dark blacks.120 Perfect Motion Rate120 Perfect Motion Rate (PMR) creates extreme motion sharpness for clear and vibrant images in fast action movies. The new Philips PMRstandard reduces response time of the HDTV to produce faster picture transitions and reduces motion artifacts.Net TVPhilips NetTV is built for streaming. With a simple push of a button, gain instant access to popular streaming applications such as Netflix, Vudu, YouTube, all within a clutter-free, easy to use interface. Visit the App Store to download additional content from our extensive entertainment library, with entertainmentoptions to suit everyone. Surf the web on your big screen TV, all without the need ofconnecting a computer. Enjoy smooth streaming of up-to 4K content with the powerful, built-inWireless 802.11ac MIMO Dual-Band chipset.SpecificationsPicture/Display•Aspect ratio: Widescreen(16:9)•Contrast ratio (typical): 1000:1•Response time (typical): 16 ms•Diagonal screen size (inch): 55 inch•Diagonal screen size (metric): 139.7 cm•Panel resolution: 3840x2160p•Picture enhancement: Pixel Plus UltraHD, Black stretch, Digital Noise Reduction, MPEG artifact reduction, 120 PMR, Color Enhancement, Dynamic contrast, Gamma, Macro Dimming•Visible screen diagonal (inch): 54.6 inch •Display screen type: LED UltraHD Display •Viewing angle: 178º (H) / 178º (V)Supported Display Resolution •Computer formats: 640 x 480, 60Hz, 720 x 480, 60Hz, 800 x 600, 60Hz, 1024 x 768, 60Hz, 1280 x 768, 60Hz, 1280 x 1024, 60Hz, 1360 x 768, 60Hz, 1440 x 900, 60 Hz, 1920 x 1080, 60Hz, 1680 x 1050, 60Hz, 1400 x 1050, 60Hz, 3840 x 2160, 60Hz, 4096 x 2160, 60Hz•Video formats: 480i, 60Hz, 480p, 60Hz, 720p, 60Hz, 1080i, 60Hz, 1080p, 24,30,60Hz, 2160p, 24, 30,60HzSound•Equalizer: 5-bands•Output power (RMS): 2 x 10W•Sound System: Sonic Emotion Premium, Stereo, SAP, Dolby AudioLoudspeakers•Built-in speakers: 2Convenience•Child Protection: Child Lock+Parental Control •Clock: Sleep Timer•Ease of Use: AutoPicture, AutoSound, Settings assistant Wizard, Auto Volume Leveling •Remote Control: TV•Screen Format Adjustments: 4:3, Movie expand 14:9, Movie expand 16:9, Super Zoom, Widescreen, unscaled (1080p dot by dot), Full, Automatic •Ease of Installation: Autostore•Multimedia: auto slideshow, USB media browserMultimedia Applications•Multimedia connections: USB Storage Device•Playback Formats: MP3, JPEG Still pictures, MPEG1,MPEG2, H.264/MPEG-4 AVC, H.265/HEVC, AAC,WAVE, AC3, MPEG4Tuner/Reception/Transmission•Aerial Input: 75 ohm F-type•TV system: ATSC, NTSC•Video Playback: NTSC•Tuner bands: UHF, VHFConnectivity•Other connections: Ethernet, Headphone out,Wireless LAN 802.11ac MIMO•EasyLink (HDMI-CEC): One touch play, Powerstatus, System info (menu language), Remote controlpass-through, System audio control, System standby•Audio Output - Digital: Optical (TOSLINK)•AV 1: Shared audio L/R in, CVBS/YPbPr•USB: USB•HDMI1:Shared audio L/R in,HDMI•HDMI 2: Shared audio L/R in, HDMI (Audio ReturnChannel)•HDMI 3: HDMI, Shared audio L/R inPower•Mains power: 120V/60Hz•Power consumption: 135 W•Standby power consumption: &lt; 0.5W•Ambient temperature: 5°C to 40°C (41°F to 104°F)Dimensions•Product weight (lb): 24.0 lb•Box height (inch): 32.0 inch•Box width (inch): 55.7 inch•Box depth (inch): 6.4 inch•Wall mount compatible: 300 x 300 mm•Set Width (inch): 48.7 inch•Set Height (inch): 28.2 inch•Set Depth (inch): 3.7 inch•Set width (with stand) (inch): 48.7 inch•Set depth (with stand) (inch): 8.9 inch•Set height (with stand) (inch): 30.1 inch•Product weight (+stand) (lb): 24.5 lb•Weight incl. Packaging (lb): 33.7 lbAccessories•Included accessories: Table top stand, Quick startguide, User Manual, Remote Control, Batteries forremote control, Screws•Power cord: 59.05 inchNetwork Services•NetTV Apps: Netflix, Vudu, Vewd browser,YouTube, Pandora, Vewd app store, Youtube TV,Showtime Streaming•Network Features: Home Network, WirelessScreencastingIssue date 2023-12-11 Version: 2.1.1UPC: 6 09585 25199 1© 2023 Koninklijke Philips N.V.All Rights reserved.Specifications are subject to change without notice. Trademarks are the property of Koninklijke Philips N.V. or their respective owners.。

nokia5110课程设计

nokia5110课程设计

nokia5110课程设计一、课程目标知识目标:1. 让学生掌握Nokia 5110液晶显示屏的基本原理和操作方法;2. 了解Nokia 5110在图形显示和文字显示方面的应用;3. 学会运用编程语言(如:MicroPython)对Nokia 5110进行控制和编程。

技能目标:1. 能够独立完成Nokia 5110的硬件连接和初始化;2. 掌握使用编程语言对Nokia 5110显示内容进行设计和编写;3. 能够运用所学的知识解决实际问题,如制作简单的电子时钟、小游戏等。

情感态度价值观目标:1. 培养学生对电子产品的兴趣,激发他们探索未知领域的热情;2. 培养学生的团队合作精神,学会与他人共同解决问题;3. 增强学生的环保意识,让他们了解电子废弃物的回收和处理方法。

课程性质:本课程为实践性较强的课程,结合理论讲解和实际操作,让学生在动手实践中掌握知识。

学生特点:六年级学生具有一定的编程基础和电子知识,好奇心强,喜欢动手实践。

教学要求:教师需关注学生的个体差异,因材施教,鼓励学生积极参与,注重培养学生的实践能力和创新精神。

通过本课程的学习,使学生能够将所学知识运用到实际生活中,提高他们的综合素质。

二、教学内容1. Nokia 5110液晶显示屏原理介绍:包括显示屏的硬件结构、工作原理和显示原理。

- 理解显示屏的像素点阵和色彩显示方式。

- 掌握显示屏的初始化和基本操作。

2. 硬件连接与编程环境搭建:- 学习如何将Nokia 5110与微控制器(如Arduino或MicroPython板)连接。

- 搭建编程环境,熟悉相关开发工具的使用。

3. 图形和文字显示编程:- 学习使用编程语言进行图形绘制和文字显示。

- 掌握如何清屏、绘制点、线、矩形和圆形等基本图形。

- 实现文字的滚动显示和特效。

4. 实际应用案例分析与制作:- 分析并制作简单的电子时钟,学习时间管理和中断处理。

- 设计并实现一个简易小游戏,如贪吃蛇或俄罗斯方块,提高逻辑思维能力。

c51单片机程序-nokia5110液晶显示

c51单片机程序-nokia5110液晶显示

高电平表示数据输入 ,低电平表示命令输入 #define LCD_CLK P15 上升沿写入 #define LCD_DIN P23 #define LCD_BL P17 高电平点亮,低电平关闭 code unsigned char { ascii_dot[] = // ASCII 表
0x00,0x00,0x00,0x00,0x00, // - 0x00,0x00,0x5F,0x00,0x00, // -!0x00,0x07,0x00,0x07,0x00, // -"0x14,0x7F,0x14,0x7F,0x14, // -#0x24,0x2E,0x7B,0x2A,0x12, // -$0x23,0x13,0x08,0x64,0x62, // -%0x36,0x49,0x56,0x20,0x50, // -&0x00,0x04,0x03,0x01,0x00, // -'0x00,0x1C,0x22,0x41,0x00, // -(0x00,0x41,0x22,0x1C,0x00, // -)0x22,0x14,0x7F,0x14,0x22, // -*0x08,0x08,0x7F,0x08,0x08, // -+0x40,0x30,0x10,0x00,0x00, // -,0x08,0x08,0x08,0x08,0x08, // --0x00,0x60,0x60,0x00,0x00, // -.0x20,0x10,0x08,0x04,0x02, // -/0x3E,0x51,0x49,0x45,0x3E, // -00x00,0x42,0x7F,0x40,0x00, // -10x62,0x51,0x49,0x49,0x46, // -20x21,0x41,0x49,0x4D,0x33, // -30x18,0x14,0x12,0x7F,0x10, // -40x27,0x45,0x45,0x45,0x39, // -50x3C,0x4A,0x49,0x49,0x31, // -60x01,0x71,0x09,0x05,0x03, // -70x36,0x49,0x49,0x49,0x36, // -80x46,0x49,0x49,0x29,0x1E, // -90x00,0x36,0x36,0x00,0x00, // -:-

诺基亚5110液晶显示器应用课程设计

诺基亚5110液晶显示器应用课程设计

单片机原理及应用课程设计电气工程学院一、课程设计任务书1.课程设计项目诺基亚5110液晶显示器应用。

2.设计内容1)设计诺基亚5110液晶显示器应用的总体设计方案;2)以MCS-51系列单片机为核心器件和诺基亚5110液晶显示器组成液晶显示硬件系统;3)系统程序编制与调试;4)电路系统的综合调试;5)撰写课程设计论文;6)完成课程设计论文答辩。

3.设计要求1)以STC89C51单片机为控制核心,对诺基亚5110液晶显示器进行控制。

编程使得在LCD显示器上显示字符,如多行滚动显示:“吉林工程技术师范学院”“电气工程学院”。

等字符,还可以显示别的文字;2)单片机课程设计题目的硬件电路、程序由学生自行设计完成。

3)液晶显示器上要显示出设计人的班级,组长的学号等信息。

4.设计进度(2011年6月13日至2011年6月24日)时间设计内容第1-2天查阅资料,方案比较、设计与论证,理论分析与计算第3-5天硬件电路调试第6-8天系统调试第9-10天书写报告、答辩5.设计地点新实验楼323微机实验室二.参考资料[1]李广弟,朱月秀,王秀山编著.单片机基础. 北京:北京航空航天大学出版社,2001[2] 何立民编著.MCS-51系列单片机应用系统设计系统配置与接口技术.北京:北京航空航天大学出版社,1999[3] 蔡美琴等编著.MCS-51 单片机系统及应用.北京:高等教育出版社.1992二、评语及成绩成绩:指导教师:单片机原理及应用课程设计班级:自动化0845 姓名:刘旭阳学号: 11 号指导教师:方健撰写日期: 2011年6月23日Nokia LCD多功能显示摘要液晶显示器件[1](LCD)是一种高新技术的基础元器件。

它利用液晶的各种电光效应,把液晶对电场、磁场、光线和温度等外界条件的变化在一定条件下转换为可视信号而制成的显示器。

液晶显示器具有低电压、低功耗的特点,与CMOS集成电路相匹配.电池作为电源,适合于便携式显示。

诺基亚手机操作指南说明书

诺基亚手机操作指南说明书

Push the appropriate edge of the adjustment switch to move the mirror right,left,up,or down.When you finish,move theselector switch to the center (off)position.This turns off the adjustment switch so you can’t move a mirror out of position by accidentally bumping the switch.Keep the inside and outside mirrors clean and adjusted for best visibility.Be sure to adjust the mirrors before you start driving.The inside mirror has day and night positions.The night position reduces glare from headlights behind you.Flip the tab on the bottom edge of the mirror to select the day or night position.3.4.Mirrors114The outside mirrors are heated to re-move fog and frost.With the ignition switch ON (II),turn on the heaters by pressing the button.The light in the button comes on as a reminder.Press the button again to turn the heaters off.Sitting on or getting under the table,or putting heavy objects on the table,may damage or deform it.Do not put any items on the table while driving.They may fall down or fly around when you go around corners or brake hard.On EX and EX-L models in CanadaMirrors,Center Table115The center table has a beverage holder for the front passengers.To use the front beverage holder,pull on the handle.Push the holder all the way in to close it.Only on vehicles with an automatic transmissionBeverage Holders116CONTINUEDTo remove the table,pull up thecarpet.Lift and pull on the handle toslide the table out.Be careful when you are using thebeverage holder.A spilled liquid thatis very hot can scald you or yourpassengers.Spilled liquids can alsodamage the upholstery,carpeting,and electrical components in theinterior.Beverage Holders,Built-in Table117Unfold the legs.Lock them in place by pushing on the middle of the locking arms.Make sure all four are locked.To put the table back in place,hold on to the handle and put the projection on the table into the hole in the cargo area floor.Built-in Table118Be sure to lock the legs of the table.Do not stand on the table.Do not put a weight of over 44lbs (20kg)on the table.Hot items such as pots,pans,or kettles should not be placed directly on the table top.A storage box is located under the front passenger’s seat.To use it,pull upward slightly on the front center edge of the box and slide it out.CONTINUEDStorage BoxBuilt-in Table,Center Pocket,Storage BoxUsing the Built-in Table119To remove the box for cleaning,pull upward on the front center edge to disengage the locking tabs under the seat bottom,then pull the box out.The coin tray is located on the center dashboard.To open the coin tray,pull on the bottom edge.Close it with a firm push.The light in the tray comes on when the instrument panel lights are on.Only on vehicles with a manual transmissionCoin TrayStorage Box,Driver’s Pocket,Coin Tray120。

诺基亚5110液晶使用及显示程序实例

诺基亚5110液晶使用及显示程序实例

该模块具有以下特点:●84x48 的点阵LCD,可以显示4 行汉字,●采用串行接口与主处理器进行通信,接口信号线数量大幅度减少,包括电源和地在内的信号线仅有9 条。

支持多种串行通信协议(如AVR 单片机的SPI、MCS51 的串口模式0等),传输速率高达4Mbps,可全速写入显示数据,无等待时间。

●可通过导电胶连接模块与印制版,而不用连接电缆,用模块上的金属钩可将模块固定到印制板上,因而非常便于安装和更换。

●LCD 控制器/驱动器芯片已绑定到LCD 晶片上,模块的体积很小。

●采用低电压供电,正常显示时的工作电流在200μA 以下,且具有掉电模式。

LPH7366 的这些特点非常适合于电池供电的便携式通信设备和测试设备中C8051F学习笔记:Nokia 5110驱动Nokia5110是一款经典机型,可能由于经典的缘故,旧机器很多,所以很多电子工程师就把旧机器的屏幕拆下来,自己驱动Nokia5110,用于开发的设备显示,取代LCD1602。

使用Nokia5110液晶的四大理由1)性价比高,LCD1602可以显示32个字符,而Nokia5110可以显示15个汉字,30个字符。

Nokia5110裸屏仅8.8元,LCD1602一般15元左右,LCD 12864一般50~70元。

2)接口简单,仅四根I/O线即可驱动,LCD1602需11根I/O线,LCD12864需12根。

3)速度快,是LCD12864的20倍,是LCD1602的40倍。

4)Nokia5110工作电压3.3V,正常显示时工作电流200uA以下,具有掉电模式,适合电池供电的便携式移动设备。

可以在市场上买到Nokia5110的裸屏和带PCB的Nokia5110屏幕,因为N okia5110是不带背光的,所以通常商家会在PCB上按了几个背光LED,上电就能亮,建议大家还是买那种连上PCB的5110。

Nokia5110原理图:商家把该引出的管脚都引出了,下面就可以连接C8051F的相应管脚,写程序驱动5110了。

5110说明书

5110说明书
辅助输入3
11Auxiliary input4active
辅助输入4
12Auxiliary input 5active
辅助输入5
13.Preheat mode 1
预热模式1
14Preheat mode 2
预热模式2
15Preheat mode 3
预热模式3
16.Warning alarm
警告报警
mon alarm
辅助输入5
13.Preheat mode 1
预热模式1
14Preheat mode 2
预热模式2
15Preheat mode 3
预热模式3
16.Warning alarm
警告报警
mon alarm
公共报警
30.LCD 4
液晶显示4
0.Unused
不用
1.Preheat mode 0
预热模式
2.Lmmediate,warning close to activate
即时,警告,关闭去动作
3.Lmmediate,warning open to activate
即时,警告,打开去动作
4.Delayde,Shutdownclose to activate
延时,停止,关闭去动作
5.Delayde,Shutdownopen to activate
3.Datcon high
21.Fast loading
cnabled
0.No(常用)
快速加载
1.Yes
22.AC system
交流系统
1.1phase 2 wire
1相四线
3相四线
3.3 phases 4 wires(常用)

诺基亚5110LCD驱动程序

诺基亚5110LCD驱动程序

/******************************************************************** 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 },// ({ 0x00, 0x00, 0x41, 0x22, 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 },// 0{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },// 1{ 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, 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, 0x14, 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 },// 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, 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, 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 },// [ { 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, 0x44, 0x44, 0x44, 0x20 },// c { 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },// d { 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },// 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, 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 },// 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, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },// y{ 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },// z{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 }};/****************************Nokia5110初始化函数**************************//*函数原型:initNokia5110(void)/*函数功能:Nokia5110初始化/*输入参数:无/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/void initNokia5110(void){delay(10); //系统复位res = 0;delay(2);res = 1;dc = 0;write_byte(0x21); //;芯片是活动的(PD=0) 使用扩展指令集write_byte(0xd5);write_byte(0x20); //;芯片是活动的(PD=0) 使用水平寻址(V=0) 使用基本指令集(H=0) write_byte(0x0c); //;设置显示配置(D=1 E=0)}/****************************Nokia5110清屏函数*********************//*函数原型:void clearNokia5110(void)/*函数功能:Nokia5110清屏/*输入参数:无/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/void clearNokia5110(void){unsigned int i,j;for(i=0;i<6;i++){setxy(j,i);dc = 1;while (j<84){write_byte(0x00);j++;}j = 0;}}/*--------------------------------------;模块名称:Display_char(unsigned char x,unsigned char y,char *s);;功能:写字符;占用资源:;参数说明:x 设置显示字符的X位置; y 设置显示字符的Y位置*s 显示字符的首地址;创建日期:2001.01.19;版本:VER 2.0 ★STALI☆;-------------------------------------*/void Display_char(unsigned char x,unsigned char y,char *s){unsigned char line;setxy(x,y);while(*s){for(line=0;line<6;line++){dc = 1;write_byte(asc2tab[*s - 32][line]);}}sce = 1;}/****************************Nokia5110写数字函数*********************/ /*函数原型:void Display_num(unsigned char x,unsigned char y,char s)/*函数功能:Nokia5110写数字/*输入参数:x 设置显示字符的X位置; y 设置显示字符的Y位置s 显示数字/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/ void Display_num(unsigned char x,unsigned char y,char s){unsigned char line;setxy(x,y);dc = 1;for(line=0;line<6;line++){write_byte(asc2tab[s+16][line]);}sce = 1;}/*************************Nokia5110发送1字节函数*********************/ /*函数原型:void Display_num(unsigned char x,unsigned char y,char s)/*函数功能:发送1字节到NOkia 5110/*输入参数:x 设置显示字符的X位置; y 设置显示字符的Y位置s 显示数字/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/ void write_byte(unsigned char data1){unsigned char i;res = 1;sce = 0;for(i=0;i<8;i++){sdin = (bit) (data1&0x80);;sclk = 1;data1 <<=1;}}/*************************Nokia5110设置显示坐标函数*********************/ /*函数原型:void setxy(unsigned char x,unsigned char y)/*函数功能:设置显示坐标/*输入参数:unsigned char x 行坐标(0-83) unsigned char y 列坐标(0-5)/*输出参数:无/*调用模块:/*建立时间:2006/10/1/*作者:站长/**********************************************************************/ void setxy(unsigned char x,unsigned char y){dc = 0;write_byte(y|0x40); //设置y轴。

NOKIA5110参考程序

NOKIA5110参考程序

//说明:以下函数在STM32F405RGT6上验证过,应用于其他条件下根据自身需要做移植//nokia5110.h//********************* nokia5110.h *********************////串行线协议,并非I2c总线协议,可达4MHz//84*48 14*6个6*8字符左上角为(0,0) 纵向六个字节,可水平会垂直寻址//高位在下面,先写入高位工作电压2.7V~3.3V 六根线控制背光线可省//********************* nokia5110.h *********************//#include "stm32f4xx.h"//*****************调试函数启用****************////#define Nokia5110_debug 1#ifdef Nokia5110_debugvoid Nokia5110_dbg(void);#endif//*********************IO引脚定义*********************//Nokia5110: PC0-RST CS-PC1 DC-PC2 Din-PC3 PA0-CLK PA1-BL//注:!!要对IO进行设置,设置在其他文件中,为包含在本WORD文档中//液晶背光控制#define lcd_lbg_1 G PIOA->BSRRL=GPIO_Pin_1 //背光高电平亮#define lcd_lbg_0 G PIOA->BSRRH=GPIO_Pin_1 //背光低电平灭#define lcd_rst_1 GPIOC->BSRRL=GPIO_Pin_0 //复位,0复位#define lcd_ce_1 GPIOC->BSRRL=GPIO_Pin_1 //片选端口#define lcd_dc_1 GPIOC->BSRRL=GPIO_Pin_2 //数据1/指令0#define lcd_da_1 GPIOC->BSRRL=GPIO_Pin_3 //数据#define lcd_clk_1 GPIOA->BSRRL=GPIO_Pin_0 //时钟(4Mhz)#define lcd_rst_0 GPIOC->BSRRH=GPIO_Pin_0 //复位,0复位#define lcd_ce_0 GPIOC->BSRRH=GPIO_Pin_1 //片选端口#define lcd_dc_0 GPIOC->BSRRH=GPIO_Pin_2 //数据1/指令0#define lcd_da_0 GPIOC->BSRRH=GPIO_Pin_3 //数据#define lcd_clk_0 GPIOA->BSRRH=GPIO_Pin_0 //时钟(4Mhz)//*********************IO引脚定义*********************//*********************nokia5110命令定义*********************#define kongbai 0x08 //显示空白#define zhengchang 0x0c //显示正常#define quanxian 0x09 //全部显示#define fanzhuan 0x0d //显示反转#define pd_h_kz 0x80;//显示空白//*********************nokia5110命令定义*********************//***********************字库定义声明************************//6 x 8ascii码,0x10--0x1f可以自定义externconst u8 font6x8[128][6];//8*16 数字字母字小写asc码-0x57externconst u8 font8x16[36][16];//0_哈//1_尔//2_滨//3_工//4_程//5_大//6_学//7_图//8_书//9_馆externconst u8 hanzi[10][32];//数据水平字节垂直,40*40qq图片externconst u8 Image_QQ[200];//*********************字库定义声明************************//***********************函数声明**************************//写入的数据voidlcdwrdat(u8 dat);//连续写入的数据,*s为字符数组或字符串ascii码voidlcdwrcom(u8 com);void lcdclear(void);//清屏//lcd反清屏函数voidlcdall(void);//5110lcd初始化函数上电100ms内完成voidlcd_init(void);//**0<=x<=83,0<=y<=47,设置坐标voidlcd_set_xy(u8 x,u8 y);//**0<=x<=13,0<=y<=5,写一个字符dat为asc码voidlcddispone(u8 x,u8 y,u8 dat);//**0<=x<=13,0<=y<=5,写字符串*s字符串或字符数组,num为数据长度voidlcddispmore(u8 x,u8 y,u8 num,u8 *s);//**0<=x<=13,0<=y<=5,写字符串*s字符串或字符数组voidlcddispstr(u8 x,u8 y,u8 *s);//**0<=x<=9,0<=y<=5,写8x16数字或小写字母voidlcd_write_shu(u8 x, u8 y,u8 dat);//**0<=x<=9,0<=y<=5,写16x16汉字index为汉字编号如0_哈voidlcd_write_hanzi(u8 x, u8 y,u8 index);//**0<=x<=83,0<=y<=5,显示图片,width为宽度,hight为高度自动除8 如40*40 voidlcddispimage(u8 x,u8 y,u8 *s,u8 width,u8 hight);//显示10位数占用11位voiddisp_long(u8 x,u8 y,longdat);//有符号数显示,占6位void disp_s16(u8 x,u8 y,s16 dat);//8位无符号数显示,占3位void disp_u8(u8 x,u8 y,u8 dat);//8位数HEX码显示,占2位voiddisp_hex(u8 x,u8 y,u8 dat);//16位数HEX码显示,占4位void disp_hex2(u8 x,u8 y,u16 dat);//32位数HEX码显示,占8位void disp_hex4(u8 x,u8 y,u32 dat);//***********************函数声明**************************/*函数调用示例lcd_lbg_1; //开背光lcd_init(); //初始化lcd模块lcdclear(); //清屏幕for(i=0;i<2;i++)for(j=0;j<5;j++)lcd_write_hanzi(j,i,j*5+i);lcddispmore(0,4,6,"shgued");lcddispmore(0,5,6,"shgued");lcddispone(6,4,0x30);lcddispone(7,4,'1');lcddispone(6,5,0x32);lcddispone(7,5,'3');lcd_write_shu(6,5,'4');lcd_write_shu(9,5,'9');delay(2000);lcdclear(); //清屏幕lcddispimage(10,1,(u8*)Image_QQ,40,40);//??u8**///Nokia5110.c//********************* Nokia5110.c *********************////串行线协议,并非I2c总线协议,可达4MHz(实际上上可以比这快,自己验证下,改变下面系统频率)//84*48 14*6个6*8字符左上角为(0,0) 纵向六个字节,可水平会垂直寻址//高位在下面,先写入高位工作电压2.7V~3.3V 六根线控制背光线可省//********************* Nokia5110.c *********************//#include "stm32f4xx.h"#include "Nokia5110.h"#define lcd_adress_check 1 //地址范围检验功能启用//Nokia5110延时,系统频率定义!!根据需要设置//#define cpuclk_84Mhz//#define cpuclk_72Mhz//#define cpuclk_144Mhz//#define cpuclk_168Mhz//#define cpuclk_48Mhz//#define cpuclk_24Mhz#define cpuclk_16Mhz//72Mhz 1 6*(n+1)个nop//#define delay_4Mhz for(lcd_cnt=0;lcd_cnt<3;lcd_cnt++)//0.125us//72Mhz 9clk 4Mhz *2#ifdef cpuclk_84Mhz#define delay_4Mhz __asm("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop")#elifdefined cpuclk_72Mhz#define delay_4Mhz __asm("nop;nop;nop;nop;nop;nop;nop;nop;nop")#elifdefined cpuclk_144Mhz#define delay_4Mhz__asm("nop;nop;nop;nop;nop;nop;nop;nop;nop");__asm("nop;nop;nop;nop;nop;nop;nop;n op;nop")#elifdefined cpuclk_168Mhz#define delay_4Mhz__asm("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop");__asm("nop;nop;nop;nop;nop;n op;nop;nop;nop;nop;nop");__asm("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop")#elifdefined cpuclk_48Mhz#define delay_4Mhz __asm("nop;nop;nop;nop;nop;nop")#elifdefined cpuclk_24Mhz#define delay_4Mhz __asm("nop;nop;nop")#elifdefined cpuclk_16Mhz#define delay_4Mhz __asm("nop;nop")#else#define delay_4Mhz __asm("nop")#endif//6 x 8ascii码,0x10--0x1f可以自定义//右上5*7 字节倒序高位在下const u8 font6x8[128][6] ={{ 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E }, //0x00// 0 ??{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 }, //0x01// 1{ 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 }, //0x02// 2{ 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 }, //0x03// 3{ 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 }, //0x04// 4{ 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 }, //0x05// 5{ 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 }, //0x06// 6{ 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 }, //0x07// 7{ 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 }, //0x08// 8{ 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 }, //0x0a// *{ 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 }, //0x0b// +{ 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 }, //0x0c// ,{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 }, //0x0d// -{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 }, //0x0e// .{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 }, //0x0f// /{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, //0x10// sp{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 }, //0x11// !{ 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 }, //0x12// "{ 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 }, //0x13// #{ 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, //0x14// ${ 0x00, 0x23, 0x13, 0x08, 0x64, 0x62 }, //0x15// % ?{ 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 }, //0x16// &{ 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 }, //0x17// '{ 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 }, //0x18// ({ 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 }, //0x19// ){ 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 }, //0x1a// *{ 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 }, //0x1b// +{ 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 }, //0x1c// ,{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 }, //0x1d// -{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 }, //0x1e// .{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 }, //0x1f// / ??{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, //0x20// sp{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 }, //0x21// !{ 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 }, //0x22// "{ 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 }, //0x23// #{ 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 }, //0x24// ${ 0x00, 0x23, 0x13, 0x08, 0x64, 0x62 }, //0x25// %{ 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 }, //0x26// & { 0x00, 0x04, 0x08, 0x10, 0x20, 0x40 }, //0x27// \ 换行{ 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 }, //0x28// ({ 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 }, //0x29// ){ 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 }, //0x2a// *{ 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 }, //0x2b// +{ 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 }, //0x2c// ,{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 }, //0x2d// -{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 }, //0x2e// .{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 }, //0x2f// /{ 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E }, //0x30// 0{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 }, //0x31// 1{ 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 }, //0x32// 2{ 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 }, //0x33// 3{ 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 }, //0x34// 4{ 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 }, //0x36// 6 { 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 }, //0x37// 7 { 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 }, //0x38// 8 { 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E }, //0x39// 9 { 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 }, //0x3a// : { 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 }, //0x3b// ; { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 }, //0x3c// < { 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 }, //0x3d// = { 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 }, //0x3e// > { 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 }, //0x3f// ? { 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E }, //0x40// @ { 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C }, //0x41// A { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 }, //0x42// B { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 }, //0x43// C { 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C }, //0x44// D { 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 }, //0x45// E { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 }, //0x46// F { 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A }, //0x47// G { 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F }, //0x48// H { 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 }, //0x49// I { 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 }, //0x4a// J { 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 }, //0x4b// K { 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 }, //0x4c// L { 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F }, //0x4d// M { 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F }, //0x4e// N { 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E }, //0x4f// O { 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 }, //0x50// P { 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E }, //0x51// Q { 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 }, //0x52// R { 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 }, //0x53// S { 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 }, //0x54// T { 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F }, //0x55// U { 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F }, //0x56// V { 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F }, //0x57// W { 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 }, //0x58// X { 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 }, //0x59// Y { 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 }, //0x5a// Z { 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 }, //0x5b// [ { 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 }, //0x5c// \\? { 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 }, //0x5d// ] { 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 }, //0x5e// ^ { 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 }, //0x5f// _ { 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 }, //0x60// '{ 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 }, //0x62// b{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 }, //0x63// c{ 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F }, //0x64// d{ 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 }, //0x65// e{ 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 }, //0x66// f{ 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C }, //0x67// g{ 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 }, //0x68// h{ 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 }, //0x69// i{ 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 }, //0x6a// j{ 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 }, //0x6b// k{ 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 }, //0x6c// l{ 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 }, //0x6d// m{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 }, //0x6e// n{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 }, //0x6f// o{ 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 }, //0x70// p{ 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC }, //0x71// q{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 }, //0x72// r{ 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 }, //0x73// s{ 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 }, //0x74// t{ 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C }, //0x75// u{ 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C }, //0x76// v{ 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C }, //0x77// w{ 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 }, //0x78// x{ 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C }, //0x79// y{ 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 }, //0x7a// z{ 0x00, 0x18, 0x7E, 0x81, 0x00, 0x00 }, //0x7b// {{ 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00 }, //0x7c// |{ 0x00, 0x00, 0x81, 0x7E, 0x18, 0x00 }, //0x7d// }{ 0x00, 0x04, 0x08, 0x04, 0x02, 0x04 }, //0x7e// ~{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 } //0x7f// horiz lines};//8*16 数字字母字母小写asc码-0x57const u8 font8x16[36][16]={/*-- 文字: 0 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00},/*-- 文字: 1 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00}, /*-- 文字: 2 --*/{0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00},/*-- 文字: 3 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00},/*-- 文字: 4 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00},/*-- 文字: 5 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00},/*-- 文字: 6 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00},/*-- 文字: 7 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},/*-- 文字: 8 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00},/*-- 文字: 9 --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00},/*-- 文字: a --10*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20},/*-- 文字: b --11*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00},/*-- 文字: c --12*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00}, /*-- 文字: d --13*/{0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20},/*-- 文字: e --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00},/*-- 文字: f --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*-- 文字: g --16*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00},/*-- 文字: h --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20},/*-- 文字: i --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*-- 文字: j --19*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00},/*-- 文字: k --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00},/*-- 文字: l --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00},/*-- 文字: m --22*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F},/*-- 文字: n --23*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20}, /*-- 文字: o --24*/{0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00},/*-- 文字: p --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00},/*-- 文字: q --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80},/*-- 文字: r --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00},/*-- 文字: s --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00},/*-- 文字: t --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00},/*-- 文字: u --30*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20},/*-- 文字: v --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00},/*-- 文字: w --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00},/*-- 文字: x --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00},/*-- 文字: y --*//*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/{0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00}, /*-- 文字: z --35*/{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00} };//******************************************//0_哈//1_尔//2_滨//3_工//4_程//5_大//6_学//7_图//8_书//9_馆//******************************************const u8 hanzi[10][32]={/*-- 文字: 哈--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x00,0xFC,0x04,0x04,0xFC,0x20,0x50,0x48,0x44,0x43,0x44,0x48,0x50,0x20,0x20,0x00, 0x00,0x0F,0x04,0x04,0x0F,0x00,0xFE,0x42,0x42,0x42,0x42,0x42,0xFE,0x00,0x00,0x00},/*-- 文字: 尔--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x80,0x40,0x20,0x18,0x0F,0x08,0x08,0xE8,0x08,0x08,0x08,0x08,0x28,0x18,0x00,0x00, 0x20,0x10,0x08,0x06,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x02,0x04,0x08,0x30,0x00},/*-- 文字: 滨--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x10,0x60,0x02,0x0C,0xD0,0x0C,0xE4,0x24,0x25,0x26,0x24,0x14,0x04,0x14,0x0C,0x00, 0x04,0x04,0x7C,0x03,0x08,0x88,0x4F,0x29,0x09,0x09,0x09,0x2F,0x49,0x89,0x08,0x00},/*-- 文字: 工--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x00,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00},/*-- 文字: 程--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x24,0x24,0xA4,0xFE,0x23,0x22,0x00,0x3E,0x22,0x22,0x22,0x22,0x22,0x3E,0x00,0x00, 0x08,0x06,0x01,0xFF,0x01,0x06,0x40,0x49,0x49,0x49,0x7F,0x49,0x49,0x49,0x41,0x00},/*-- 文字: 大--*///5/*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, 0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00},/*-- 文字: 学--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00},/*-- 文字: 图--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x00,0xFE,0x02,0x42,0x22,0x32,0x5E,0x92,0x52,0x32,0x12,0x02,0x02,0xFE,0x00,0x00,0x00,0xFF,0x42,0x42,0x42,0x51,0x55,0x64,0x69,0x41,0x42,0x42,0x42,0xFF,0x00,0x00},/*-- 文字: 书--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x00,0x00,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0xF9,0x02,0x04,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x21,0x41,0x21,0x1F,0x00,0x00},/*-- 文字: 馆--*//*-- Trebuchet MS12; 此字体下对应的点阵为:宽x高=16x16 --*/{0x40,0x30,0x8F,0x28,0x18,0x10,0x0C,0xE4,0x24,0x25,0x26,0x24,0xE4,0x14,0x0C,0x00,0x00,0x00,0x7F,0x20,0x10,0x00,0x00,0xFF,0x49,0x49,0x49,0x49,0x49,0xF8,0x00,0x00}};//数据水平字节垂直,40*40qq图片const u8 Image_QQ[200] = {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC0,0XE0,0XF0,0XF8,0XE8,0XF4,0XF4,0X7E,0X7E,0X7E,0XFF,0XFF,0XFE,0XFE,0X7E,0X7E,0XFC,0XFC,0XF8,0XF0,0XF0,0XC0,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X10,0X70,0XF0,0XF8,0XF0,0XE0,0XC0,0X80,0XFC,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X7F,0X61,0X61,0X60,0X60,0X7F,0X7F,0X73,0X67,0X43,0X40,0XE0,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFE,0XC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X03,0X07,0X0F,0X1F,0XFF,0XFF,0X7F,0X7F,0XFF,0XFF,0XEC,0XFE,0XDC,0XDC,0XD8,0XB8,0XB8,0XB8,0XB8,0XF8,0XF8,0XF8,0XFC,0XFE,0XFE,0XFD,0XFF,0XFF,0XFF,0X7F,0XFF,0XFF,0XFF,0XF0,0XE0,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X7F,0XC0,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X03,0X03,0X03,0X03,0X03,0X03,0X03,0X03,0X3F,0X7F,0X7F,0X7F,0X7F,0X3F,0X00,0X80,0XE0,0XFF,0X3F,0X1F,0X3F,0X7F,0X7E,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X38,0X44,0X41,0X83,0X86,0X8C,0X88,0X90,0XB0,0XA0,0XE0,0X60,0X60,0X20,0X20,0X20,0X60,0X60,0XE0,0XB0,0XB0,0X98,0X98,0X8C,0X86,0X87,0X41,0X48,0X30,0X00,0X00,0X00,0X00};/* Private typedef -----------------------------------------------------------*//* Private define ------------------------------------------------------------*//* Private macro -------------------------------------------------------------*//* Private variables ---------------------------------------------------------*///*//写入的数据voidlcdwrdat(u8 dat){u8i;lcd_clk_1;lcd_ce_0; //负边沿使能芯片lcd_dc_1;//第八个sclk正边沿被读出for(i=0;i<8;i++)//先位7{if(dat&0x80)lcd_da_1;//正边沿取样elselcd_da_0;dat=dat<<1;lcd_clk_0;delay_4Mhz;lcd_clk_1;delay_4Mhz;}lcd_ce_1;delay_4Mhz;}//连续写入的数据,*s为字符数组或字符串ascii码voidlcdwrdat_cont(u8 *s,u8 num){u8i,j,dat;lcd_ce_0; //负边沿使能芯片lcd_dc_1;//第八个sclk正边沿被读出lcd_clk_1;for(j=0;j<num;j++){dat=*s;for(i=0;i<8;i++)//先位7{if(dat&0x80)lcd_da_1;//正边沿取样elselcd_da_0;dat=dat<<1;lcd_clk_0;delay_4Mhz;lcd_clk_1;delay_4Mhz;}s++;}lcd_ce_1;delay_4Mhz;}//写入指令voidlcdwrcom(u8 com){u8i;lcd_clk_1;lcd_ce_0;lcd_dc_0;for(i=0;i<8;i++){if(com&0x80)lcd_da_1;elselcd_da_0;com=com<<1;lcd_clk_0;delay_4Mhz;lcd_clk_1;delay_4Mhz;}lcd_ce_1;delay_4Mhz;}//5110lcd初始化函数上电100ms内完成voidlcd_init(void){unsignedinti;lcd_ce_0;//<30ms内lcd_rst_0;//delay(1);//>100nsfor(i=0;i<100000;i++);//没明显效果lcd_rst_1;lcdwrcom(0x21);//lcd功能设置:芯片活动,水平寻址,使用扩展指令lcdwrcom(4+0x10);//1:48//对于有些NOKIA5110,VOP值设置不对显示不出东西,有一个函数用来调试选出合适的值lcdwrcom(54+0x80);//设置VOP值,没有明显效果,0<vop<90//Vlcd=3.06+(VOP)*0.06,本例VOP为0B0101 0000为十进制的80,Vlcd=7.86Vlcdwrcom(0x20);//lcd功能设置:芯片活动,水平寻址,使用基本指令lcdwrcom(0x0C);//设定显示配置:普通模式}//**0<=x<=83,0<=y<=47,设置坐标voidlcd_set_xy(u8 x, u8 y){lcdwrcom(0x40 | y);lcdwrcom(0x80 | x);}//lcd清屏函数voidlcdclear(void){u8t,k,i;lcd_set_xy(0,0);lcd_clk_1;lcd_ce_0; //负边沿使能芯片lcd_dc_1;//第八个sclk正边沿被读出lcd_da_0;for(t=0;t<6;t++){for(k=0;k<84;k++){//lcdwrdat(0x00);for(i=0;i<8;i++)//先位7{lcd_clk_1;delay_4Mhz;lcd_clk_0;delay_4Mhz;}}}lcd_ce_1;delay_4Mhz;}//lcd反清屏函数voidlcdall(void){u8t,k,i;lcd_set_xy(0,0);lcd_clk_1;lcd_ce_0; //负边沿使能芯片lcd_dc_1;//第八个sclk正边沿被读出lcd_da_1;for(t=0;t<6;t++){for(k=0;k<84;k++){//lcdwrdat(0x00);for(i=0;i<8;i++)//先位7{lcd_clk_1;delay_4Mhz;lcd_clk_0;delay_4Mhz;}}}lcd_ce_1;delay_4Mhz;}//**0<=x<=13,0<=y<=5,写一个字符dat为asc码voidlcddispone(u8 x,u8 y,u8 dat){u8i;#ifdeflcd_adress_checkif(x>13) x=13;if(y>5) y=5;#endiflcdwrcom(0x40 | y);// columnlcdwrcom(0x80 | x*6);// rowfor (i=0; i<6; i++)lcdwrdat(font6x8[dat][i]);}//**0<=x<=13,0<=y<=5,写字符串*s字符串或字符数组,num为数据长度voidlcddispmore(u8 x,u8 y,u8 num,u8 *s){u8i,j;#ifdeflcd_adress_checkif(x>13) x=13;if(y>5) y=5;#endiflcdwrcom(0x40 | y);// columnlcdwrcom(0x80 | x*6);// rowfor(j=0;j<num;j++){for (i=0; i<6; i++)lcdwrdat(font6x8[*s][i]);s++;if(*s=='\0')break;}}//**0<=x<=13,0<=y<=5,写字符串*s字符串或字符数组voidlcddispstr(u8 x,u8 y,u8 *s){#ifdeflcd_adress_checkif(x>13) x=13;if(y>5) y=5;#endiflcdwrcom(0x40 | y);// columnlcdwrcom(0x80 | x*6);// rowwhile(*s!='\0'){lcdwrdat_cont((u8*)font6x8[*s],6);s++;}}//**0<=x<=9,0<=y<=5,写8x16数字或小写字母voidlcd_write_shu(u8 x, u8 y,u8 dat){u8i;#ifdeflcd_adress_checkif(x>9) x=9;if(y>2) y=2;#endifx=x<<3;y=y<<1;lcd_set_xy(x, y);// 列,页for(i=0; i<8;i++){lcdwrdat(font8x16[dat][i]);}lcd_set_xy(x, y+1);// 列,页for(i=8; i<16;i++){lcdwrdat(font8x16[dat][i]);}}//**0<=x<=9,0<=y<=5,写16x16汉字index为汉字编号如0_哈void lcd_write_hanzi(u8 x, u8 y,u8 index) //row:列page:页dd:字符{u8i;#ifdeflcd_adress_checkif(x>4) x=4;if(y>2) y=2;#endifx=x<<4;y=y<<1;lcd_set_xy(x, y);// 列,页for(i=0; i<16;i++){lcdwrdat(hanzi[index][i]);}lcd_set_xy(x, y+1);// 列,页for(i=16; i<32;i++){lcdwrdat(hanzi[index][i]);}}//**0<=x<=83,0<=y<=5,显示图片,width为宽度,hight为高度自动除8 如40*40 voidlcddispimage(u8 x,u8 y,u8 *s,u8 width,u8 hight){u8i,j,k,wid,hig,dat;hight=hight/8;if((x+width)>84)wid=84-x;elsewid=width;if((y+hight)>6)hig=6-y;elsehig=hight;for(j=0;j<hig;j++){lcdwrcom(0x40 | y+j);lcdwrcom(0x80 | x);lcd_ce_0; //负边沿使能芯片lcd_dc_1;//第八个sclk正边沿被读出lcd_clk_1;for(i=0;i<wid;i++)//先位7{dat=*s;for(k=0;k<8;k++){if(dat&0x80)lcd_da_1;//正边沿取样elselcd_da_0;dat<<=1;lcd_clk_0;delay_4Mhz;lcd_clk_1;delay_4Mhz;}s++;}s=s-wid+width;}lcd_ce_1;delay_4Mhz;}//*//显示10位数占用11位voiddisp_long(u8 x,u8 y,longdat){u8disp[12];if(dat>=0) disp[0]=' ';else{disp[0]='-';dat=-dat;}disp[1]=dat/1000000000+48;disp[2]=dat/100000000%10+48;disp[3]=dat/10000000%10+48;disp[4]=dat/1000000%10+48;disp[5]=dat/100000%10+48;disp[6]=dat/10000%10+48;disp[7]=dat/1000%10+48;disp[8]=dat/100%10+48;disp[9]=dat/10%10+48;disp[10]=dat%10+48;disp[11]='\0';if(disp[1]=='0'){disp[1]=disp[0];disp[0]=' ';if(disp[2]=='0'){disp[2]=disp[1];disp[1]=' ';if(disp[3]=='0'){disp[3]=disp[2];disp[2]=' ';if(disp[4]=='0'){disp[4]=disp[3];disp[3]=' ';if(disp[5]=='0'){disp[5]=disp[4];disp[4]=' ';if(disp[6]=='0'){disp[6]=disp[5];disp[5]=' ';if(disp[7]=='0'){disp[7]=disp[6];disp[6]=' ';if(disp[8]=='0'){disp[8]=disp[7];disp[7]=' ';if(disp[8]=='0'){disp[9]=disp[8];disp[8]=' ';}}}}}}}}}lcddispmore(x,y,11,disp);}//16位有符号数显示,占6位void disp_s16(u8 x,u8 y,s16 dat){u8disp[6];if(dat<0){disp[0]='-';dat=-dat;}else{disp[0]=' ';}disp[1]=dat/10000+0x30;disp[2]=dat/1000%10+0x30;disp[3]=dat/100%10+0x30;disp[4]=dat/10%10+0x30;disp[5]=dat%10+0x30;if(disp[1]==0x30){disp[1]=disp[0];disp[0]=' ';if(disp[2]==0x30){disp[2]=disp[1];disp[1]=' ';if(disp[3]==0x30){disp[3]=disp[2];disp[2]=' ';if(disp[4]==0x30){disp[4]=disp[3];disp[3]=' ';。

(整理)诺基亚LCD5110液晶接线图和程序

(整理)诺基亚LCD5110液晶接线图和程序

该模块具有以下特点:●84x48 的点阵LCD,可以显示4 行汉字,●采用串行接口与主处理器进行通信,接口信号线数量大幅度减少,包括电源和地在内的信号线仅有9 条。

支持多种串行通信协议(如AVR 单片机的SPI、MCS51 的串口模式0等),传输速率高达4Mbps,可全速写入显示数据,无等待时间。

●可通过导电胶连接模块与印制版,而不用连接电缆,用模块上的金属钩可将模块固定到印制板上,因而非常便于安装和更换。

●LCD 控制器/驱动器芯片已绑定到LCD 晶片上,模块的体积很小。

●采用低电压供电,正常显示时的工作电流在200μA 以下,且具有掉电模式。

LPH7366 的这些特点非常适合于电池供电的便携式通信设备和测试设备中C8051F学习笔记:Nokia 5110驱动Nokia5110是一款经典机型,可能由于经典的缘故,旧机器很多,所以很多电子工程师就把旧机器的屏幕拆下来,自己驱动Nokia5110,用于开发的设备显示,取代LCD1602。

使用Nokia5110液晶的四大理由1)性价比高,LCD1602可以显示32个字符,而Nokia5110可以显示15个汉字,30个字符。

Nokia5110裸屏仅8.8元,LCD1602一般15元左右,LCD12864一般50~70元。

2)接口简单,仅四根I/O线即可驱动,LCD1602需11根I/O线,LCD12864需12根。

3)速度快,是LCD12864的20倍,是LCD1602的40倍。

4)Nokia5110工作电压3.3V,正常显示时工作电流200uA以下,具有掉电模式,适合电池供电的便携式移动设备。

可以在市场上买到Nokia5110的裸屏和带PCB的Nokia5110屏幕,因为Nokia5110是不带背光的,所以通常商家会在PCB上按了几个背光LED,上电就能亮,建议大家还是买那种连上PCB的51 10。

Nokia5110原理图:商家把该引出的管脚都引出了,下面就可以连接C8051F的相应管脚,写程序驱动5110了。

ESP8266点亮nokia5110,打造自己的小电视

ESP8266点亮nokia5110,打造自己的小电视

ESP8266点亮nokia5110,打造⾃⼰的⼩电视
材料清单:
esp8266
nokia5110
⾯包板
跳线
ARDUINO IDE下载
Arduino IDE离线安装esp8266 SDK (8266_package_2.6.3)
双击运⾏即可解压,解压完成后,再打开Arduino IDE,即可在菜单栏>⼯具>开发板中找到你使⽤的esp8266开发板**ESP8266-NodeMCU开发板驱动 (CP210X) **
可以上传个blink测试⼀下板⼦
点亮 nokia5110
安装这两个库
测试代码
点击查看代码
显⽰图案
因为使⽤的nokia屏幕,致敬⼀下经典握⼿开机logo
点击查看代码
ESP8266⾃动配⽹ – WiFiManager库(强烈推荐,⾮常好⽤)
点击查看代码
ESP8266获取时间
点击查看代码
ESP8266获取并解析⼼知天⽓数据
点击查看代码
ESP8266获取并解析哔哩哔哩API数据(获取粉丝数量)
点击查看代码
将以上代码综合⼀下
点击查看代码。

5110LCD程序

5110LCD程序

5110LCD程序在综合版提供的程序中void LCD_init(void){PORTB &= ~LCD_RST; // 产生一个让LCD复位的低电平脉冲delay_1us();PORTB |= LCD_RST;PORTB &= ~LCD_CE ; // 关闭LCDdelay_1us();PORTB |= LCD_CE; // 使能LCDdelay_1us();LCD_write_byte(0x21, 0); // 使用扩展命令设置LCD模式LCD_write_byte(0xc8, 0); // 设置偏置电压LCD_write_byte(0x06, 0); // 温度校正LCD_write_byte(0x13, 0); // 1:48LCD_write_byte(0x20, 0); // 使用基本命令LCD_clear(); // 清屏LCD_write_byte(0x0c, 0); // 设定显示模式,正常显示PORTB &= ~LCD_CE ; // 关闭LCD}根据datasheet,LCD_write_byte(0xc8, 0);是写Vop到寄存器,但是改变它的值也看不出对程序的影响,不知道Vop6~Vop0各个值的设置对程序有什么影响?代表什么意思?谢谢!偏置电压改变它的对比度,不同批号的5110可能出厂偏置电压不同导致对比度不同,这就是为什么同样的程序有些5110没有显示(对比度太低),有些显示全黑(对比度太高)。

这种情况可以通过程序修改对比度调整。

这个程序是从一个国外网站的例程改过来的,去掉了很多东西,有助于大家理解5110的工作原理和基本显示实现,在家其他显示函数相对简单一些;原例程里的一些东西不好理解。

///////////////////////////以下是代码/////////////////////////////////////////////////////////////////ICC-AVR application builder : 2007-5-3 4:45:38// T arget : M16// Crystal: 1.0000Mhz#include <iom16v.h>#include <macros.h>#define LCD_DC_PIN 0x04 // PB2#define LCD_CE_PIN 0x02 // PB1#define SPI_MOSI_PIN 0x20 // PB5#define LCD_RST_PIN 0x01 // PB0#define SPI_CLK_PIN 0x80 // PB7#define X_Length 45#define X_Init 2#define Y_Init 2/*--------------------------------------------------------------------------------------------------Global Variables0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,10个--------------------------------------------------------------------------------------------------*///字模"FUCK JAPAN"unsigned char const X_TAB[] ={0x7E,0x0A,0x0A,0x0A,0x00,0x7E,0x40,0x40,0x7E,0x00,0x7E,0x42,0x42,0x42,0 x00,0x7E,0x18,0x24,0x42,0x00,0x00,0x00,0x42,0x7E,0x02,0x00,0x7C,0x12,0x1 2,0x7C,0x00,0x7E,0x0A,0x0A,0x0E,0x00,0x7C,0x12,0x12,0x7C,0x00,0x7E,0x08,0x10,0x 7E};/*--------------------------------------------------------------------------------------------------Public function prototypes--------------------------------------------------------------------------------------------------*/void LcdInit ( void );void LcdClear ( void );static void LcdSend ( unsigned char, unsigned char);static void Delay ( void );void LcdGotoXY ( unsigned char, unsigned char );/////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////*--------------------------------------------------------------------------------------------------Name : LcdInitDescription : Performs MCU SPI & LCD controller initialization.Argument(s) : None.Return value : None.--------------------------------------------------------------------------------------------------*/void LcdInit( void ){//unsigned char Clear;// Pull-up on reset pin,上电复位端口,此时为高,不复位;PORTB |= LCD_RST_PIN;// Set output bits on port B,设置输出口;DDRB |= LCD_RST_PIN | LCD_DC_PIN | LCD_CE_PIN | SPI_MOSI_PIN | SPI_CLK_PIN;Delay();// Toggle display reset pin.PORTB &= ~LCD_RST_PIN; //上电复位;Delay();PORTB |= LCD_RST_PIN; //复位完;// SPI初始化;Enable SPI port: No interrupt, MSBit first, Master mode, CPOL->0, CPHA->0, Clk/4SPCR = BIT(SPE)|BIT(MSTR); //使能SPI,主机模式;//SPSR = 0x00; //似乎不用这几句也能正常运行;//Clear= SPSR;//Clear= SPDR;// Disable LCD controllerPORTB |= LCD_CE_PIN;LcdSend( 0x21, 0 ); // LCD Extended Commands.LcdSend( 0xC8, 0 ); // Set LCD Vop (Contrast).LcdSend( 0x06, 0 ); // Set Temp coefficent.LcdSend( 0x13, 0 ); // LCD bias mode 1:48.LcdSend( 0x20, 0 ); // LCD Standard Commands, Horizontal addressing mode. LcdSend( 0x0C, 0 ); // LCD in normal mode.LcdClear();}/*--------------------------------------------------------------------------------------------------Name : LcdClearDescription : Clears the display.Argument(s) : None.Return value : None.--------------------------------------------------------------------------------------------------*/void LcdClear(void){unsigned int i;LcdSend(0x0c, 0);LcdSend(0x80, 0); //此时默认操作为清屏for (i=0; i<504; i++)LcdSend(0, 1);}/*--------------------------------------------------------------------------------------------------Name : LcdGotoXY 设置块坐标Description : Sets cursor location to xy location corresponding to basic font size. Argument(s) : x, y -> Coordinate for new cursor position. Range: 1,1 .. 14,6 Return value : None.--------------------------------------------------------------------------------------------------*/void LcdGotoXY(unsigned char X, unsigned char Y){LcdSend(0x40 | Y, 0); // columnLcdSend(0x80 | X, 0); // row}/*--------------------------------------------------------------------------------------------------Name : LcdSendDescription : Sends data to display controller.Argument(s) : data -> Data to be sentcd -> Command or data (see/use enum)Return value : None.--------------------------------------------------------------------------------------------------*/static void LcdSend (unsigned char data, unsigned char command){PORTB &= ~LCD_CE_PIN ; // 使能LCDif (command == 0)PORTB &= ~LCD_DC_PIN ; // 传送命令elsePORTB |= LCD_DC_PIN ; // 传送数据SPDR = data; // 传送数据到SPI寄存器while ((SPSR & 0x80) == 0); // 等待数据传送完毕PORTB |= LCD_CE_PIN ; // 关闭LCD}/*--------------------------------------------------------------------------------------------------Name : DelayDescription : Uncalibrated delay for LCD init routine.Argument(s) : None.Return value : None.--------------------------------------------------------------------------------------------------*/static void Delay ( void ){int i;for ( i = -12000; i < 12000; i++ );}/*--------------------------------------------------------------------------------------------------Name : mainDescription :Argument(s) :Return value : None.--------------------------------------------------------------------------------------------------*/void main(void){ unsigned char X; //v=0,按行显示,x对应某个bank(0~83) LcdInit();while(1){LcdGotoXY(X_Init,Y_Init);for(X=0;X<X_Length;X++)LcdSend(X_TAB[X],1);}}。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档