0.96寸OLED液晶显示器

在日常的小项目制作中我们经常会接触到OLED液晶显示器,本文介绍0.96寸液晶显示器的基本原理,辅助后续项目开发

一、简介

OLED被称为有机激光二极管,也被称为有机激光显示,OLED采用有机材料涂层和玻璃基板,当有电流通过时有机材料就会发光,所以OLED具有自发光特性,不需要背光源(只上电不会亮的,需要完整的程序驱动)
在这里插入图片描述

上图所示是常用的0.96寸的OLED液晶显示屏模块,显示区域是128X64的点阵(分辨率128*64),每个点都可以自己独立发光,所以不需要背光,可以显示汉字、ASIIC码、图案等,

支持多种接口方式,OLED 裸屏接口包括:6800/8080 两种并行接口方式、3 线或 4 线的
串行 SPI 接口方式、 IIC 接口方式(只需要 2 根线就可以控制 OLED ),上述接口是通过BS0~BS2 来配置的。

在这里插入图片描述

电气特性

OLED功耗电流如下,正常使用整体小于80mW,功耗远小于正常的TTF屏幕

在这里插入图片描述

显示原理

OLED的显存分布情况。我们可以理解为:水平方向分布了128个像素点,垂直方向分布了64个像素点。而驱动芯片在点亮像素点的时候,是以8个像素点为单位的。官方的例程推荐的是垂直扫描的方式,也就是先画垂直方向的8个像素点(如下图所示),所以我们在画点的时候Y的取值为0-7,X的取值为0-127。页是芯片设计者为了方便将同一列的8个点阵编成一组,用一个8bit数表示,这样的8行128个数被称为1页。

在这里插入图片描述

在这里插入图片描述

二、7针OLED屏幕模组

7针的OLED屏幕模组兼容SPI和IIC两种通讯形式
在这里插入图片描述
7pin–SPI/IIC接口

接口命名SPI/IIC接口
VCC电源接口(电源3.3V-5V)
GND电源地
D0SPI-时钟线 或者 IIC-时钟线
D1SPI-数据线 或者 IIC-数据线
RESILED复位,OLED在上电后需要一次复位(低电平复位)
DCSPI数据/命令选择脚
CSOLED SPI片选,低电平有效,不用时接地

如下图所示,7针OLED屏在使用 SPI 接口时R1、R2、R8 三个电阻是不焊接的(焊接R3、R4);

4线SPI通信控制模式:
发送数据:CS拉低-DC拉高-发送数据(8bit)-CS拉高
发送命令:CS拉低-DC拉低-发送命令(8bit)-CS拉高

在这里插入图片描述

7针OLED屏,使用 IIC 接口的时需要将 R3 换到 R1 上,R8 可以焊接也可不焊接,另外在 使用IIC 接口时需注意以下事项:

(1)要将 RES 接高电平,可以与 VCC 对接,使 OLED 复位脚一直保持高电平,即不复位的状态;
(2)同时需要将 DC、CS 接电源地;

此时 IIC 通信中只需要 GND 、VCC、D0(时钟信号)、D1(数据信号)四根线了。如果大家感觉这样比较麻烦也可直接选用四针的 IIC 接口模块

三、4针OLED屏幕

4针的OLED支持IIC通讯形式
在这里插入图片描述
4pin–IIC接口

接口命名IIC接口
VCC电源接口(电源3.3V-5V)
GND电源地
SCLIIC时钟线
SDAIIC数据线

内部驱动IC为SSD1306,SSD1306作为从机地址为0x78,DC脚作为更改从机地址引脚,DC接VCC,从机地址0x79,什么都不接地址为0x78。

发送数据:起始信号-从机地址-应答-写数据模式(0x40)-应答-数据(8bit)-结束信号

发送命令:起始信号-从机地址-应答-写命令模式(0x00)-应答-命令(8bit)-结束型号

四、 0.96 寸OLED 原理图设计

在这里插入图片描述
上述原理图中,7针OLED屏选用SPI接口时, BS0、BS1、BS2 需全为 0,所以配置电阻R1、R2 不焊接,R3、R4 需焊接;同时电阻 R8 不焊接,否则会出现不稳定情况。

7针OLED屏选 IIC 接口时,需将 BS1 配置为 1,BS0 为 0;所以 R1,R4 焊接,R2,R3 不焊接,R8 可焊接也可不焊接

五、程序说明

很多新手工程师或是学生比较在意在某个处理器下的程序,其实这个没有必要,大家可以打开几个不同平台下的程序,会发同一通信接口类型下的程序内部的操作函数是完全一样的,只是管脚定义方式不同,还有一个就是需要包含所用平台的头文件,其它的其实都不用作修改。

现对OLED的.h文件说明如下:

(1)bmp.h 是存放的图片数据,也就是大家对 BMP 图片取模的数据
(2)oledfont.h 主要是存放的字库数据,包含常用的字符和用户自己所取模的中文
(3)oled.c 主要是函数的操作

六、取模说明

取模主要有三种:图片取模、字符取模、汉字取模,原理是一样的

(1)图片取模

打开 PCtoLCD2002.exe 软件

在这里插入图片描述

打开手机桌面图片

在这里插入图片描述

模式设置

在这里插入图片描述在这里插入图片描述

生成 BMP 图像字模

在这里插入图片描述

(2)汉字字模取模

其方法与图像的相似, 打开软件以后,如下操作

在这里插入图片描述

在这里插入图片描述

后续操作与图像取模操作一样,这里不再赘述

Pin Number Symbol I/O Function P Po o we er r S Su up pp pl ly y 9 VDD P P Po o we er r S Su up pp pl ly y f fo or r L Lo og gi ic c This is a voltage supply pin. It must be connected to external source. 8 VSS P G Gr ro ou un nd d o of f L Lo og gi ic c C Ci ir rc cu ui it t This is a ground pin. It acts as a reference for the logic pins. It must be connected to external ground. 28 VCC P P Po o we er r S Su up pp pl ly y f fo or r OE EL L P Pa an ne el l This is the most positive voltage supply pin of the chip. A stabilization capacitor should be connected between this pin and V SS when the converter is used. It must be connected to external source when the converter is not used. 29 VLSS P G Gr ro ou un nd d o of f A An na al lo og g C Ci ir rc cu ui it t This is an analog ground pin. It should be connected to V SS externally. D Dr ri iv ve er r 26 IREF I C Cu ur rr re en nt t R Re ef fe er re en nc ce e f fo or r B Br ri ig gh ht tn ne es ss s A Ad dj ju us st t me en nt t This pin is segment current reference pin. A resistor should be connected between this pin and V SS . Set the current at 12.5μA maximum. 27 VCOMH O V Vo ol lt ta ag ge e Ou ut tp pu ut t Hi ig gh h L Le ev ve el l f fo or r C C O M S Si ig gn na al l This pin is the input pin for the voltage output high level for COM signals. A capacitor should be connected between this pin and V SS . D DC C/ /D DC C C Co on nv ve er rt te er r 6 VDDB P P Po o we er r S Su up pp pl ly y f fo or r DC C/ / DC C C Co on nv ve er rt te er r C Ci ir rc cu ui it t This is the power supply pin for the internal buffer of the DC/DC voltage converter. It must be connected to external source when the converter is used. It should be connected to V DD when the converter is not used. 4 / 5 2 / 3 C1P / C1N C2P / C2N I P Po os si it ti iv ve e T Te er r mi in na al l o of f t th he e F Fl ly yi in ng g I In nv ve er rt ti in ng g C Ca ap pa ac ci it to or r Ne eg ga at ti iv ve e T Te er r mi in na al l o of f t th he e F Fl ly yi in ng g B Bo oo os st t C Ca ap pa ac ci it to or r The charge-pump capacitors are required between the terminals. They must be floated when the converter is not used. I In nt te er rf fa ac ce e 10 11 12 BS0 BS1 BS2 I C Co o m mu un ni ic ca at ti in ng g P Pr ro ot to oc co ol l S Se el le ec ct t These pins are MCU interface selection input. See the following table: BS0 BS1 BS2 I 2 C 0 1 0 3-wire SPI 1 0 0 4-wire SPI 0 0 0 8-bit 68XX Parallel 0 0 1 8-bit 80XX Parallel 0 1 1 14 RES# I P Po o we er r R Re es se et t f fo or r C Co on nt tr ro ol ll le er r a an nd d Dr ri iv ve er r This pin is reset signal input. When the pin is low, initialization of the chip is executed. Keep this pin pull high during normal operation. 13 CS# I C Ch hi ip p S Se el le ec ct t This pin is the chip select input. The chip is enabled for MCU communication only when CS# is pulled low. 15 D/C# I Da at ta a/ /C Co o m ma an nd d C Co on nt tr ro ol l This pin is Data/Command control pin. When the pin is pulled high, the input at D7~D0 is treated as display data. When the pin is pulled low, the input at D7~D0 will be transferred to the command register. When the pin is pulled high and serial interface mode is selected, the data at SDIN will be interpreted as data. When it is pulled low, the data at SDIN will be transferred to the command register. In I 2 C mode, this pin acts as SA0 for slave address selection. For detail relationship to MCU interface signals, please refer to the Timing Characteristics Diagrams. 17 E/RD# I R Re ea ad d/ / Wr ri it te e E En na ab bl le e o or r R Re ea ad d This pin is MCU interface input. When interfacing to a 68XX-series microprocessor, this pin will be used as the Enable (E) signal. Read/write operation is initiated when this pin is pulled high and the CS# is pulled low. When connecting to an 80XX-microprocessor, this pin receives the Read (RD#) signal. Data read operation is initiated when this pin is pulled low and CS# is pulled low. When serial or I 2 C mode is selected, this pin must be connected to V SS . GoldenMorning Electronic 4 1.5 Pin Definition (Continued) Pin Number Symbol I/O Function I In nt te er rf fa ac ce e ( (C Co on nt ti in nu ue ed d) ) 16 R/W# I R Re ea ad d/ / Wr ri it te e S Se el le ec ct t o or r Wr ri it te e This pin is MCU interface input. When interfacing to a 68XX-series microprocessor, this pin will be used as Read/Write (R/W#) selection input. Pull this pin to “High” for read mode and pull it to “Low” for write mode. When 80XX interface mode is selected, this pin will be the Write (WR#) input. Data write operation is initiated when this pin is pulled low and the CS# is pulled low. When serial or I 2 C mode is selected, this pin must be connected to V SS . 18~25 D0~D7 I/O Ho os st t Da at ta a I In np pu ut t/ / Ou ut tp pu ut t B Bu us s These pins are 8-bit bi-directional data bus to be connected to the microprocessor’s data bus. When serial mode is selected, D1 will be the serial data input SDIN and D0 will be the serial clock input SCLK. When I 2 C mode is selected, D2 & D1 should be tired together and serve as SDA out & SDA in in application and D0 is the serial clock input SCL. Unused pins must be connected to V SS except for D2 in serial mode. R Re es se er rv ve e 7 N.C. - R Re es se er rv ve ed d P Pi in n The N.C. pin between function pins are reserved for compatible and flexible design. 1, 30 N.C. (GND) - R Re es se er rv ve ed d P Pi in n ( (S Su up pp po or rt ti in ng g P Pi in n) ) The supporting pins can reduce the influences from stresses on the function pins. These pins must be connected to external ground as the ESD protection circuit.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

541板哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值