在12864显示任意图片及参考程序
- 格式:doc
- 大小:235.50 KB
- 文档页数:7
用12864显示单色图片
首先介绍本12864液晶显示器:
型号:QC12864B
因为单片机读取的是数据,而不是直接的图片。得将图片进行取模,图片应该是单色图片,像素128*64。
下面我为大家介绍个实例。
①、在电脑附件画图,首先设置属性
开始画图
保存文件,注意格式:②、然后进行取模。
③、编程:
#include
#define uchar unsigned char
#define uint unsigned int //宏定义
#define lcd P2 //数据端口
sbit rs=P1^2; //指令/数据选择信号
sbit rw=P1^1; //读写选择信号
sbit e=P1^0; //使能端
sbit psb=P1^3; //串并选择端,高电平为并行,低电平为串行
uchar code ai[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0xCE,0x00,0x00,0x00,0x00,0x00,0x01,0xC1,0xE0,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xC7,0x00,0x00,0x00,0x00,0x00,0x03,0x31,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x0E,0xC0,0x00,0x00,0x00,0x00,0x00,0x03,0x9B,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00,0x00,0x01,0x82,0x08,0x00,0x00,0x00, 0x00,0x00,0x00,0x78,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFC,0x00,0x00,0x00, 0x00,0x00,0x00,0xF8,0xEF,0x00,0x00,0x00,0x00,0x00,0x1B,0xFC,0x1E,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0xFE,0x00,0x00,0x00,0x00,0x00,0x1E,0x60,0x38,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x38,0x70,0x20,0x00,0x00,0x00,
0x00,0x00,0x00,0x3E,0x63,0x00,0x00,0x00,0x00,0x00,0x30,0x7F,0xE0,0x00,0x00,0x00, 0x00,0x00,0x03,0xF8,0x73,0x00,0x00,0x00,0x00,0x00,0x33,0xF8,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0x37,0x00,0x00,0x00,0x00,0x00,0x06,0xE0,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0xC7,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x1C,0x1C,0x00,0x00,0x00,0x00,0x00,0x01,0xFF,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0xF8,0x1C,0x00,0x00,0x00,0x00,0x00,0x01,0x83,0x80,0x00,0x00,0x00, 0x00,0x00,0x0F,0xD8,0x7C,0x00,0x00,0x00,0x00,0x00,0x03,0xC7,0x00,0x00,0x00,0x00, 0x00,0x00,0x0F,0x18,0xE6,0x00,0x00,0x00,0x00,0x00,0x06,0x7E,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x19,0x87,0x10,0x00,0x00,0x00,0x00,0x0E,0x1C,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0xF8,0x03,0x90,0x00,0x00,0x00,0x00,0x18,0x3E,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x78,0x01,0xF8,0x00,0x00,0x00,0x00,0x30,0xE3,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x38,0x00,0xF8,0x00,0x00,0x00,0x00,0x67,0x01,0xF0,0x00,0x00,0x00, 0x00,0x00,0x00,0x10,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, 0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x3C,0x0F,0x00,0x00,0x07,0xD0,0x00,0x01,0xF1,0xE0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1C,0x0E,0x00,0x00,0x0C,0x38,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1C,0x1E,0x00,0x00,0x1C,0x38,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1E,0x1E,0x00,0x00,0x38,0x18,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1E,0x1E,0x00,0x00,0x38,0x18,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1E,0x1E,0x00,0x00,0x30,0x18,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x3E,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x3E,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x3E,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1F,0x2E,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1B,0xEE,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x1B,0xEE,0x00,0x00,0x70,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x19,0xEE,0x00,0x00,0x38,0x00,0x00,0x00,0xE0,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x19,0xCE,0x00,0x00,0x38,0x00,0x00,0x00,0x60,0xC0,0x00,0x00,0x00, 0x00,0x00,0x00,0x19,0xCE,0x00,0x00,0x38,0x18,0x00,0x00,0x60,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0xCE,0x00,0x00,0x1C,0x10,0x00,0x00,0x71,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x18,0x8E,0x00,0x00,0x0E,0x70,0x00,0x00,0x71,0x80,0x00,0x00,0x00, 0x00,0x00,0x00,0x3E,0x1F,0x00,0x00,0x07,0xE0,0x00,0x00,0x3F,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,