打印

求助ILI9325驱动

[复制链接]
3599|16
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
_crystal_|  楼主 | 2011-3-18 16:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
最近在做的一个TFT屏总是点不亮,请高手指点一下。
贴出初始化代码,请帮忙挑挑毛病
void TFT_Init(void)
{
u16 DeviceCode;

Set_CS;
Set_RD;
Set_WR;
Set_RST;
Delayms(20);
Clr_RST;
Delayms(20);
Set_RST;
Delayms(20);

// Clr_CS;
// TFT_Write_com(0x0000); TFT_Write_dat(0x0001);
// Set_CS;
DeviceCode = TFT_ReadReg(0x0000);        // 读出ID号为9325
send_data(DeviceCode>>8);
send_data(DeviceCode&0xFF);
  
Delayms(50);
Clr_CS; // 打开片选使能
//************* Start Initial Sequence **********//
TFT_Write_com(0x00E5); TFT_Write_dat(0x78F0); // set SRAM internal timing
TFT_Write_com(0x00E3); TFT_Write_dat(0x3008); // set SRAM internal timing
TFT_Write_com(0x00E7); TFT_Write_dat(0x0012); // set SRAM internal timing
TFT_Write_com(0x00EF); TFT_Write_dat(0x1231); // set SRAM internal timing

// TFT_Write_com(0x0000); TFT_Write_dat(0x0001); // start Ocillation  开启内部时钟
TFT_Write_com(0x0001); TFT_Write_dat(0x1000); // set SS and SM bit (S720 -> S1)
TFT_Write_com(0x0002); TFT_Write_dat(0x0700); // set 1 line inversion  电源开启
TFT_Write_com(0x0003); TFT_Write_dat(0x1030); // set GRAM write direction and BGR=1. 、、65K
TFT_Write_com(0x0004); TFT_Write_dat(0x0000); // Resize register
TFT_Write_com(0x0008); TFT_Write_dat(0x0207); // set the back porch and front porch
TFT_Write_com(0x0009); TFT_Write_dat(0x0000); // set non-display area refresh cycle ISC[3:0]
TFT_Write_com(0x000A); TFT_Write_dat(0x0000); // FMARK function
TFT_Write_com(0x000C); TFT_Write_dat(0x0000); // RGB interface setting
TFT_Write_com(0x000D); TFT_Write_dat(0x0000); // Frame marker Position
TFT_Write_com(0x000F); TFT_Write_dat(0x0000); // RGB interface polarity
//*************Power On sequence ****************//
TFT_Write_com(0x0010); TFT_Write_dat(0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
TFT_Write_com(0x0011); TFT_Write_dat(0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
TFT_Write_com(0x0012); TFT_Write_dat(0x0000); // VREG1OUT voltage
TFT_Write_com(0x0013); TFT_Write_dat(0x0000); // VDV[4:0] for VCOM amplitude
// TFT_Write_com(0x0007); TFT_Write_dat(0x0001);
Delayms(200); // Dis-charge capacitor power voltage
TFT_Write_com(0x0010); TFT_Write_dat(0x1090); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB
TFT_Write_com(0x0011); TFT_Write_dat(0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
Delayms(50);
TFT_Write_com(0x0012); TFT_Write_dat(0x001F); //001C// Internal reference voltage= Vci;
Delayms(50);
TFT_Write_com(0x0013); TFT_Write_dat(0x1500); //0x1000//1400   Set VDV[4:0] for VCOM amplitude  1A00
TFT_Write_com(0x0029); TFT_Write_dat(0x0027); //0x0012 //001a  Set VCM[5:0] for VCOMH  //0x0025  0034 电压
Delayms(50);
TFT_Write_com(0x002B); TFT_Write_dat(0x000D); // Set Frame Rate   000C 帧频
Delayms(50);
TFT_Write_com(0x0020); TFT_Write_dat(0x0000); // GRAM horizontal Address
TFT_Write_com(0x0021); TFT_Write_dat(0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
TFT_Write_com(0x0030); TFT_Write_dat(0x0000);
TFT_Write_com(0x0031); TFT_Write_dat(0x0707);
TFT_Write_com(0x0032); TFT_Write_dat(0x0307);
TFT_Write_com(0x0035); TFT_Write_dat(0x0200);
TFT_Write_com(0x0036); TFT_Write_dat(0x0008);
TFT_Write_com(0x0037); TFT_Write_dat(0x0004);
TFT_Write_com(0x0038); TFT_Write_dat(0x0000);
TFT_Write_com(0x0039); TFT_Write_dat(0x0707);
TFT_Write_com(0x003C); TFT_Write_dat(0x0002);
TFT_Write_com(0x003D); TFT_Write_dat(0x1D04);

//------------------ Set GRAM area ---------------//
TFT_Write_com(0x0050); TFT_Write_dat(0x0000); // Horizontal GRAM Start Address
TFT_Write_com(0x0051); TFT_Write_dat(0x00EF); // Horizontal GRAM End Address
TFT_Write_com(0x0052); TFT_Write_dat(0x0000); // Vertical GRAM Start Address
TFT_Write_com(0x0053); TFT_Write_dat(0x013F); // Vertical GRAM Start Address

TFT_Write_com(0x0060); TFT_Write_dat(0xA700); // Gate Scan Line
TFT_Write_com(0x0061); TFT_Write_dat(0x0001); // NDL,VLE, REV
TFT_Write_com(0x006A); TFT_Write_dat(0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
TFT_Write_com(0x0080); TFT_Write_dat(0x0000);
TFT_Write_com(0x0081); TFT_Write_dat(0x0000);
TFT_Write_com(0x0082); TFT_Write_dat(0x0000);
TFT_Write_com(0x0083); TFT_Write_dat(0x0000);
TFT_Write_com(0x0084); TFT_Write_dat(0x0000);
TFT_Write_com(0x0085); TFT_Write_dat(0x0000);
//-------------- Panel Control -------------------//
TFT_Write_com(0x0090); TFT_Write_dat(0x0010);
TFT_Write_com(0x0092); TFT_Write_dat(0x0600);

TFT_Write_com(0x0007); TFT_Write_dat(0x0133); // 262K color and display ON

Set_CS;  //关闭片选使能
}
沙发
mzzzb| | 2011-3-18 16:53 | 只看该作者
网上下一个ILI9325的驱动程序吧,再试试就知道了

使用特权

评论回复
板凳
WGC204| | 2011-3-18 17:04 | 只看该作者
80%点不亮的与TFT_Init(void)没有关系.

使用特权

评论回复
地板
_crystal_|  楼主 | 2011-3-18 17:04 | 只看该作者
网上下了很多个试过了,横屏竖屏的都试,就是不显示。郁闷得很

使用特权

评论回复
5
WGC204| | 2011-3-18 17:08 | 只看该作者
看看TFT_Write_com();这个函数是不是和硬件对应的上

使用特权

评论回复
6
dudu_q| | 2011-3-18 17:12 | 只看该作者
很有可能是背光灯的对比度的问题

使用特权

评论回复
7
_crystal_|  楼主 | 2011-3-18 17:27 | 只看该作者
背光灯的对比度??有关的吗?

使用特权

评论回复
8
adams.gh| | 2011-3-18 21:41 | 只看该作者
deviceCode 读出来没?

使用特权

评论回复
9
_crystal_|  楼主 | 2011-3-19 08:10 | 只看该作者
deviceCode 读出来没?
adams.gh 发表于 2011-3-18 21:41

deviceCode 读出来了,0x9325

使用特权

评论回复
10
_crystal_|  楼主 | 2011-3-19 10:17 | 只看该作者
很有可能是背光灯的对比度的问题
dudu_q 发表于 2011-3-18 17:12

背光灯已改为PWM控制。还是白茫茫一片

使用特权

评论回复
11
IJK| | 2011-3-19 11:00 | 只看该作者
// TFT_Write_com(0x0000); TFT_Write_dat(0x0001); // start Ocillation  开启内部时钟
这1行,取消注释看看。

使用特权

评论回复
12
_crystal_|  楼主 | 2011-3-19 11:15 | 只看该作者
// TFT_Write_com(0x0000); TFT_Write_dat(0x0001); // start Ocillation  开启内部时钟
这1行,取消注释看看。
IJK 发表于 2011-3-19 11:00

不行。看了网上的一些程序,9325的都没有用这一句,只是9320还是9328其它的才有这一句,所以加上试过,加不加都显示不了。

使用特权

评论回复
13
_crystal_|  楼主 | 2011-3-19 11:16 | 只看该作者
3# WGC204
那会是什么地方的问题呢,请指点

使用特权

评论回复
14
bnyuli| | 2011-3-19 13:53 | 只看该作者
问题指出来就好解决了

使用特权

评论回复
15
_crystal_|  楼主 | 2011-3-19 15:00 | 只看该作者
问题指出来就好解决了
bnyuli 发表于 2011-3-19 13:53

是啊
WGC204,如果你知道问题所在,请帮忙指出来

使用特权

评论回复
16
_crystal_|  楼主 | 2011-3-24 09:20 | 只看该作者
用STC作测试,屏可以点亮。
可是为什么到了STM32的板子上就不行了呢?

使用特权

评论回复
17
IJK| | 2011-3-24 09:38 | 只看该作者
用STC作测试,屏可以点亮。
可是为什么到了STM32的板子上就不行了呢?
_crystal_ 发表于 2011-3-24 09:20


看样子是时序问题,把STM32访问LCD的速度降下来应该就行了。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

131

帖子

0

粉丝