_SKU_FIT0328_2.7英寸12864OLED液晶显示模块兼容Arduino - jimaobian/DFRobotWikiCn GitHub Wiki

概述

你是否想拥有一个实惠而且高画质的OLED显示屏?你是否淘遍了所有网店也没有找到心仪的OLED显示器? DFRobot为你献上精心挑选的2.7英寸128*64分辨率的显示器。这款产品拥有众多优点,绝对会让你爱不释手

  • 2.7英寸超大屏幕,轻松显示图像和文字。

  • 白色显示和黑色背景,简洁大气,突显画质。

  • 超大显示广角。不论从哪个角度,你都能把上面的文字看的清清楚楚。

  • 屏幕周围加黑色金属边框,提升质感和保护。

  • 高强度磨砂表面。耐摔,无反光,非产适合安装到其他成品上面

  • 最重要的是它无缝兼容Arduino,用起来就是那么简单。

由于该LED屏无背光光源,因此能得到纯黑的背景,与白色显示成鲜明对比。并且屏幕厚度比普通12864 LED屏薄一半,减轻重量,提升质感。该屏幕用SPI协议驱动,反应速度快。再加上附送的 "u8glib"代码库,让你快速应用这一优质产品。

技术规格

  • 电压:5V/3.3V

  • 最大电源消耗:110mA@5V

  • 接口类型:SPI

  • 128*64分辨率

  • 2.7英寸大小

  • 尺寸:85*58*6.5mm

引脚说明图

以下引脚的介绍是从oled显示屏上面标示的1开始位置起

引脚名称 引脚 接线
1 VSS GND
2 VDD 3.3V—5V
3 V0 悬空,可以不接
4 DC 命令/数据标志(0,读写命令;1,读写数据)
5 WR 向OLED写入数据
6 RD 从OLED读数据
7~14 DB0-DB7 数据位
15 CS 芯片信号
16 RESET 复位
17 NC 悬空,可以不接
18 NC 悬空,可以不接
19 /NC 5V
20 FG GND

"oled引脚说明"

Oled与Uno的接线图

字符显示

1.接线

与上面接线相同

2.字符显示演示代码

该显示屏需要用到库函数,库及其相关资料

#include "U8glib.h"
U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);  // SPI Com: SCK =DB0 = 13, MOSI =DB1 = 11, CS = 10, A0  = DC= 9
void draw(void) {
  u8g.setFont(u8g_font_unifont); //修改字体请参照附件中fontsize - u8glib字体库
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {

}

void loop(void) {
  // picture loop
  u8g.firstPage();
  do {
    draw();
  } while( u8g.nextPage() );
}

图片显示

1.图片转换

(1)打开图形转换软件,设置模式为图形模式。 (2)设置参数为C5I (3)打开要转换的图像,图像格式为位图(bmp) (3)然后点击生成字模即可,最后把生成的字模放入一个字符数组里面。

2.接线

与上面的接线方式相同

3.显示图片代码演示

该显示屏需用用到库文件,库及其相关资料

#include "U8glib.h"
U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);  //SPI Com: SCK =DB0 = 13, MOSI =DB1 = 11, CS = 10, A0  = DC= 9
const uint8_t rook_bitmap[] PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,
0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,
0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,
0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xFE,0x00,
0x00,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,
0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x00,
0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x00,
0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,
0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,
0x00,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x0F,0x1F,
0xEF,0xF0,0x07,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF8,0x06,0x1B,
0x6D,0xB0,0x03,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF0,0x06,0x3B,
0xED,0xA0,0x01,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xE0,0x06,0x31,
0xE9,0xE0,0x00,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xE0,0x06,0x31,
0xB9,0xA0,0x00,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x06,0x79,
0xB9,0x98,0x00,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x06,0xFB,
0x39,0xB0,0x00,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x0F,0xDF,
0x33,0xF0,0x00,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,
0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x3B,
0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x1B,
0x7F,0xB8,0x00,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x1A,
0x6D,0x90,0x00,0x3C,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x1E,
0xEF,0x90,0x00,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x0E,
0xC7,0x90,0x00,0x78,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x0C,
0xC7,0x90,0x00,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0xE0,0x00,0x0C,
0xE7,0x90,0x00,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x0C,
0x6D,0xB0,0x01,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x0E,
0x7D,0xF0,0x03,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7C,0x00,0x0E,
0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x3E,0x00,0x00,
0x00,0x00,0x0F,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,
0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0F,0x80,0x00,
0x00,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x07,0xE0,0x00,
0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0xF8,0x00,
0x00,0x03,0xF8,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0xFE,0x00,
0x00,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xC0,
0x00,0x7F,0xC0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,
0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,
0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
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 draw(void) {
  // graphic commands to redraw the complete screen should be placed here
  u8g.drawBitmapP( 0, 0, 16, 64, rook_bitmap);

}

void setup(void) {
}

void loop(void) {
  // picture loop
  u8g.firstPage();
  do {
    draw();
  } while( u8g.nextPage() );

  // rebuild the picture after some delay
  delay(1000);
}
}

汉字显示

1.汉字转换

(1)打开PCtoLCD2002软件,选择模式为字符模式。 (2)在文本框中输入字符“人”,设置参数为C5I,点击生成字模,最后把生成的字模放入一个字符数组里面。

2.接线图

同上

3.演示显示屏显示汉字“人”代码

显示汉字同样需要用到库函数,#库及其相关资料下载

#include "U8glib.h"//库函数
U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);  // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9 芯片类型及其对应的接线方式
const uint8_t rook_bitmap[] PROGMEM = {
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,
0x10,0x10,0x20,0x08,0x40,0x04,0x80,0x02,/*"人",0*/
};
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here
  u8g.drawBitmapP( 0, 0, 2, 16, rook_bitmap);//第0行0列开始显示文字,生成的汉字“人”大小为16*16,所以后面的两个参数为(16/8,16).

}

void setup(void) {
}

void loop(void) {
  // picture loop
  u8g.firstPage();
  do {
    draw();
  } while( u8g.nextPage() );
  // rebuild the picture after some delay
  delay(1000);
}

4.多个汉字显示代码注意事项

该取模软件,在生成字模时每个汉字会单独生成一个字模对应的数据,在显示多个汉字时,需要单独显示每个汉,即多次调用u8g.drawBitmapP( );这个函数。

5.多个汉字显示代码演示

#include "U8glib.h"
U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9);  // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
const uint8_t rook_bitmap1[] PROGMEM = {
0x10,0x00,0x11,0xF0,0x11,0x10,0x11,0x10,
0xFD,0x10,0x11,0x10,0x31,0x10,0x39,0x10,
0x55,0x10,0x55,0x10,0x91,0x10,0x11,0x12,
0x11,0x12,0x12,0x12,0x12,0x0E,0x14,0x00,/*"机",0*/
};
const uint8_t rook_bitmap2[] PROGMEM = {
0x00,0x00,0x3E,0x7C,0x22,0x44,0x22,0x44,
0x3E,0x7C,0x01,0x20,0x01,0x10,0xFF,0xFE,
0x02,0x80,0x0C,0x60,0x30,0x18,0xC0,0x06,
0x3E,0x7C,0x22,0x44,0x22,0x44,0x3E,0x7C,/*"器",1*/
};
const uint8_t rook_bitmap3[] PROGMEM = {
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,
0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,
0x10,0x10,0x20,0x08,0x40,0x04,0x80,0x02,/*"人",2*/
};
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here
  u8g.drawBitmapP( 0, 0, 2, 16, rook_bitmap1);//0行0列显示“机”
    u8g.drawBitmapP( 16, 0, 2, 16, rook_bitmap2);//0行16列显示“器”
     u8g.drawBitmapP( 32, 0, 2, 16, rook_bitmap3);//0行32列显示“人”
}

void setup(void) {
}

void loop(void) {
  // picture loop
  u8g.firstPage();
  do {
    draw();
  } while( u8g.nextPage() );

  // rebuild the picture after some delay
  delay(1000);
}

部分代码解释

  • u8g.drawStr( m, n, str);//m代表的是第m列,n代表的是第n行,str是要显示的字符串

  • u8g.drawBitmapP( m, n, x, y, str);//m代表的是第m列,n代表的是第n行,x代表的是生成字模点阵时的列数除以8,y代表的是点阵行数,str是要显示的字符串

例如显示汉字“人”u8g.drawBitmapP( 0, 0, 2, 16, rook_bitmap);//在生成字模时大小为16*16,那么x=16/2;y就是第二个16.

相关文档

  1. 库文件及其相关资料

File:nextredirectltr.png购买 2.7英寸 12864 OLED液晶显示模块 (SKU:FIT0328)

category: Product Manual category: DFR Series category: LCDs category: source