mini12864图
mini12864可配合取模软件及各种单片机可完成中文汉字、英文字符和图形显示,更适合Arduino做显示相关的互动作品,该mini液晶屏成本相对较低,适用于各类仪器,小型设备的显示领域。
由于LCD驱动IC众多,这里我们仅以OPENJUMPER的mini12864LCD为例教学,其他的LCD,你只需找到不同的库来驱动即可。
下面按步骤来驱动mini12864显示图片:
第二步:处理图片,把你想要mini12864显示的图片,用软件处理为128*64的.bmp图
第三步:使用取模软件
1、打开取模软件,新建图像,选择宽度128,高度64
2、打开你的图片,将做好的分辨率为128*64的.bmp图导入
3、反向取模,由于此处用的液晶点阵为反向显示,这里的取模须反向取模。(取消这一步,使用程序库里函数也可以达到此效果反向显示)
4、生成数组,并复制下面的数组
四步:下载库文件 Lcd12864,安装在arduino安装文件的libraries下面,打开IDE,敲入下面示例代码。
第五步:复制刚才生成的数组,取代 bmp3[1024]里面的所有数组,编译并下载到您的arduino里
#include "Lcd12864.h" #include "SPI.h" unsigned char const bmp3[1024]={ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x30, 0xF0,0xC0,0xC0,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,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x30,0x3C,0x0C,0x0C, 0x0C,0x0C,0x0C,0xFC,0xF0,0xF0,0x00,0x00,0x00,0x00,0xF0,0xF0,0xFC,0x0C,0x0C,0x0C, 0x0C,0x0C,0x0C,0x0C,0xFC,0xF0,0xF0,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x30,0x3C, 0x0C,0x0C,0x0C,0xFC,0xF0,0xF0,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,0x0F,0x0F,0x3F,0x30,0xF0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0, 0xF0,0x30,0x3F,0x0F,0x0F,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x30,0xF0,0xC0,0xC0, 0xC0,0xC0,0xC0,0xFF,0x3F,0x3F,0x00,0x00,0x00,0x00,0x3F,0x3F,0xFF,0xC3,0xC3,0xC3, 0xC3,0xC3,0xC3,0xC3,0xF3,0x33,0x33,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0x00,0xFF,0xFF,0xFF,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,0x3F,0x3F,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,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,0xFC,0xFC,0xFC,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,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x0C, 0x0F,0x03,0x03,0x03,0xFF,0xFC,0xFC,0x0C,0x0F,0x03,0x03,0x03,0xFF,0xFC,0xFC,0x00, 0x00,0x00,0x00,0xFF,0xFF,0xFF,0x0C,0x0F,0x03,0x03,0x03,0x03,0x03,0xFF,0xFC,0xFC, 0x00,0x00,0x00,0x00,0xFC,0xFC,0xFF,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xC3,0xFF,0xFC, 0xFC,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x0C,0x0F,0x03,0x03,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,0x0F,0x0F, 0x3F,0x30,0x30,0x30,0x30,0x30,0x3F,0x0F,0x0F,0x00,0x00,0x00,0x00,0x0F,0x0F,0x3F, 0x30,0x30,0x30,0x3C,0x0C,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x00, 0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x00,0x00,0x00,0x00,0x00,0x3F,0x3F,0x3F,0x00, 0x00,0x00,0x00,0xFF,0xFF,0xFF,0x0C,0x3C,0x30,0x30,0x30,0x30,0x30,0x3F,0x0F,0x0F, 0x00,0x00,0x00,0x00,0x0F,0x0F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x0C, 0x0C,0x00,0x00,0x00,0x00,0x3F,0x3F,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,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,0x0F,0x0F,0x0F,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 }; void setup() { lcd12864 x; x.LcmInit(); } void loop() { lcd12864 x; x.PUTBMP(bmp3); //液晶点阵正向显示1秒 delay(1000); x.PUTREVERSEBMP(bmp3); //反向显示1秒 delay(1000); }
第六步:mini12864与arduino之间的接线。
CS—— 8 //片选 低有效
RST—— 9 //给芯片复位,低有效,如果不需软件给芯片复位,可不连接
RST—— 9 //给芯片复位,低有效,如果不需软件给芯片复位,可不连接
A0——10 //数据和命令选择,L 命令 H 数据
CLK——13 //时钟
MOSI——11 //数据
GND——GND //电源接线
VCC——5V
LED——背光选择 //低有效