#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include "LCD.h"
int NT39116_init(void){
//************* Reset LCD Driver ****************//
//LCD_nRESET = 1;
//delayms(1); // Delay 1ms
//LCD_nRESET = 0;
//delayms(10); // Delay 10ms
//LCD_nRESET = 1;
//delayms(50); // Delay 50 ms
//************* Start Initial Sequence **********//
LCD_WRITE_CMD(0x0011); //Turn off sleep mode and Turn on LCD power
Delayms(120);
LCD_WRITE_CMD(0x00C0); //Set the GVDD voltage
LCD_WRITE_DATA(0x000A);
LCD_WRITE_CMD(0x00C1); //Set the multiple time of 1st booster and VGH/VGL supply level
LCD_WRITE_DATA(0x0006);
LCD_WRITE_DATA(0x0006);
LCD_WRITE_DATA(0x0006);
LCD_WRITE_CMD(0x00C2); //Set 1st booster,source ability and pump clock.(Normal mode)
LCD_WRITE_DATA(0x0075);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_CMD(0x00C3); //Set 1st booster,source ability and pump clock.(Idle mode)
LCD_WRITE_DATA(0x0075);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_CMD(0x00C4); //Set 1st booster,source ability and pump clock.(Partial mode)
LCD_WRITE_DATA(0x0075);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_CMD(0x00C5); //Set the VCOMH,VCOML offset
LCD_WRITE_DATA(0x0020);
LCD_WRITE_DATA(0x003C);
LCD_WRITE_CMD(0x00C7); //Set the VCOM offset
LCD_WRITE_DATA(0x00C7);
//******Set the positive Gamma curve code******//
LCD_WRITE_CMD(0x00E0);
LCD_WRITE_DATA(0x0007);
LCD_WRITE_DATA(0x0009);
LCD_WRITE_DATA(0x0011);
LCD_WRITE_DATA(0x000E);
LCD_WRITE_DATA(0x0014);
LCD_WRITE_DATA(0x0016);
LCD_WRITE_DATA(0x0039);
LCD_WRITE_DATA(0x008A);
LCD_WRITE_DATA(0x0048);
LCD_WRITE_DATA(0x000C);
LCD_WRITE_DATA(0x001F);
LCD_WRITE_DATA(0x0025);
LCD_WRITE_DATA(0x0017);
LCD_WRITE_DATA(0x001B);
LCD_WRITE_DATA(0x0038);
//******Set the negative Gamma curve code******//
LCD_WRITE_CMD(0x00E1);
LCD_WRITE_DATA(0x0006);
LCD_WRITE_DATA(0x0023);
LCD_WRITE_DATA(0x0027);
LCD_WRITE_DATA(0x000A);
LCD_WRITE_DATA(0x0010);
LCD_WRITE_DATA(0x0013);
LCD_WRITE_DATA(0x0039);
LCD_WRITE_DATA(0x0057);
LCD_WRITE_DATA(0x0048);
LCD_WRITE_DATA(0x0009);
LCD_WRITE_DATA(0x001B);
LCD_WRITE_DATA(0x0021);
LCD_WRITE_DATA(0x002D);
LCD_WRITE_DATA(0x0035);
LCD_WRITE_DATA(0x0037);
LCD_WRITE_CMD(0x0026); //Gamma set register
LCD_WRITE_DATA(0x0010);
LCD_WRITE_CMD(0x00B1); //Set Frame Rate to 60Hz for Normal mode
LCD_WRITE_DATA(0x006A);
LCD_WRITE_DATA(0x0015);
LCD_WRITE_CMD(0x00B2); //Set Frame Rate to 60Hz for Idle mode
LCD_WRITE_DATA(0x006A);
LCD_WRITE_DATA(0x0015);
LCD_WRITE_CMD(0x00B3); //Set Frame Rate to 60Hz for Partial mode
LCD_WRITE_DATA(0x006A);
LCD_WRITE_DATA(0x0015);
LCD_WRITE_CMD(0x00B4); //Set Inversion Control
LCD_WRITE_DATA(0x0002);
LCD_WRITE_CMD(0x00B6); //Set EQ,non-overlap of Gate and Source delay
LCD_WRITE_DATA(0x0001);
LCD_WRITE_DATA(0x0004);
//******Wondow setting******//
LCD_WRITE_CMD(0x002A); //
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x00EF);
LCD_WRITE_CMD(0x002B); //
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0001);
LCD_WRITE_DATA(0x003F);
LCD_WRITE_CMD(0x002C); //Memory write
LCD_WRITE_CMD(0x0029); //Display on
LCD_WRITE_CMD(0x0010);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0000);
LCD_WRITE_DATA(0x0001);
LCD_WRITE_DATA(0x003f);
LCD_WRITE_CMD(0x0012);
}
/********************************************************************************
DESCRIPTION:
LCM display window setting.
PARAMETERS:
xs: Horizontal Address Start Position
xe: Horizontal Address End Position
ys: Vertical Address Start Position
ye: Vertical Address End Position
RETURNS:
REMARKS:
*********************************************************************************/
void LCD_set_Window_NT39116(int xs,int xe,int ys,int ye)
{
LCD_WRITE_CMD(0x002A); //
LCD_WRITE_DATA(xs>>8);
LCD_WRITE_DATA(xs);
LCD_WRITE_DATA(xe>>8);
LCD_WRITE_DATA(xe);
LCD_WRITE_CMD(0x002B); //
LCD_WRITE_DATA(ys>>8);
LCD_WRITE_DATA(ys);
LCD_WRITE_DATA(ye>>8);
LCD_WRITE_DATA(ye);
LCD_WRITE_CMD(0x002C); //Memory write
LCD_WRITE_CMD(0x0029); //Display on
}
/********************************************************************************
DESCRIPTION:
LCM exit_sleep_mode sequence.
PARAMETERS:
RETURNS:
REMARKS:
*********************************************************************************/
void LCD_ExitSleep_NT39116(void)
{
}
/********************************************************************************
DESCRIPTION:
LCM enter_sleep_mode sequence.
PARAMETERS:
RETURNS:
REMARKS:
*********************************************************************************/
void LCD_EnterSleep_NT39116(void)
{
}
阅读(2523) | 评论(1) | 转发(0) |