新手入门
积分 12
金钱 12
注册时间 2021-11-10
在线时间 3 小时
5 金钱
大家好,最近在学习LCD显示屏的时候遇到一点问题,思考验证了很久一直没能够解决,所以来提问,希望能够借助大家的智慧完成学习,谢谢!
看到正点原子库函数开发指南上说4.3寸的屏幕分辨率是480*800,所以想在竖屏模式下,在屏幕的中央显示一条红色的竖带,宽度是屏幕宽度的三分之一(160),高度等于800,(见主函数:LCD_Draw_Rectangle(160,0,160,800,RED););但是很奇怪的是,显示不出来,只是在屏幕中央的最上部显示一条红色的横线;但是如果同样的程序我将竖带的快读改为158就没有问题(主函数:LCD_Draw_Rectangle(160,0,158,800,RED);),比158大的数都不行,都没有正确的显示出来,我又另外试验的别的几个长方形结果没有问题如下图:
程序的代码如下,麻烦各位了,谢谢。
LCD头文件如下:
#ifndef LCD_H
#define LCD_H
#include "stm32f4xx.h"
//使用A6线连接到RS引脚(数据\命令选择引脚)
#define LCD_Write_data ((uint32_t)(0x6C000000)|(1<<(6+1)))//结果应该为0x6c0000080
#define LCD_Write_cmd ((uint32_t)(0x6C000000)&~(1<<(6+1)))//结果应该为0x6c0000000
//颜色
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40 //棕色
#define BRRED 0XFC07 //棕红色
#define GRAY 0X8430 //灰色
//定义函数部分
void LCD_Init(void);
void FSMC_LCD_Init(void);
void LCD_Write_In(void);
void NT35510_Write_Data(uint16_t data);
void NT35510_Write_Cmd(uint16_t command);
uint16_t Get_Data_From_LCD(void);
void LCD_Back_Light_Control(uint8_t State);
static void Delay ( __IO uint32_t nCount );
uint16_t Get_LCD_ID(void);
void NT35510_OpenWindow ( uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height );
void LCD_Draw_Rectangle(uint16_t x0,uint16_t wideth,uint16_t y0,uint16_t height,uint16_t color);
void Clear_Screen(uint16_t color);
void NT35510_GramScan ( uint8_t ucOption );
#endif
LCD的C文件如下:
#include "lcd_nt35510.h"
/**
@brief 初始化FSMC
@param 无
@retaval 无
*/
void FSMC_LCD_Init()
{
/**
@brief 初始化GPIO
@param 无
@retaval 无
*/
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF|RCC_AHB1Periph_GPIOG,ENABLE);//时钟使能函数
RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC,ENABLE);//使能FSMC时钟
//初始化IO接口
GPIO_InitTypeDef GPIO_InitStructure;//定义一个名为GPIO_InitStruct的结构体
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_OUT;//配置复用模式
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;//输出类型为:推挽输出
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;//上拉,即开始时引脚为高电平
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_100MHz;//输出速度为50MHz
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;/*******控制背光******/
GPIO_Init(GPIOB,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF;//配置复用模式
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;//输出类型为:推挽输出
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;//上拉,即开始时引脚为高电平
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_100MHz;//输出速度为50MHz
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2;//选择具体的哪个脚
GPIO_Init(GPIOB,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_13;//选择具体的哪个脚
GPIO_Init(GPIOC,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1| GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|
GPIO_Pin_14|GPIO_Pin_15;//选择具体的哪个脚
GPIO_Init(GPIOD,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_7|GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|
GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;//选择具体的哪个脚
GPIO_Init(GPIOE,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_12|GPIO_Pin_11;//选择具体的哪个脚
GPIO_Init(GPIOF,&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_12;//选择具体的哪个脚
GPIO_Init(GPIOG,&GPIO_InitStructure);
//配置复用具体的功能
GPIO_PinAFConfig(GPIOD,GPIO_PinSource0,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource1,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource8,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource9,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource10,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource14,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource15,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource7,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource8,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource9,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource10,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource11,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource12,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource13,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource14,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOE,GPIO_PinSource15,GPIO_AF_FSMC);
//FSMC_A6为地址信号线(数据/命令选择信号线);FSMC_D0-D15为数据信号线;
//FSMC_NBL1,FSMC_NBL0,FSMC_NOE,FSMC_NWE,FSMC_NE3为控制信号线
GPIO_PinAFConfig(GPIOF,GPIO_PinSource12,GPIO_AF_FSMC);//RS 数据/命令选择信号线
GPIO_PinAFConfig(GPIOD,GPIO_PinSource4,GPIO_AF_FSMC);//FSMC_NOE 输出使能(读使能)
GPIO_PinAFConfig(GPIOD,GPIO_PinSource5,GPIO_AF_FSMC);//WR/CLK 写入使能
GPIO_PinAFConfig(GPIOG,GPIO_PinSource12,GPIO_AF_FSMC);//片选信号LCD_CS
GPIO_PinAFConfig(GPIOB,GPIO_PinSource2,GPIO_AF_FSMC);//T_MISO
GPIO_PinAFConfig(GPIOF,GPIO_PinSource11,GPIO_AF_FSMC);//T_MOSI
GPIO_PinAFConfig(GPIOB,GPIO_PinSource1,GPIO_AF_FSMC);//T_PEN
GPIO_PinAFConfig(GPIOC,GPIO_PinSource13,GPIO_AF_FSMC);//T_CS
GPIO_PinAFConfig(GPIOB,GPIO_PinSource0,GPIO_AF_FSMC);//T_SCK
/**
@brief RAM读写的时序结构体
@param 无
@retaval 无
*/
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef readWriteTiming;/* 当不使用扩展模式时,本参数用于配置读写时序,否则用于配置读时序*/
FSMC_NORSRAMTimingInitTypeDef WriteTiming;
/************************************************配置读时序*************************************/
//地址建立时间(ADDSET)为1个HCLK,5/168M = 30ns
readWriteTiming.FSMC_AddressSetupTime = 0x04;
//数据保持时间(DATAST)+ 1个HCLK = 12/168M=72ns(对EM的SRAM芯片)
readWriteTiming.FSMC_DataSetupTime = 0x0f;
//选择匹配SRAM的模式
readWriteTiming.FSMC_AccessMode = FSMC_AccessMode_B;
/*以下配置跟异步SRAM无关*/
//地址保持时间(ADDHLD)模式A未用到
readWriteTiming.FSMC_AddressHoldTime = 0x00;
//设置总线转换周期,仅用于复用模式的NOR操作
readWriteTiming.FSMC_BusTurnAroundDuration = 0x00;
//设置时钟分频,仅用于同步类型的存储器
readWriteTiming.FSMC_CLKDivision = 0x00;
//数据保持时间,仅用于同步型的NOR
readWriteTiming.FSMC_DataLatency = 0x00;
/******************************************配置写时序***************************************/
//地址建立时间(ADDSET)为1个HCLK,9/168M = 54ns
WriteTiming.FSMC_AddressSetupTime = 0x09;
//数据保持时间(DATAST)+ 1个HCLK = 9/168M=54ns(对EM的SRAM芯片)
WriteTiming.FSMC_DataSetupTime = 0x08;
//选择匹配SRAM的模式
WriteTiming.FSMC_AccessMode = FSMC_AccessMode_B;
/*以下配置跟异步SRAM无关*/
//地址保持时间(ADDHLD)模式A未用到
WriteTiming.FSMC_AddressHoldTime = 0x00;
//设置总线转换周期,仅用于复用模式的NOR操作
WriteTiming.FSMC_BusTurnAroundDuration = 0x00;
//设置时钟分频,仅用于同步类型的存储器
WriteTiming.FSMC_CLKDivision = 0x00;
//数据保持时间,仅用于同步型的NOR
WriteTiming.FSMC_DataLatency = 0x00;
/**
@brief FSMC初始化结构体
@param 无
@retaval 无
*/
// 选择FSMC映射的存储区域: Bank1 sram4
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4;
//设置地址总线与数据总线是否复用,仅用于NOR
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
//存储器数据宽度:16位
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
//设置要控制的存储器类型:SRAM类型
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_NOR;
// 不使用扩展模式,读写使用相同的时序
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Enable;
//读写时序配置
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &readWriteTiming;
//读写同样时序,使用扩展模式时这个配置才有效
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &WriteTiming;
//存储器写使能
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
//设置是否使用突发访问模式,仅用于同步类型的存储器
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
/*已下配置SRAM存储器没有设置*/
//设置是否使能等待信号,仅用于同步类型的存储器
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
//不使用等待信号
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
//设置等待信号插入的时间,仅用于同步类型的存储器
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
//设置等待信号的有效极性,仅用于同步类型的存储器
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
//设置是否支持把非对齐的突发操作,仅用于同步类型的存储器
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
//突发写操作
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
//初始化FSMC配置
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
// 使能BANK
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE);
}
/**
* @brief 简单延时函数
* @param nCount :延时计数值
* @retval 无
*/
static void Delay ( __IO uint32_t nCount )
{
for ( ; nCount != 0; nCount -- );
}
/**
@brief 液晶写入的数据
@param 无
@retaval 无
*/
void NT35510_Write_Data(uint16_t data)
{
uint16_t *p = (uint16_t *)(LCD_Write_data);//HADDR[25:1]对应FSMC A[24:0],原理图A6连接的RS,所以二进制100000000转化为16进制为80
*p = data;//发送具体的数据
}
/**
@brief 液晶写入命令
@param 无
@retaval 无
*/
void NT35510_Write_Cmd(uint16_t command)
{
uint16_t *p = (uint16_t *)(LCD_Write_cmd);
*p = command;//发送具体的命令
}
/**
@brief 从液晶屏读取数据
@param 无
@retaval Get_Data_From_LCD从液晶屏读取回来的数据
*/
uint16_t Get_Data_From_LCD()
{
uint16_t *p = (uint16_t *)(LCD_Write_data);
return *p;
}
/**
@brief 读取液晶屏设备ID
@param 无
@retaval LCD_ID设备ID
*/
uint16_t Get_LCD_ID()
{
uint16_t LCD_ID = 0;
NT35510_Write_Cmd(0xDB00);
LCD_ID |= Get_Data_From_LCD();
return LCD_ID;
}
/**
@brief 液晶写入配置函数
@param 无
@retaval 无
*/
void LCD_Write_In()
{
///NT35510-HSD43
//PAGE1
NT35510_Write_Cmd(0xF000); NT35510_Write_Data(0x0055);
NT35510_Write_Cmd(0xF001); NT35510_Write_Data(0x00AA);
NT35510_Write_Cmd(0xF002); NT35510_Write_Data(0x0052);
NT35510_Write_Cmd(0xF003); NT35510_Write_Data(0x0008);
NT35510_Write_Cmd(0xF004); NT35510_Write_Data(0x0001);
//Set AVDD 5.2V
NT35510_Write_Cmd(0xB000); NT35510_Write_Data(0x000D);
NT35510_Write_Cmd(0xB001); NT35510_Write_Data(0x000D);
NT35510_Write_Cmd(0xB002); NT35510_Write_Data(0x000D);
//Set AVEE 5.2V
NT35510_Write_Cmd(0xB100); NT35510_Write_Data(0x000D);
NT35510_Write_Cmd(0xB101); NT35510_Write_Data(0x000D);
NT35510_Write_Cmd(0xB102); NT35510_Write_Data(0x000D);
//Set VCL -2.5V
NT35510_Write_Cmd(0xB200); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xB201); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xB202); NT35510_Write_Data(0x0000);
//Set AVDD Ratio
NT35510_Write_Cmd(0xB600); NT35510_Write_Data(0x0044);
NT35510_Write_Cmd(0xB601); NT35510_Write_Data(0x0044);
NT35510_Write_Cmd(0xB602); NT35510_Write_Data(0x0044);
//Set AVEE Ratio
NT35510_Write_Cmd(0xB700); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB701); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB702); NT35510_Write_Data(0x0034);
//Set VCL -2.5V
NT35510_Write_Cmd(0xB800); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB801); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB802); NT35510_Write_Data(0x0034);
//Control VGH booster voltage rang
NT35510_Write_Cmd(0xBF00); NT35510_Write_Data(0x0001); //VGH:7~18V
//VGH=15V(1V/step) Free pump
NT35510_Write_Cmd(0xB300); NT35510_Write_Data(0x000f); //08
NT35510_Write_Cmd(0xB301); NT35510_Write_Data(0x000f); //08
NT35510_Write_Cmd(0xB302); NT35510_Write_Data(0x000f); //08
//VGH Ratio
NT35510_Write_Cmd(0xB900); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB901); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xB902); NT35510_Write_Data(0x0034);
//VGL_REG=-10(1V/step)
NT35510_Write_Cmd(0xB500); NT35510_Write_Data(0x0008);
NT35510_Write_Cmd(0xB501); NT35510_Write_Data(0x0008);
NT35510_Write_Cmd(0xB502); NT35510_Write_Data(0x0008);
NT35510_Write_Cmd(0xC200); NT35510_Write_Data(0x0003);
//VGLX Ratio
NT35510_Write_Cmd(0xBA00); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xBA01); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xBA02); NT35510_Write_Data(0x0034);
//VGMP/VGSP=4.5V/0V
NT35510_Write_Cmd(0xBC00); NT35510_Write_Data(0x0000); //00
NT35510_Write_Cmd(0xBC01); NT35510_Write_Data(0x0078); //C8 =5.5V/90=4.8V
NT35510_Write_Cmd(0xBC02); NT35510_Write_Data(0x0000); //01
//VGMN/VGSN=-4.5V/0V
NT35510_Write_Cmd(0xBD00); NT35510_Write_Data(0x0000); //00
NT35510_Write_Cmd(0xBD01); NT35510_Write_Data(0x0078); //90
NT35510_Write_Cmd(0xBD02); NT35510_Write_Data(0x0000);
//Vcom=-1.4V(12.5mV/step)
NT35510_Write_Cmd(0xBE00); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xBE01); NT35510_Write_Data(0x0064); //HSD:64;Novatek:50=-1.0V, 80 5f
//Gamma (R+)
NT35510_Write_Cmd(0xD100); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD101); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD102); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD103); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD104); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD105); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD106); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD107); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD108); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD109); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD10A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD10B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD10C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD10D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD10E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD10F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD110); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD111); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD112); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD113); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD114); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD115); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD116); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD117); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD118); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD119); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD11A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD11B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD11C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD11D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD11E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD11F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD120); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD121); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD122); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD123); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD124); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD125); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD126); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD127); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD128); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD129); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD12A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD12B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD12C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD12D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD12E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD12F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD130); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD131); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD132); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD133); NT35510_Write_Data(0x006D);
//Gamma (G+)
NT35510_Write_Cmd(0xD200); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD201); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD202); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD203); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD204); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD205); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD206); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD207); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD208); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD209); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD20A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD20B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD20C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD20D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD20E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD20F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD210); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD211); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD212); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD213); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD214); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD215); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD216); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD217); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD218); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD219); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD21A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD21B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD21C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD21D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD21E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD21F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD220); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD221); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD222); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD223); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD224); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD225); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD226); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD227); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD228); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD229); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD22A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD22B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD22C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD22D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD22E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD22F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD230); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD231); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD232); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD233); NT35510_Write_Data(0x006D);
//Gamma (B+)
NT35510_Write_Cmd(0xD300); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD301); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD302); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD303); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD304); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD305); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD306); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD307); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD308); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD309); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD30A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD30B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD30C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD30D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD30E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD30F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD310); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD311); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD312); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD313); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD314); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD315); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD316); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD317); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD318); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD319); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD31A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD31B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD31C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD31D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD31E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD31F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD320); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD321); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD322); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD323); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD324); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD325); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD326); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD327); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD328); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD329); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD32A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD32B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD32C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD32D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD32E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD32F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD330); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD331); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD332); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD333); NT35510_Write_Data(0x006D);
//Gamma (R-)
NT35510_Write_Cmd(0xD400); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD401); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD402); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD403); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD404); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD405); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD406); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD407); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD408); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD409); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD40A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD40B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD40C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD40D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD40E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD40F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD410); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD411); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD412); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD413); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD414); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD415); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD416); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD417); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD418); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD419); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD41A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD41B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD41C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD41D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD41E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD41F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD420); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD421); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD422); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD423); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD424); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD425); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD426); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD427); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD428); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD429); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD42A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD42B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD42C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD42D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD42E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD42F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD430); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD431); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD432); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD433); NT35510_Write_Data(0x006D);
//Gamma (G-)
NT35510_Write_Cmd(0xD500); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD501); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD502); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD503); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD504); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD505); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD506); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD507); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD508); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD509); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD50A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD50B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD50C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD50D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD50E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD50F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD510); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD511); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD512); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD513); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD514); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD515); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD516); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD517); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD518); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD519); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD51A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD51B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD51C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD51D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD51E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD51F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD520); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD521); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD522); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD523); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD524); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD525); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD526); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD527); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD528); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD529); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD52A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD52B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD52C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD52D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD52E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD52F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD530); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD531); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD532); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD533); NT35510_Write_Data(0x006D);
//Gamma (B-)
NT35510_Write_Cmd(0xD600); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD601); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD602); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD603); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD604); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD605); NT35510_Write_Data(0x003A);
NT35510_Write_Cmd(0xD606); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD607); NT35510_Write_Data(0x004A);
NT35510_Write_Cmd(0xD608); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD609); NT35510_Write_Data(0x005C);
NT35510_Write_Cmd(0xD60A); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD60B); NT35510_Write_Data(0x0081);
NT35510_Write_Cmd(0xD60C); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD60D); NT35510_Write_Data(0x00A6);
NT35510_Write_Cmd(0xD60E); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD60F); NT35510_Write_Data(0x00E5);
NT35510_Write_Cmd(0xD610); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD611); NT35510_Write_Data(0x0013);
NT35510_Write_Cmd(0xD612); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD613); NT35510_Write_Data(0x0054);
NT35510_Write_Cmd(0xD614); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD615); NT35510_Write_Data(0x0082);
NT35510_Write_Cmd(0xD616); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD617); NT35510_Write_Data(0x00CA);
NT35510_Write_Cmd(0xD618); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD619); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xD61A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD61B); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xD61C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD61D); NT35510_Write_Data(0x0034);
NT35510_Write_Cmd(0xD61E); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD61F); NT35510_Write_Data(0x0067);
NT35510_Write_Cmd(0xD620); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD621); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xD622); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD623); NT35510_Write_Data(0x00A4);
NT35510_Write_Cmd(0xD624); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD625); NT35510_Write_Data(0x00B7);
NT35510_Write_Cmd(0xD626); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD627); NT35510_Write_Data(0x00CF);
NT35510_Write_Cmd(0xD628); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD629); NT35510_Write_Data(0x00DE);
NT35510_Write_Cmd(0xD62A); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD62B); NT35510_Write_Data(0x00F2);
NT35510_Write_Cmd(0xD62C); NT35510_Write_Data(0x0002);
NT35510_Write_Cmd(0xD62D); NT35510_Write_Data(0x00FE);
NT35510_Write_Cmd(0xD62E); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD62F); NT35510_Write_Data(0x0010);
NT35510_Write_Cmd(0xD630); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD631); NT35510_Write_Data(0x0033);
NT35510_Write_Cmd(0xD632); NT35510_Write_Data(0x0003);
NT35510_Write_Cmd(0xD633); NT35510_Write_Data(0x006D);
//PAGE0
NT35510_Write_Cmd(0xF000); NT35510_Write_Data(0x0055);
NT35510_Write_Cmd(0xF001); NT35510_Write_Data(0x00AA);
NT35510_Write_Cmd(0xF002); NT35510_Write_Data(0x0052);
NT35510_Write_Cmd(0xF003); NT35510_Write_Data(0x0008);
NT35510_Write_Cmd(0xF004); NT35510_Write_Data(0x0000);
//480x800
NT35510_Write_Cmd(0xB500); NT35510_Write_Data(0x0050);
//NT35510_Write_Cmd(0x2C00); NT35510_Write_Data(0x0006); //8BIT 6-6-6?
//Dispay control
NT35510_Write_Cmd(0xB100); NT35510_Write_Data(0x00CC);
NT35510_Write_Cmd(0xB101); NT35510_Write_Data(0x0000); // S1->S1440:00;S1440->S1:02
//Source hold time (Nova non-used)
NT35510_Write_Cmd(0xB600); NT35510_Write_Data(0x0005);
//Gate EQ control (Nova non-used)
NT35510_Write_Cmd(0xB700); NT35510_Write_Data(0x0077); //HSD:70;Nova:77
NT35510_Write_Cmd(0xB701); NT35510_Write_Data(0x0077); //HSD:70;Nova:77
//Source EQ control (Nova non-used)
NT35510_Write_Cmd(0xB800); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xB801); NT35510_Write_Data(0x0003); //HSD:05;Nova:07
NT35510_Write_Cmd(0xB802); NT35510_Write_Data(0x0003); //HSD:05;Nova:07
NT35510_Write_Cmd(0xB803); NT35510_Write_Data(0x0003); //HSD:05;Nova:07
//Inversion mode: column
NT35510_Write_Cmd(0xBC00); NT35510_Write_Data(0x0002); //00: column
NT35510_Write_Cmd(0xBC01); NT35510_Write_Data(0x0000); //01:1dot
NT35510_Write_Cmd(0xBC02); NT35510_Write_Data(0x0000);
//Frame rate (Nova non-used)
NT35510_Write_Cmd(0xBD00); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xBD01); NT35510_Write_Data(0x0084);
NT35510_Write_Cmd(0xBD02); NT35510_Write_Data(0x001c); //HSD:06;Nova:1C
NT35510_Write_Cmd(0xBD03); NT35510_Write_Data(0x001c); //HSD:04;Nova:1C
NT35510_Write_Cmd(0xBD04); NT35510_Write_Data(0x0000);
//LGD timing control(4H/4-delay_ms)
NT35510_Write_Cmd(0xC900); NT35510_Write_Data(0x00D0); //3H:0x50;4H:0xD0 //D
NT35510_Write_Cmd(0xC901); NT35510_Write_Data(0x0002); //HSD:05;Nova:02
NT35510_Write_Cmd(0xC902); NT35510_Write_Data(0x0050); //HSD:05;Nova:50
NT35510_Write_Cmd(0xC903); NT35510_Write_Data(0x0050); //HSD:05;Nova:50 ;STV delay_ms time
NT35510_Write_Cmd(0xC904); NT35510_Write_Data(0x0050); //HSD:05;Nova:50 ;CLK delay_ms time
NT35510_Write_Cmd(0x3600); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0x3500); NT35510_Write_Data(0x0000);
NT35510_Write_Cmd(0xFF00); NT35510_Write_Data(0x00AA);
NT35510_Write_Cmd(0xFF01); NT35510_Write_Data(0x0055);
NT35510_Write_Cmd(0xFF02); NT35510_Write_Data(0x0025);
NT35510_Write_Cmd(0xFF03); NT35510_Write_Data(0x0001);
NT35510_Write_Cmd(0xFC00); NT35510_Write_Data(0x0016);
NT35510_Write_Cmd(0xFC01); NT35510_Write_Data(0x00A2);
NT35510_Write_Cmd(0xFC02); NT35510_Write_Data(0x0026);
NT35510_Write_Cmd(0x3A00); NT35510_Write_Data(0x0006);
NT35510_Write_Cmd(0x3A00); NT35510_Write_Data(0x0055);
//Sleep out
NT35510_Write_Cmd(0x1100); //?
Delay(0xFFFFFF);
//Display on
NT35510_Write_Cmd(0x2900);
}
/**
@brief LCD背光控制
@param State 背光状态
@arg ENABLE 使用背光
@arg DISABLE 不使用背光
@retaval 无
*/
void LCD_Back_Light_Control(uint8_t State)
{
if(State == DISABLE)
GPIO_ResetBits(GPIOB,GPIO_Pin_15);
if(State == ENABLE)
GPIO_SetBits(GPIOB,GPIO_Pin_15);
}
/**
* @brief 设置NT35510的GRAM的扫描方向
* @param ucOption :选择GRAM的扫描方向
* @arg 0-7 :参数可选值为0-7这八个方向
* 其中0模式的X方向像素为480,Y方向像素为800
* 其中5模式下X方向像素为854,Y方向像素为480
* 其中 0 模式为常用竖屏模式;模式5为常用横屏模式
* @retval 无
* @note 坐标图例:A表示向上,V表示向下,<表示向左,>表示向右
X表示X轴,Y表示Y轴
------------------------------------------------------------
竖屏模式6: .横屏模式7: .竖屏模式4: 横屏模式5:
A . A . A . A
| . | . | . |
Y . X . Y . X
0 . 1 . 2 . 3
<--- X0 o . <----Y1 o . o 2X---> . o 3Y--->
------------------------------------------------------------
竖屏模式2: 横屏模式3: 竖屏模式0: . 横屏模式1:
<--- X4 o . <--- Y5 o . o 6X---> . o 7Y--->
4 . 5 . 6 . 7
Y . X . Y . X
| . | . | . |
V . V . V . V
---------------------------------------------------------
LCD屏示例
|-----------------|
| 正点原子Logo |
| |
| |
| |
| |
| |
| |
| |
| |
|-----------------|
屏幕正面(宽480,高800)
*******************************************************/
void NT35510_GramScan ( uint8_t ucOption )
{
//根据液晶扫描方向而变化的XY像素宽度
//调用NT35510_GramScan函数设置方向时会自动更改
__IO uint16_t LCD_X_LENGTH;
__IO uint16_t LCD_Y_LENGTH;
//液晶屏扫描模式
//参数可选值为0-7
__IO uint8_t LCD_SCAN_MODE;
//参数检查,只可输入0-7
if(ucOption >7 )
return;
//根据模式更新LCD_SCAN_MODE的值,主要用于触摸屏选择计算参数
LCD_SCAN_MODE = ucOption;
//根据模式更新XY方向的像素宽度
if(ucOption%2 == 0)
{
//0 2 4 6模式下X方向像素宽度为480,Y方向为800
LCD_X_LENGTH = 480;
LCD_Y_LENGTH = 800;
}
else
{
//1 3 5 7模式下X方向像素宽度为800,Y方向为480
LCD_X_LENGTH = 800;
LCD_Y_LENGTH = 480;
}
//0x36命令参数的高3位可用于设置GRAM扫描方向
NT35510_Write_Cmd ( 0x3600 );
NT35510_Write_Data (0x00 | (ucOption<<5));//根据ucOption的值设置LCD参数,共0-7种模式
NT35510_Write_Cmd ( 0x2A00 );
NT35510_Write_Data ( 0x00 ); /* x 起始坐标高8位 */
NT35510_Write_Cmd ( 0x2A00 + 1 );
NT35510_Write_Data ( 0x00 ); /* x 起始坐标低8位 */
NT35510_Write_Cmd ( 0x2A00 + 2 );
NT35510_Write_Data ( ((LCD_X_LENGTH-1)>>8)&0xFF ); /* x 结束坐标高8位 */
NT35510_Write_Cmd ( 0x2A00 + 3 );
NT35510_Write_Data ( (LCD_X_LENGTH-1)&0xFF ); /* x 结束坐标低8位 */
NT35510_Write_Cmd ( 0x2B00 );
NT35510_Write_Data ( 0x00 ); /* y 起始坐标高8位 */
NT35510_Write_Cmd ( 0x2B00 + 1 );
NT35510_Write_Data ( 0x00 ); /* y 起始坐标低8位 */
NT35510_Write_Cmd ( 0x2B00 + 2 );
NT35510_Write_Data ( ((LCD_Y_LENGTH-1)>>8)&0xFF ); /* y 结束坐标高8位 */
NT35510_Write_Cmd ( 0x2B00 + 3 );
NT35510_Write_Data ( (LCD_Y_LENGTH-1)&0xFF ); /* y 结束坐标低8位 */
/* write gram start */
NT35510_Write_Cmd ( 0x2C00 );
}
/**
* @brief 在NT35510显示器上开辟一个窗口
* @param X :在特定扫描方向下窗口的起点X坐标
* @param Y :在特定扫描方向下窗口的起点Y坐标
* @param Width :窗口的宽度
* @param Height :窗口的高度
* @retval 无
*/
void NT35510_OpenWindow ( uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height )
{
NT35510_Write_Cmd ( 0x2A00 ); /* 设置X坐标 */
NT35510_Write_Data ( X >> 8 ); /* 高8位 */
NT35510_Write_Cmd ( 0x2A00 + 1 );
NT35510_Write_Data ( X & 0xff ); /* 然后低8位 */
NT35510_Write_Cmd ( 0x2A00 + 2 );
NT35510_Write_Data ( ( X + Width - 1 ) >> 8 );/* 设置起始点*/
NT35510_Write_Cmd ( 0x2A00 + 3 );
NT35510_Write_Data ( ( X + Width - 1 ) & 0xff );/* 设置结束点*/
NT35510_Write_Cmd ( 0x2B00 ); /* 设置Y坐标*/
NT35510_Write_Data ( Y >> 8 );
NT35510_Write_Cmd ( 0x2B00 + 1);
NT35510_Write_Data ( Y & 0xff );
NT35510_Write_Cmd ( 0x2B00 + 2);
NT35510_Write_Data ( ( Y + Height - 1 ) >> 8 );
NT35510_Write_Cmd ( 0x2B00 + 3);
NT35510_Write_Data ( ( Y + Height - 1) & 0xff );
}
/**
@brief 在LCD上绘制矩形
@param color填充的颜色
@retaval 无
*/
void LCD_Draw_Rectangle(uint16_t x0,uint16_t y0,uint16_t wideth, uint16_t height,uint16_t color)
{
NT35510_OpenWindow(x0,y0,wideth,height);
uint32_t i=0;
NT35510_Write_Cmd(0x2C00);//写入像素命令
for (i=0;i<(wideth-x0+1)*(height-y0+1);i++)
{
NT35510_Write_Data(color);
}
}
/**
@brief 清屏函数
@param color填充的颜色
@retaval 无
*/
void Clear_Screen(uint16_t color)
{
LCD_Draw_Rectangle(0,0,480,800,color);
}
/**
@brief LCD初始化函数
@param 无
@retaval 无
*/
void LCD_Init()
{
FSMC_LCD_Init();
LCD_Write_In();
LCD_Back_Light_Control(ENABLE);
NT35510_GramScan(0);//使用模式0,竖屏模式
Clear_Screen(BLACK);//以黑色清屏
}
主函数文件:
#include "stm32f4xx.h"
#include "led.h"
#include "button.h"
#include "exti.h"
#include "beep.h"
#include "systick.h"
#include "usart.h"
#include "sram.h"
#include "lcd_nt35510.h"
int main (void)
{
/**
@brief 初始化函数部分
@param 无
@retaval 无
*/
//LED_Init();
//SysTick_Init();
//Button_Init();
//Exti_Init();
Usart_Init();
//FSMC_SRAM_Init();
LCD_Init();
/**
@brief 具体的函数功能部分
@param 无
@retaval 无
*/
printf("\r\n0x%x",LCD_Write_data);
printf("\r\n0x%x",LCD_Write_cmd);
printf("\r\n0x%x",Get_LCD_ID());
LCD_Draw_Rectangle(160,0,160,800,RED);
while(1)
{
}
}
我来回答
LCD_Draw_Rectangle(160,0,200,800,RED);
LCD_Draw_Rectangle(160,0,300,800,RED);
LCD_Draw_Rectangle(0,0,480,480,RED);
LCD_Draw_Rectangle(160,0,160,800,RED);
LCD_Draw_Rectangle(160,0,158,800,RED);