【小巧高性能】mini LCD12864测试+自改可用的驱动库

上次附件传错了,这里道下歉哈~已经更新

最近淘宝上出了一些mini版的12864,使用SPI连接方式,外形非常小巧,价格十分低廉,刷新速度比一般的大号LCD12864快很多,而且支持作图。



由于到手后苦于无法用arduino驱动,通过搜索发现Ladyade做过ST7565的arduino驱动库,遂直接挖过来,结果屏幕左右颠倒,从中间分成两半,无法正常显示,于是经过一晚上的摸索,终于修正了参数,成功使用,下面我就共享一下库及其程序。



PS:如果要显示图片,可以直接使用弘毅的BMP转十六进制的字模软件,但是设置要改成纵向生成8位。

未命名.jpg

1.jpg

2.jpg

3.jpg



库:

ST7565.zip
网盘下载ST7565.zip http://pan.baidu.com/s/1dExdYV3



实例程序:// Zzz



#include "ST7565.h"

int ledPin =13;
#define BACKLIGHT_LED 10

ST7565 glcd(9, 8, 7, 6, 5);

#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH16

static unsigned char attribute ((progmem)) logo16_glcd_bmp[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xF0,0xF0,0x30,
0x30,0xF0,0xE0,0xC0,0x10,0xF0,0xF0,0x10,0xF0,0xF0,0x90,0xC0,0xF0,0x70,0x10,0x00,
0x00,0x00,0xFE,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFE,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xE0,0xF0,0xF0,0xF0,0xF0,0xF0,0xE0,
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,0x18,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0xF8,0xF8,0x78,
0x38,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,
0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x3E,0x3F,0x33,0x30,
0x38,0x1F,0x2F,0x30,0x3F,0x3F,0x31,0x00,0x30,0x3F,0x3F,0x23,0x00,0x00,0x00,0x00,
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0xFF,0xFF,0xFF,0xFF,0xFE,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x80,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xF8,0xFC,0xFC,0xFC,0xF8,
0xF8,0xF8,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0xC0,0xE0,0xF8,0xFC,0xFE,0xFF,0x7F,0x1F,0x0F,0x07,0x03,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1F,0x0F,0x0F,0x0F,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00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x03,0x01,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,
0x7F,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x0F,0x0F,0x1F,0x3F,0xFF,0xFF,0xFF,
0xFF,0xE7,0x87,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x7F,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0x07,0x01,0x01,0x01,0x01,
0x01,0x07,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xC0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0xC0,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x3F,
0xFF,0xFF,0xFF,0xFE,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
0x07,0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x03,0x03,
0x03,0x03,0x00,0x00,0x00,0x07,0x07,0x07,0x07,0x07,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x00,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x0F,0x1F,0x3F,0x3F,0x3F,0x3F,0x1F,
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
0xF0,0xF0,0xF0,0xE7,0xE7,0xE7,0xE7,0xE7,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0x07,0x07,0x07,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

void setup() {
Serial.begin(9600);


pinMode(BACKLIGHT_LED, OUTPUT);
digitalWrite(BACKLIGHT_LED, LOW);


glcd.st7565_init();
glcd.st7565_command(CMD_DISPLAY_ON);
glcd.st7565_command(CMD_SET_ALLPTS_NORMAL);
glcd.st7565_set_brightness(0x00);

glcd.clear();
glcd.drawbitmap(0, 0, logo16_glcd_bmp,128, 64, BLACK);
glcd.display();

delay(50000);
glcd.clear();

glcd.drawstring(0,0, "LCD12864 Testing");
glcd.drawstring(0,3, "Control IC ST7565LCD");
glcd.drawstring(0,6, "library Re-Design Zzz");
glcd.display();
delay(7000);
glcd.clear();


}


void loop()
{}




ST7565LCD.rar
http://pan.baidu.com/s/1dExdYV3 网盘下载ST7565LCD.rar


via - 极客工坊

标签: Arduino教程