进阶制作

提高篇--驱动12864LCD模块

字号+ 作者:PLC工程师 来源:未知 2016-02-25 21:50 我要评论( )

mini12864可配合取模软件及各种单片机可完成中文汉字、英文字符和图形显示,更适合Arduino做显示相关的互动作品,该mini液晶屏成本相对较低,适用于各类仪器,小型设备的显示领域。

mini12864图: 

mini12864可配合取模软件及各种单片机可完成中文汉字、英文字符和图形显示,更适合Arduino做显示相关的互动作品,该mini液晶屏成本相对较低,适用于各类仪器,小型设备的显示领域。
由于LCD驱动IC众多,这里我们仅以OPENJUMPER的mini12864LCD为例教学,其他的LCD,你只需找到不同的库来驱动即可。
下面按步骤来驱动mini12864显示图片:
第一步:下载取模软件  字模提取V2.2.zip (512.81 KB, 下载次数: 2548) 
第二步:处理图片,把你想要mini12864显示的图片,用软件处理为128*64的.bmp图
          如图:  
第三步:使用取模软件
            1、打开取模软件,新建图像,选择宽度128,高度64
 
             2、打开你的图片,将做好的分辨率为128*64的.bmp图导入
 
           3、反向取模,由于此处用的液晶点阵为反向显示,这里的取模须反向取模。(取消这一步,使用程序库里函数也可以达到此效果反向显示)
          4、生成数组,并复制下面的数组



第四步:下载库文件  Lcd12864.zip (2.65 KB, 下载次数: 2382) ,安装在arduino安装文件的libraries下面,打开IDE,敲入下面示例代码。

第五步:复制刚才生成的数组,取代 bmp3[1024]里面的所有数组,编译并下载到您的arduino里。
[C] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#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          //给芯片复位,低有效,如果不需软件给芯片复位,可不连接      
A0——10              //数据和命令选择,L 命令 H  数据
CLK——13           //时钟
MOSI——11         //数据
GND——GND          //电源接线
VCC——5V
LED——背光选择     //低有效   

显示效果:
 

如需更详细资料,如有好资源分享,请加入QQ交流群:214461008

欢迎阅读,欢迎转载,不用注明出处!本站只提供入门和进阶资料,做您学习的小伙伴!

老司机也欢迎光临指导!有好内容请加群:214461008 不要看声明了,看内容吧!

相关文章
  • 1602液晶arduino直接驱动实验

    1602液晶arduino直接驱动实验

    2016-03-04 14:05

  • IIC总线协议

    IIC总线协议

    2016-03-03 16:05

  • 使用IRremote库红外遥控家里的电器

    使用IRremote库红外遥控家里的电器

    2016-02-25 21:27

  • 提高篇--红外遥控(发射篇)

    提高篇--红外遥控(发射篇)

    2016-02-25 21:25

网友点评