Chinaunix首页 | 论坛 | 博客
  • 博客访问: 140829
  • 博文数量: 27
  • 博客积分: 1405
  • 博客等级: 上尉
  • 技术积分: 362
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-10 15:48
文章存档

2013年(3)

2011年(1)

2010年(1)

2008年(22)

我的朋友

分类:

2008-10-14 09:54:46

#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include "LCD.h"
    int ILI9225_init(void){
  //************* Start Initial Sequence **********//
  LCD_WRITE_CMD(0x01); LCD_WRITE_DATA(0x011C); // set SS and NL bit
  LCD_WRITE_CMD(0x02); LCD_WRITE_DATA(0x0100); // set 1 line inversion
  LCD_WRITE_CMD(0x03); LCD_WRITE_DATA(0x1030); // set GRAM write direction and BGR=1.
  LCD_WRITE_CMD(0x08); LCD_WRITE_DATA(0x0808); // set BP and FP
  LCD_WRITE_CMD(0x0B); LCD_WRITE_DATA(0x1100); //frame cycle
  LCD_WRITE_CMD(0x0C); LCD_WRITE_DATA(0x0000); // RGB interface setting R0Ch=0x0110 for RGB 18Bit and R0Ch=0111for RGB16Bit
  LCD_WRITE_CMD(0x0F); LCD_WRITE_DATA(0x1401); // Set frame rate----0801
  LCD_WRITE_CMD(0x15); LCD_WRITE_DATA(0x0000); //set system interface
  LCD_WRITE_CMD(0x20); LCD_WRITE_DATA(0x0000); // Set GRAM Address
  LCD_WRITE_CMD(0x21); LCD_WRITE_DATA(0x0000); // Set GRAM Address
  //*************Power On sequence ****************//
    Delayms(50);                         // Delay 50ms
  LCD_WRITE_CMD(0x10); LCD_WRITE_DATA(0x0800); // Set SAP,DSTB,STB----0A00
  LCD_WRITE_CMD(0x11); LCD_WRITE_DATA(0x1F3F); // Set APON,PON,AON,VCI1EN,VC----1038
    Delayms(50);                         // Delay 50ms
  LCD_WRITE_CMD(0x12); LCD_WRITE_DATA(0x0121); // Internal reference voltage= Vci;----1121
  LCD_WRITE_CMD(0x13); LCD_WRITE_DATA(0x006F); // Set GVDD----0066
  LCD_WRITE_CMD(0x14); LCD_WRITE_DATA(0x4349); // Set VCOMH/VCOML voltage----5F60
  //-------------- Set GRAM area -----------------//
  LCD_WRITE_CMD(0x30); LCD_WRITE_DATA(0x0000);
  LCD_WRITE_CMD(0x31); LCD_WRITE_DATA(0x00DB);
  LCD_WRITE_CMD(0x32); LCD_WRITE_DATA(0x0000);
  LCD_WRITE_CMD(0x33); LCD_WRITE_DATA(0x0000);
  LCD_WRITE_CMD(0x34); LCD_WRITE_DATA(0x00DB);
  LCD_WRITE_CMD(0x35); LCD_WRITE_DATA(0x0000);
  LCD_WRITE_CMD(0x36); LCD_WRITE_DATA(0x00AF);
  LCD_WRITE_CMD(0x37); LCD_WRITE_DATA(0x0000);
  LCD_WRITE_CMD(0x38); LCD_WRITE_DATA(0x00DB);
  LCD_WRITE_CMD(0x39); LCD_WRITE_DATA(0x0000);
  // ----------- Adjust the Gamma Curve ----------//
  LCD_WRITE_CMD(0x50); LCD_WRITE_DATA(0x0001);  //0400
  LCD_WRITE_CMD(0x51); LCD_WRITE_DATA(0x200B);  //060B
  LCD_WRITE_CMD(0x52); LCD_WRITE_DATA(0x0000);  //0C0A
  LCD_WRITE_CMD(0x53); LCD_WRITE_DATA(0x0404);  //0105
  LCD_WRITE_CMD(0x54); LCD_WRITE_DATA(0x0C0C);  //0A0C
  LCD_WRITE_CMD(0x55); LCD_WRITE_DATA(0x000C);  //0B06
  LCD_WRITE_CMD(0x56); LCD_WRITE_DATA(0x0101);  //0004
  LCD_WRITE_CMD(0x57); LCD_WRITE_DATA(0x0400);  //0501
  LCD_WRITE_CMD(0x58); LCD_WRITE_DATA(0x1108);  //0E00
  LCD_WRITE_CMD(0x59); LCD_WRITE_DATA(0x050C);  //000E
  Delayms(50);                                     // Delay 50ms
  LCD_WRITE_CMD(0x07); LCD_WRITE_DATA(0x1017);
  LCD_WRITE_CMD(0x22);
     }
 
 
 
void LCD_Enter_Standby_ILI9225(void)
{
  LCD_CtrlWrite_ILI9225(0x0007, 0x0000); // Set D1=0, D0=1
  Delayms(50);
  LCD_CtrlWrite_ILI9225(0x0011, 0x0007); // Set APON,PON,AON,VCI1EN,VC
  Delayms(50);
  LCD_CtrlWrite_ILI9225(0x0010, 0x0A01); // Enter Standby mode
}
void LCD_Exit_Standby _ILI9225(void)
{
  LCD_CtrlWrite_ILI9225(0x0010, 0x0800); // Exit Sleep/ Standby mode
  LCD_CtrlWrite_ILI9225(0x0011, 0x1F3F); // Set APON,PON,AON,VCI1EN,VC
  Delayms(50)
  LCD_CtrlWrite_ILI9225(0x0007, 0x1017); // Set D1=0, D0=1
}
阅读(4047) | 评论(1) | 转发(0) |
0

上一篇:LGDP4532初始化

下一篇:NT39115初始化

给主人留下些什么吧!~~