资源描述:
《51单片机LCD12864绘图》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.LCD12864绘图方法如下:一、绘图方法:1、使用扩展指令集并关闭绘图显示2、输入y轴坐标3、输入x轴坐标4、写入数据D15-D85、写入数据D7-D06、开绘图显示7、返回普通指令对应程序如下:LCD_write_comm(0x34);//使用扩充指令集LCD_delay();LCD_write_comm(0x80+y);//y坐标起始地址LCD_delay();LCD_write_comm(0x80+x);//x坐标起始地址LCD_delay();LCD_write_date(0x55);//写入数据D15-D8
2、LCD_delay();LCD_write_date(0x55);//写入数据D7-D0LCD_delay();LCD_write_comm(0x36);//显示RAMLCD_delay();LCD_write_comm(0x30);//退出扩展指令集LCD_delay();word教育资料.程序执行效果则是第一行的第1-16个像素点会描出0x5555的二进制像素点,则后面的整个屏幕则是花屏,如果只想看到这0x5555,这几个像素点,则必须要给LCD的RAM重新赋值,也可以说是清屏,程序如下:voidLCD12864_R
3、AM_Cls(){u8x,y;//xy坐标LCD_write_comm(0x34);//使用扩充指令集LCD_delay();for(y=0;y<32;y++){LCD_write_comm(0x80+y);//y坐标起始地址LCD_delay();LCD_write_comm(0x80);//x坐标起始地址LCD_delay();for(x=0;x<16;x++){LCD_write_date(0x00);LCD_delay();LCD_write_date(0x00);LCD_delay();}}LCD_write_
4、comm(0x36);//显示RAMLCD_delay();LCD_write_comm(0x30);//退出扩展指令集LCD_delay();}二、坐标与显示X轴坐标设定初始值后会自动加1,取值范围0-15Y轴需要人为加1,取值范围为0-31整个屏幕分为上下屏,上屏对应坐标为x(0-7)y(0-31),下屏对应坐标为x(8-15)y(0-31)三、LCD12864图片显示代码1、Main.c#include"common.h"#include"delay.h"#include"12864.h"unsignedcharc
5、odePicture[]=//图片数据表{//此处添加图片取模16进制码共1024Byte,取模方式:从左到右从上到下0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,word教育资料.0x80,0x06,0x30,0x01,0xE0,0x00,0x00,0x2A,0x00,0x00,0xD8,0x00,0x00,0x00,0x00,0x01,0x80,0x0F,0x7B,0x63,0xE0,0x00,0x00,
6、0x22,0x00,0x01,0x24,0x00,0x00,0x00,0x00,0x01,0x80,0x0F,0xFB,0x63,0x07,0x34,0x00,0x14,0x00,0x01,0x04,0x00,0x00,0x00,0x00,0x01,0x80,0x0D,0xDB,0x63,0x01,0xBC,0x00,0x08,0x00,0x00,0x88,0x00,0x00,0x00,0x00,0x01,0x80,0x0C,0x1B,0x63,0x07,0xB0,0x00,0x00,0x00,0x00,0x50,0x0
7、0,0x00,0x00,0x00,0x01,0x80,0x0C,0x1B,0x63,0xED,0xB0,0xDB,0x00,0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x01,0x80,0x0C,0x19,0xE1,0xE7,0xB0,0xDB,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x0C,0x19,0xE1,0xE7,0xB0,0xDB,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0
8、x80,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x01,