FPGA驱动ILI9341 TFT液晶显示指南

ILI9341 TFT-LCD

TFT-LCD 即薄膜晶体管液晶显示器。其英文全称为: Thin Film Transistor-Liquid Crystal Display。 TFT-LCD与无源 TN-LCD、 STN-LCD 的简单矩阵不同,它在液晶显示屏的每一个象素上都设置有一个薄膜晶体管(TFT),可有效地克服非选通时的串扰,使显示液晶屏的静态特性与扫描线数无关,因此大大提高了图像质量。 TFT-LCD 也被叫做真彩液晶显示器。

ILI9341硬件管脚

CS: TFTLCD 片选信号。
WR:向 TFTLCD 写入数据。
RD:从 TFTLCD 读取数据。
D[15:0]: 16 位双向数据线。
RST:硬复位 TFTLCD。
RS:命令/数据标志(0,读写命令; 1,读写数据)。

ILI9341控制器

ILI9341 液晶控制器自带显存,其显存总大小为 172800240*320*18/8),即 18 位模式(26万色)下的显存量。在 16 位模式下, ILI9341 采用 RGB565 格式存储颜色数据,时 ILI934118 位数据线与 MCU 16 位数据线以及 LCD GRAM 的对应关系如图所示:

ILI9341 所有的指令都是 8 位的(高 8 位无效),且参数除了读写 GRAM 的时候是 16 位,其他操作参数,都是 8 位。

读写时序

采用并行16bit信号通信接口模式:

数据信号对应的颜色控制与像素点控制原理:

控制信号的控制原理:

 

写操作

主端在wrx信号下降沿是发出数据,ILI9341控制器在WRX的上升沿读取数据,读取完成后主端重新发送数据;

读时序

ILI9341在RDX的下降沿送出数据,主端在RDX的上升沿读取数据;

关键命令

Read ID4 (D3h)

Memory Access Control (36h)

 

Column Address Set (2Ah)

列地址设置指令, 在从左到右,从上到下的扫描方式(默认)下面,该指令用于设置横坐标(x 坐标)。

在默认扫描方式时,该指令用于设置 x 坐标,该指令带有 4 个参数,实际上是 2 个坐标值:SC EC,即列地址的起始值和结束值, SC 必须小于等于 EC,且 0SC/EC239。一般在设置 x 坐标的时候,我们只需要带 2 个参数即可,也就是设置 SC 即可,因为如果 EC 没有变化,我们只需要设置一次即可(在初始化 ILI9341 的时候设置),从而提高速度。

Page Address Set (2Bh)

页地址设置指令。

Memory Write (2Ch)

GRAM 指令,在发送该指令之后,我们便可以往 LCDGRAM 里面写入颜色数据了,该指令支持连续写。

 

Memory Read (2Eh)

GRAM 指令,用于读取 ILI9341 的显存(GRAM),

 

驱动显示流程

任何 LCD,使用流程都可以简单的用以上流程图表示。其中硬复位和初始化序列,只需要执行一次即可。而画点流程就是:设置坐标àGRAM 指令à写入颜色数据,然后在 LCD 上面,我们就可以看到对应的点显示我们写入的颜色了。

复位

对复位管脚进行拉低复位100ms,然后进行拉高解复位操作。

初始化

指令

数据

说明

16'h00cf

16'h0000

16'h0081

16'h0030

Power control B

16'h00ed

16'h0064

16'h0003

16'h0012

16'h0081

Power on sequence control

16'h00e8

16'h0085

16'h0010

16'h0078

Driver timing control A

16'h00cb

16'h0039

16'h002c

16'h0000

16'h0034

16'h0002

Power control A

16'h00f7

16'h0020

Pump ratio control

16'h00ea

16'h0000

16'h0000

Driver timing control B

16'h00b1

16'h0000

16'h001b

Frame Rate Control (In Normal Mode/Full Colors)

16'h00b6

16'h000a

16'h00a2

Display Function Control

16'h00c0

16'h0035

Power Control 1

16'h00c1

16'h0011

Power Control 2

16'h00c5

16'h0045

16'h0045

VCOM Control 1

16'h00c7

16'h00a2

VCOM Control 2

16'h00f2

16'h0000

Enable 3 gamma

16'h0026

16'h0001

Gamma Set

16'h00e0

16'h000f

16'h0026

16'h0024

16'h000b

16'h000e

16'h0009

16'h0054

16'h00a8

16'h0046

16'h000c

16'h0017

16'h0009

16'h000f

16'h0007

16'h0000

Positive Gamma Correction

16'h00e1

16'h0000

16'h0019

16'h001b

16'h0004

16'h0010

16'h0007

16'h002a

16'h0047

16'h0039

16'h0003

16'h0006

16'h0006

16'h0030

16'h0038

16'h000f

Negative Gamma Correction

16'h0036

16'h0068

Memory Access Control

初始化配置根据厂家提供的原始配置进行初始化。

设置坐标

指令

数据

说明

16'h002a

16'h0000

16'h0000

16'h0001

16'h003f

Column Address Set

16'h002b

16'h0000

16'h0000

16'h0000

16'h00ef

Page Address Set

16'h003a

16'h0055

COLMOD: Pixel Format Set

16'h0011

NA

Sleep Out

延迟120ms

16'h0029

NA

Display ON

16'h002c

NA

Memory Write

 

清屏

连续写入240*320个数据,使用白色进行清屏;

设置坐标&写入GRAM指令

指令

数据

说明

16'h002a

根据现实的大小设置列位置

Column Address Set

16'h002b

根据现实的大小设置行位置

Page Address Set

16'h002c

NA

Memory Write

 

写入GRAM数据

数据来源可以是ROM里面的数据,也可以是单纯的颜色数据;

 

架构设计

实验结果

 

 

 

9341指令全集

NOP (00h)

Software Reset (01h)

Read display identification information (04h)

Read Display Status (09h)

Read Display Power Mode (0Ah)

Read Display MADCTL (0Bh)

Read Display Pixel Format (0Ch)

Read Display Image Format (0Dh)

Read Display Signal Mode (0Eh)

Read Display Self-Diagnostic Result (0Fh)

Enter Sleep Mode (10h)

Sleep Out (11h)

Partial Mode ON (12h)

Normal Display Mode ON (13h)

Display Inversion OFF (20h)

Display Inversion ON (21h)

Gamma Set (26h)

Display OFF (28h)

Display ON (29h)

Column Address Set (2Ah)

Page Address Set (2Bh)

Memory Write (2Ch)

Color Set (2Dh)

Memory Read (2Eh)

Partial Area (30h)

Vertical Scrolling Definition (33h)

Tearing Effect Line OFF (34h)

Tearing Effect Line ON (35h)

Memory Access Control (36h)

Vertical Scrolling Start Address (37h)

Idle Mode OFF (38h)

Idle Mode ON (39h)

COLMOD: Pixel Format Set (3Ah)

Write_Memory_Continue (3Ch)

Read_Memory_Continue (3Eh)

Set_Tear_Scanline (44h)

Get_Scanline (45h)

Write Display Brightness (51h)

Read Display Brightness (52h)

Write CTRL Display (53h)

Read CTRL Display (54h)

Write Content Adaptive Brightness Control (55h)

Read Content Adaptive Brightness Control (56h)

Write CABC Minimum Brightness (5Eh)

Read CABC Minimum Brightness (5Fh)

Read ID1 (DAh)

Read ID2 (DBh)

Read ID3 (DCh)

RGB Interface Signal Control (B0h)

Frame Rate Control (In Normal Mode/Full Colors) (B1h)

Frame Rate Control (In Idle Mode/8 colors) (B2h)

Frame Rate control (In Partial Mode/Full Colors) (B3h)

Display Inversion Control (B4h)

Blanking Porch Control (B5h)

Display Function Control (B6h)

Entry Mode Set (B7h)

Backlight Control 1 (B8h)

Backlight Control 2 (B9h)

Backlight Control 3 (BAh)

Backlight Control 4 (BBh)

Backlight Control 5 (BCh)

Backlight Control 7 (BEh)

Backlight Control 8 (BFh)

Power Control 1 (C0h)

Power Control 2 (C1h)

VCOM Control 1(C5h)

VCOM Control 2(C7h)

NV Memory Write (D0h)

NV Memory Protection Key (D1h)

NV Memory Status Read (D2h)

Read ID4 (D3h)

Positive Gamma Correction (E0h)

Negative Gamma Correction (E1h)

Digital Gamma Control 1 (E2h)

Digital Gamma Control 2(E3h)

Interface Control (F6h)

Power control A (CBh)

Power control B (CFh)

Driver timing control A (E8h)

Driver timing control B (EAh)

Power on sequence control (EDh)

Enable 3 gamma (F2h)

Pump ratio control (F7h)

posted @ 2022-02-27 15:56  logic3  阅读(3457)  评论(0编辑  收藏  举报