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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM