目录
- 1 学习背景
- 2 模块介绍
- 2.1 外观
- 2.2 原理图
- 3 模块控制
- 3.1 80并口时序
- 3.2 指令/数据 读写方式
- 3.2 上电/控制顺序
- 3.3 主要指令
- 4 相关资料
1 学习背景
以前学习 STM32 时普中科技的开发板有一块遗留的 LCD 屏幕:R61509V3。现在想用 FPGA 实现屏幕的驱动,需要系统的学习屏幕控制的原理。
2 模块介绍
2.1 外观
2.2 原理图
驱动IC:R61509V
电阻触摸屏控制器:XPT2046
液晶面板:TFT1P5361或IPS1P7167(不确定)
R61509采用80系统16位总线接口(80-System 16-bit Bus Interface)
3 模块控制
根据R61509的芯片数据手册《R61509V 260k-color, 240RGB x 432-dot graphics liquid crystal controller driver for Amorphous-Silicon TFT Panel》介绍,控制这块驱动需要注意以下几个方面。
3.1 80并口时序
结合“Electrical Characteristics”章-“AC Characteristics”节-“80-system 18-/16-/9-/8-bit Bus interface Timing Characteristics”条 与 “Timing Characteristics”章-“80-system Bus Interface”节可得时序与要求如下:
根据“Pin Function”章可知,对于16位80并口,主要的控制信号如下:
信号 | 含义 |
---|---|
RS | 选择寄存器,0:Index register 1:Control register |
CSX | 片选信号 |
WRX/RDX | 写使能或者读使能,0有效 |
DB[15:0] | 数据总线 |
简单说明,片选信号没有时序要求,使用器件的时候拉低就行。RS、DB[15:0] 可以理解为在WRX/RDX上升沿采样,根据指标要求,数据读写的速率主要取决于WRX/RDX的周期,WRX/RDX满足时序要求时,其他的基本上也满足,注意到t_CYCW最小值对应的频率约为13.33MHz。
3.2 指令/数据 读写方式
R61509V采用18位总线结构,以实现与高性能微机的高速接口。在本实例中,FPGA发送16位控制信息存储到指令寄存器(IR)和数据寄存器(DR),R61509V根据寄存器的值进行相关处理。R61509V的内部操作是由FPGA发送的信号控制的,控制器通过控制 寄存器选择信号(RS)、读写信号(R/W)和内部16位数据总线信号(IB15 ~ IB0) 以 80总线协议 更新指令寄存器(IR)和数据寄存器(DR) 来实现相关的指令。
寄存器选择信号(RS)为低电平:选择指令寄存器(IR)
寄存器选择信号(RS)为高电平:选择数据寄存器(DR)
以指令Display Control 1 (R007h)为例:
为了将控制字BASEE置为1,首先需要将 16‘h0007 写入指令寄存器(IR)
然后将数据 16’h0100 写入数据寄存器(DR),完成指令Display Control 1 的设置。
3.2 上电/控制顺序
在数据手册“Power Supply Setting Sequence”章中,有上电顺序图如下:
在“Instruction Setting Sequence and Refresh Sequence”章“Display ON/OFF Sequences and Refresh Sequence”节中有开启显示的顺序图如下:
根据上电/控制顺序图,就可以控制这块屏幕。
3.3 主要指令
如果要用户去调教好彩屏并设置相关指令是比较繁琐的,所以初始化控制的参数指令一般是厂家提供的,根据普中科技开发板给出的 R61509V3 控制例程,初始化相关的指令为:
序号 | 指令寄存器(IR) | 数据寄存器(DR) | 备注 |
---|---|---|---|
1 | LCD_WriteCmd(0x0000); | Device code read | |
2 | LCD_WriteCmd(0x0000); | Device code read | |
3 | LCD_WriteCmd(0x0000); | Device code read | |
4 | LCD_WriteCmd(0x0000); | Device code read | |
5 | LCD_WriteCmd(0x0000); | Device code read | |
6 | LCD_WriteCmd(0x0000); | Device code read | |
7 | LCD_WriteCmd(0x0000); | Device code read | |
8 | LCD_WriteCmd(0x0000); | Device code read | |
9 | LCD_WriteCmd(0x0000); | Device code read | |
10 | LCD_WriteCmd(0x0000); | Device code read | |
11 | LCD_WriteCmd(0x0400); | LCD_WriteData(0x6200); | Base Image Number of Line |
12 | LCD_WriteCmd(0x0008); | LCD_WriteData(0x0808); | Display Control 2 |
13 | LCD_WriteCmd(0x0300); | LCD_WriteData(0x0005); | gamma Control |
14 | LCD_WriteCmd(0x0301); | LCD_WriteData(0x4C06); | gamma Control |
15 | LCD_WriteCmd(0x0302); | LCD_WriteData(0x0602); | gamma Control |
16 | LCD_WriteCmd(0x0303); | LCD_WriteData(0x050C); | gamma Control |
17 | LCD_WriteCmd(0x0304); | LCD_WriteData(0x3300); | gamma Control |
18 | LCD_WriteCmd(0x0305); | LCD_WriteData(0x0C05); | gamma Control |
19 | LCD_WriteCmd(0x0306); | LCD_WriteData(0x4206); | gamma Control |
20 | LCD_WriteCmd(0x0307); | LCD_WriteData(0x060C); | gamma Control |
21 | LCD_WriteCmd(0x0308); | LCD_WriteData(0x0500); | gamma Control |
22 | LCD_WriteCmd(0x0309); | LCD_WriteData(0x0033); | gamma Control |
23 | LCD_WriteCmd(0x0010); | LCD_WriteData(0x0014); | Panel Interface Control 1 |
24 | LCD_WriteCmd(0x0011); | LCD_WriteData(0x0101); | Panel Interface Control 2 |
25 | LCD_WriteCmd(0x0012); | LCD_WriteData(0x0000); | Panel Interface Control 3 |
26 | LCD_WriteCmd(0x0013); | LCD_WriteData(0x0001); | Panel Interface Control 4 |
27 | LCD_WriteCmd(0x0100); | LCD_WriteData(0x0330); | Power Control 1 |
28 | LCD_WriteCmd(0x0101); | LCD_WriteData(0x0247); | Power Control 2 |
29 | LCD_WriteCmd(0x0103); | LCD_WriteData(0x1000); | Power Control 4 |
30 | LCD_WriteCmd(0x0280); | LCD_WriteData(0xDE00); | NVM Data Read / NVM Data Write |
31 | LCD_WriteCmd(0x0102); | LCD_WriteData(0xD1B0); | Power Control 3 |
32 | LCD_WriteCmd(0x0001); | LCD_WriteData(0x0100); | Driver Output Control |
33 | LCD_WriteCmd(0x0002); | LCD_WriteData(0x0100); | LCD Drive Wave Control |
34 | LCD_WriteCmd(0x0003); | LCD_WriteData(0x1030); | Entry Mode |
35 | LCD_WriteCmd(0x0009); | LCD_WriteData(0x0001); | Display Control 3 |
36 | LCD_WriteCmd(0x000C); | LCD_WriteData(0x0000); | External Display Interface Control 1 |
37 | LCD_WriteCmd(0x0090); | LCD_WriteData(0x8000); | Frame Marker Control |
38 | LCD_WriteCmd(0x000F); | LCD_WriteData(0x0000); | External Display Interface Control 2 |
39 | LCD_WriteCmd(0x0210); | LCD_WriteData(0x0000); | Window Horizontal RAM Address Start |
40 | LCD_WriteCmd(0x0211); | LCD_WriteData(0x00EF); | Window Horizontal RAM Address End |
41 | LCD_WriteCmd(0x0212); | LCD_WriteData(0x0000); | Window Vertical RAM Address Start |
42 | LCD_WriteCmd(0x0213); | LCD_WriteData(0x018F); | Window Vertical RAM Address End |
43 | LCD_WriteCmd(0x0500); | LCD_WriteData(0x0000); | Partial Image 1: Display Position |
44 | LCD_WriteCmd(0x0501); | LCD_WriteData(0x0000); | RAM Address 1 (Start Line Address) |
45 | LCD_WriteCmd(0x0502); | LCD_WriteData(0x005F); | RAM Address 2 (End Line Address) |
46 | LCD_WriteCmd(0x0401); | LCD_WriteData(0x0001); | Base Image Display Control |
47 | LCD_WriteCmd(0x0404); | LCD_WriteData(0x0000); | Base Image Vertical Scroll Control |
48 | LCD_WriteCmd(0x0007); | LCD_WriteData(0x0100); | Display Control 1 |
49 | LCD_WriteCmd(0x0200); | LCD_WriteData(0x0000); | RAM Address Set(Horizontal Address) |
50 | LCD_WriteCmd(0x0201); | LCD_WriteData(0x0000); | RAM Address Set(Vertical Address) |
51 | LCD_WriteCmd(0x0202); | GRAM Data Write/GRAM Data Read |
具体含义可以参考数据手册
其中比较重要的几个:
Window Horizontal RAM Address Start (R210h) | 设置RAM水平起始地址 | 根据这4个指令设置屏幕像素点尺寸,这里设置为240*400 |
Window Horizontal RAM Address End(R211h) | 设置RAM水平终止地址 | |
Window Vertical RAM Address Start (R212h) | 设置RAM垂直起始地址 | |
Window Vertical RAM Address End (R213h) | 设置RAM垂直终止地址 | |
Entry Mode (R003h) | 设置扫描方式 | 根据控制字ORG , AM, ID设置扫描方式,见下图 |
RAM Address Set (Horizontal Address) (R200h) | 设置地址计数器水平地址 | 根据这两个指令设置地址计数器的值,写入像素点RGB数据后,地址计数器会按照设置好的扫描方式自加,在刷新屏幕的时候,将这两个计数器指令后,连续写入总像素点个数的RGB数据即可完成GRAM刷新。 |
RAM Address Set (Vertical Address) (R201h) | 设置地址计数器垂直地址 | |
Power Control3 (R102h) | 电源控制 | 根据上电顺序,在完成用户设置之后设置控制字PSON=1, PON=1以打开电源 |
Display Control 1 (R007h) | 控制显示开启或者关闭 | 设置控制字BASEE=1以打开显示 |
根据需要的扫描方式设置Entry Mode (R003h):ORG , AM, ID
4 相关资料
链接:https://pan.baidu.com/s/1Zbdfrg1iYNJjqs24b2hwwA
提取码:1234