使用历程中得完整代码的时候,液晶屏能够正常显示,但是使用自己裁剪后的代码的时候,如果是但不调试的话能够正常填充满屏幕,连续运行的话只能填充一小部分屏幕。贴上来的是裁剪过的函数,初始化代码如下:
[mw_shl_code=c,true]void nt35510_Init(void)
{
//首先初始化FSMC,使用NOR FLASH/SRAM第四区
GPIO_InitTypeDef GPIO_InitStructure;
FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
FSMC_NORSRAMTimingInitTypeDef readWriteTiming;
FSMC_NORSRAMTimingInitTypeDef writeTiming;
//第一步开启FSMC的时钟,以及B,D,E,F,G脚的时钟
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOD|
RCC_AHB1Periph_GPIOE|RCC_AHB1Periph_GPIOF|RCC_AHB1Periph_GPIOG,ENABLE);
RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC,ENABLE);
//第二步,初始化引脚,复用引脚
//第一个脚是背光控制脚,推挽输出
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB,&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;
//PD0,1,4,5,8,9,10,14,15 AF OUT
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
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;
//PE7~15,AF OUT
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOE, &GPIO_InitStructure);//初始化
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;//PF12,FSMC_A6
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;//复用输出
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
GPIO_Init(GPIOF,&GPIO_InitStructure);//初始化
//第三步,把引脚连接到具体的模块上
GPIO_PinAFConfig(GPIOD,GPIO_PinSource0,GPIO_AF_FSMC);//PD0,AF12
GPIO_PinAFConfig(GPIOD,GPIO_PinSource1,GPIO_AF_FSMC);//PD1,AF12
GPIO_PinAFConfig(GPIOD,GPIO_PinSource4,GPIO_AF_FSMC);
GPIO_PinAFConfig(GPIOD,GPIO_PinSource5,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);//PD15,AF12
GPIO_PinAFConfig(GPIOE,GPIO_PinSource7,GPIO_AF_FSMC);//PE7,AF12
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);//PE15,AF12
GPIO_PinAFConfig(GPIOF,GPIO_PinSource12,GPIO_AF_FSMC);//PF12,AF12
GPIO_PinAFConfig(GPIOG,GPIO_PinSource12,GPIO_AF_FSMC);
/*第四步,初始化FSMC功能。
使用BANK1,SECTER4,模式A。
写地址建立时间(ADDSET)为3个HCLK =18ns
写数据保存时间(DATAST)为6ns*3个HCLK=18ns*/
//四。1读时序设置
readWriteTiming.FSMC_AddressHoldTime = 0x00; //读地址保持时间,模式A没有用到
readWriteTiming.FSMC_AddressSetupTime = 16; //读地址建立时间为96NS;
readWriteTiming.FSMC_DataSetupTime = 60; //读数据保存时间依然是360NS
readWriteTiming.FSMC_BusTurnAroundDuration = 0; //这些位用于定义一次读操作之后在总线上的延迟
//(仅适用于总线复用模式的NOR闪存操作),
//一次读操作之后控制器需要在数据总线上为下次操作送出地址,
//这个延迟就是为了防止总线冲突。
//如果扩展的存储器系统不包含总线复用模式的存储器,
//或最慢的存储器可以在6个HCLK时钟周期内将数据总线恢复到高阻状态,
//可以设置这个参数为其最小值。
readWriteTiming.FSMC_CLKDivision = 0x00; //定义CLK时钟输出信号的周期,以HCLK周期数表示。
readWriteTiming.FSMC_DataLatency = 0x00; //处于同步成组模式的NOR闪存,
//需要定义在读取第一个数据之前等待的存储器周期数目。
//这个时间参数不是以HCLK表示,而是以闪存时钟(CLK)表示。
//在访问异步NOR闪存、SRAM或ROM时,这个参数不起作用。
//操作CRAM时,这个参数必须为0。
readWriteTiming.FSMC_AccessMode = FSMC_AccessMode_A; //模式A
//四。2 写功能时序
writeTiming.FSMC_AddressHoldTime = 0x00; //地址保持时间(ADHLD)模式A未用到
writeTiming.FSMC_AddressSetupTime = 9; //写地址建立时间(ADDSET)为3个HCLK =18ns
writeTiming.FSMC_DataSetupTime = 8; //写数据保存时间为6ns*3个HCLK=18ns
writeTiming.FSMC_BusTurnAroundDuration = 0x00;
writeTiming.FSMC_CLKDivision = 0x00;
writeTiming.FSMC_DataLatency = 0x00;
writeTiming.FSMC_AccessMode = FSMC_AccessMode_A; //模式A
//四。3 FSMC的设置
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4; //nor被分为四块,
//其中这个参数是说明对那个块编程
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; //地址数据是否复用,不复用
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; //存储器类型,sram
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; //数据总线宽度,16位
FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; //是否进行成组模式访问,否
FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;//等待信号有效级性,
FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; //该位决定控制器是否支持把非对齐的AHB成组操作分割成2次线性操作;
//该位仅在存储器的成组模式下有效。
FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive
= FSMC_WaitSignalActive_BeforeWaitState; //当闪存存储器处于成组传输模式时,
//NWAIT信号指示从闪存存储器出来的数据是否有效或是否需要插入等待周期。
//该位决定存储器是在等待状态之前的一个时钟周期产生NWAIT信号,
//还是在等待状态期间产生NWAIT信号。
FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; //该位指示FSMC是否允许/禁止对存储器的写操作。
FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; //当闪存存储器处于成组传输模式时,
//这一位允许/禁止通过NWAIT信号插入等待状态。
FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Enable; //该位允许FSMC使用FSMC_BWTR寄存器,
//即允许读和写使用不同的时序。
FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; //对于处于成组传输模式的闪存存储器,
//这一位允许/禁止通过NWAIT信号插入等待状态。
//读操作的同步成组传输协议使能位是FSMC_BCRx寄存器的BURSTEN位。
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &readWriteTiming; //读时序配置指针
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &writeTiming; //写时序配置指针
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); //初始化FSMC配置
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE); // 使能BANK1
//获得NT3550的一些信息
delay_ms(50);
// LCD_WriteReg(0x0000,0x0001);
// delay_ms(50);
// _nt35510.id = LCD_ReadReg(0x0000);
LCD_WR_REG(RDID1);
_nt35510.id = LCD_RD_DATA();
LCD_WR_REG(RDID2);
_nt35510.id = LCD_RD_DATA();
_nt35510.id <<= 8;
LCD_WR_REG(RDID3);
_nt35510.id |= LCD_RD_DATA();
delay_ms(50);
LCD_WriteReg(0xF000,0x55);
LCD_WriteReg(0xF001,0xAA);
LCD_WriteReg(0xF002,0x52);
LCD_WriteReg(0xF003,0x08);
LCD_WriteReg(0xF004,0x01);
//AVDD Set AVDD 5.2V
LCD_WriteReg(0xB000,0x0D);
LCD_WriteReg(0xB001,0x0D);
LCD_WriteReg(0xB002,0x0D);
//AVDD ratio
LCD_WriteReg(0xB600,0x34);
LCD_WriteReg(0xB601,0x34);
LCD_WriteReg(0xB602,0x34);
//AVEE -5.2V
LCD_WriteReg(0xB100,0x0D);
LCD_WriteReg(0xB101,0x0D);
LCD_WriteReg(0xB102,0x0D);
//AVEE ratio
LCD_WriteReg(0xB700,0x34);
LCD_WriteReg(0xB701,0x34);
LCD_WriteReg(0xB702,0x34);
//VCL -2.5V
LCD_WriteReg(0xB200,0x00);
LCD_WriteReg(0xB201,0x00);
LCD_WriteReg(0xB202,0x00);
//VCL ratio
LCD_WriteReg(0xB800,0x24);
LCD_WriteReg(0xB801,0x24);
LCD_WriteReg(0xB802,0x24);
//VGH 15V (Free pump)
LCD_WriteReg(0xBF00,0x01);
LCD_WriteReg(0xB300,0x0F);
LCD_WriteReg(0xB301,0x0F);
LCD_WriteReg(0xB302,0x0F);
//VGH ratio
LCD_WriteReg(0xB900,0x34);
LCD_WriteReg(0xB901,0x34);
LCD_WriteReg(0xB902,0x34);
//VGL_REG -10V
LCD_WriteReg(0xB500,0x08);
LCD_WriteReg(0xB501,0x08);
LCD_WriteReg(0xB502,0x08);
LCD_WriteReg(0xC200,0x03);
//VGLX ratio
LCD_WriteReg(0xBA00,0x24);
LCD_WriteReg(0xBA01,0x24);
LCD_WriteReg(0xBA02,0x24);
//VGMP/VGSP 4.5V/0V
LCD_WriteReg(0xBC00,0x00);
LCD_WriteReg(0xBC01,0x78);
LCD_WriteReg(0xBC02,0x00);
//VGMN/VGSN -4.5V/0V
LCD_WriteReg(0xBD00,0x00);
LCD_WriteReg(0xBD01,0x78);
LCD_WriteReg(0xBD02,0x00);
//VCOM
LCD_WriteReg(0xBE00,0x00);
LCD_WriteReg(0xBE01,0x64);
//Gamma Setting
LCD_WriteReg(0xD100,0x00);
LCD_WriteReg(0xD101,0x33);
LCD_WriteReg(0xD102,0x00);
LCD_WriteReg(0xD103,0x34);
LCD_WriteReg(0xD104,0x00);
LCD_WriteReg(0xD105,0x3A);
LCD_WriteReg(0xD106,0x00);
LCD_WriteReg(0xD107,0x4A);
LCD_WriteReg(0xD108,0x00);
LCD_WriteReg(0xD109,0x5C);
LCD_WriteReg(0xD10A,0x00);
LCD_WriteReg(0xD10B,0x81);
LCD_WriteReg(0xD10C,0x00);
LCD_WriteReg(0xD10D,0xA6);
LCD_WriteReg(0xD10E,0x00);
LCD_WriteReg(0xD10F,0xE5);
LCD_WriteReg(0xD110,0x01);
LCD_WriteReg(0xD111,0x13);
LCD_WriteReg(0xD112,0x01);
LCD_WriteReg(0xD113,0x54);
LCD_WriteReg(0xD114,0x01);
LCD_WriteReg(0xD115,0x82);
LCD_WriteReg(0xD116,0x01);
LCD_WriteReg(0xD117,0xCA);
LCD_WriteReg(0xD118,0x02);
LCD_WriteReg(0xD119,0x00);
LCD_WriteReg(0xD11A,0x02);
LCD_WriteReg(0xD11B,0x01);
LCD_WriteReg(0xD11C,0x02);
LCD_WriteReg(0xD11D,0x34);
LCD_WriteReg(0xD11E,0x02);
LCD_WriteReg(0xD11F,0x67);
LCD_WriteReg(0xD120,0x02);
LCD_WriteReg(0xD121,0x84);
LCD_WriteReg(0xD122,0x02);
LCD_WriteReg(0xD123,0xA4);
LCD_WriteReg(0xD124,0x02);
LCD_WriteReg(0xD125,0xB7);
LCD_WriteReg(0xD126,0x02);
LCD_WriteReg(0xD127,0xCF);
LCD_WriteReg(0xD128,0x02);
LCD_WriteReg(0xD129,0xDE);
LCD_WriteReg(0xD12A,0x02);
LCD_WriteReg(0xD12B,0xF2);
LCD_WriteReg(0xD12C,0x02);
LCD_WriteReg(0xD12D,0xFE);
LCD_WriteReg(0xD12E,0x03);
LCD_WriteReg(0xD12F,0x10);
LCD_WriteReg(0xD130,0x03);
LCD_WriteReg(0xD131,0x33);
LCD_WriteReg(0xD132,0x03);
LCD_WriteReg(0xD133,0x6D);
LCD_WriteReg(0xD200,0x00);
LCD_WriteReg(0xD201,0x33);
LCD_WriteReg(0xD202,0x00);
LCD_WriteReg(0xD203,0x34);
LCD_WriteReg(0xD204,0x00);
LCD_WriteReg(0xD205,0x3A);
LCD_WriteReg(0xD206,0x00);
LCD_WriteReg(0xD207,0x4A);
LCD_WriteReg(0xD208,0x00);
LCD_WriteReg(0xD209,0x5C);
LCD_WriteReg(0xD20A,0x00);
LCD_WriteReg(0xD20B,0x81);
LCD_WriteReg(0xD20C,0x00);
LCD_WriteReg(0xD20D,0xA6);
LCD_WriteReg(0xD20E,0x00);
LCD_WriteReg(0xD20F,0xE5);
LCD_WriteReg(0xD210,0x01);
LCD_WriteReg(0xD211,0x13);
LCD_WriteReg(0xD212,0x01);
LCD_WriteReg(0xD213,0x54);
LCD_WriteReg(0xD214,0x01);
LCD_WriteReg(0xD215,0x82);
LCD_WriteReg(0xD216,0x01);
LCD_WriteReg(0xD217,0xCA);
LCD_WriteReg(0xD218,0x02);
LCD_WriteReg(0xD219,0x00);
LCD_WriteReg(0xD21A,0x02);
LCD_WriteReg(0xD21B,0x01);
LCD_WriteReg(0xD21C,0x02);
LCD_WriteReg(0xD21D,0x34);
LCD_WriteReg(0xD21E,0x02);
LCD_WriteReg(0xD21F,0x67);
LCD_WriteReg(0xD220,0x02);
LCD_WriteReg(0xD221,0x84);
LCD_WriteReg(0xD222,0x02);
LCD_WriteReg(0xD223,0xA4);
LCD_WriteReg(0xD224,0x02);
LCD_WriteReg(0xD225,0xB7);
LCD_WriteReg(0xD226,0x02);
LCD_WriteReg(0xD227,0xCF);
LCD_WriteReg(0xD228,0x02);
LCD_WriteReg(0xD229,0xDE);
LCD_WriteReg(0xD22A,0x02);
LCD_WriteReg(0xD22B,0xF2);
LCD_WriteReg(0xD22C,0x02);
LCD_WriteReg(0xD22D,0xFE);
LCD_WriteReg(0xD22E,0x03);
LCD_WriteReg(0xD22F,0x10);
LCD_WriteReg(0xD230,0x03);
LCD_WriteReg(0xD231,0x33);
LCD_WriteReg(0xD232,0x03);
LCD_WriteReg(0xD233,0x6D);
LCD_WriteReg(0xD300,0x00);
LCD_WriteReg(0xD301,0x33);
LCD_WriteReg(0xD302,0x00);
LCD_WriteReg(0xD303,0x34);
LCD_WriteReg(0xD304,0x00);
LCD_WriteReg(0xD305,0x3A);
LCD_WriteReg(0xD306,0x00);
LCD_WriteReg(0xD307,0x4A);
LCD_WriteReg(0xD308,0x00);
LCD_WriteReg(0xD309,0x5C);
LCD_WriteReg(0xD30A,0x00);
LCD_WriteReg(0xD30B,0x81);
LCD_WriteReg(0xD30C,0x00);
LCD_WriteReg(0xD30D,0xA6);
LCD_WriteReg(0xD30E,0x00);
LCD_WriteReg(0xD30F,0xE5);
LCD_WriteReg(0xD310,0x01);
LCD_WriteReg(0xD311,0x13);
LCD_WriteReg(0xD312,0x01);
LCD_WriteReg(0xD313,0x54);
LCD_WriteReg(0xD314,0x01);
LCD_WriteReg(0xD315,0x82);
LCD_WriteReg(0xD316,0x01);
LCD_WriteReg(0xD317,0xCA);
LCD_WriteReg(0xD318,0x02);
LCD_WriteReg(0xD319,0x00);
LCD_WriteReg(0xD31A,0x02);
LCD_WriteReg(0xD31B,0x01);
LCD_WriteReg(0xD31C,0x02);
LCD_WriteReg(0xD31D,0x34);
LCD_WriteReg(0xD31E,0x02);
LCD_WriteReg(0xD31F,0x67);
LCD_WriteReg(0xD320,0x02);
LCD_WriteReg(0xD321,0x84);
LCD_WriteReg(0xD322,0x02);
LCD_WriteReg(0xD323,0xA4);
LCD_WriteReg(0xD324,0x02);
LCD_WriteReg(0xD325,0xB7);
LCD_WriteReg(0xD326,0x02);
LCD_WriteReg(0xD327,0xCF);
LCD_WriteReg(0xD328,0x02);
LCD_WriteReg(0xD329,0xDE);
LCD_WriteReg(0xD32A,0x02);
LCD_WriteReg(0xD32B,0xF2);
LCD_WriteReg(0xD32C,0x02);
LCD_WriteReg(0xD32D,0xFE);
LCD_WriteReg(0xD32E,0x03);
LCD_WriteReg(0xD32F,0x10);
LCD_WriteReg(0xD330,0x03);
LCD_WriteReg(0xD331,0x33);
LCD_WriteReg(0xD332,0x03);
LCD_WriteReg(0xD333,0x6D);
LCD_WriteReg(0xD400,0x00);
LCD_WriteReg(0xD401,0x33);
LCD_WriteReg(0xD402,0x00);
LCD_WriteReg(0xD403,0x34);
LCD_WriteReg(0xD404,0x00);
LCD_WriteReg(0xD405,0x3A);
LCD_WriteReg(0xD406,0x00);
LCD_WriteReg(0xD407,0x4A);
LCD_WriteReg(0xD408,0x00);
LCD_WriteReg(0xD409,0x5C);
LCD_WriteReg(0xD40A,0x00);
LCD_WriteReg(0xD40B,0x81);
LCD_WriteReg(0xD40C,0x00);
LCD_WriteReg(0xD40D,0xA6);
LCD_WriteReg(0xD40E,0x00);
LCD_WriteReg(0xD40F,0xE5);
LCD_WriteReg(0xD410,0x01);
LCD_WriteReg(0xD411,0x13);
LCD_WriteReg(0xD412,0x01);
LCD_WriteReg(0xD413,0x54);
LCD_WriteReg(0xD414,0x01);
LCD_WriteReg(0xD415,0x82);
LCD_WriteReg(0xD416,0x01);
LCD_WriteReg(0xD417,0xCA);
LCD_WriteReg(0xD418,0x02);
LCD_WriteReg(0xD419,0x00);
LCD_WriteReg(0xD41A,0x02);
LCD_WriteReg(0xD41B,0x01);
LCD_WriteReg(0xD41C,0x02);
LCD_WriteReg(0xD41D,0x34);
LCD_WriteReg(0xD41E,0x02);
LCD_WriteReg(0xD41F,0x67);
LCD_WriteReg(0xD420,0x02);
LCD_WriteReg(0xD421,0x84);
LCD_WriteReg(0xD422,0x02);
LCD_WriteReg(0xD423,0xA4);
LCD_WriteReg(0xD424,0x02);
LCD_WriteReg(0xD425,0xB7);
LCD_WriteReg(0xD426,0x02);
LCD_WriteReg(0xD427,0xCF);
LCD_WriteReg(0xD428,0x02);
LCD_WriteReg(0xD429,0xDE);
LCD_WriteReg(0xD42A,0x02);
LCD_WriteReg(0xD42B,0xF2);
LCD_WriteReg(0xD42C,0x02);
LCD_WriteReg(0xD42D,0xFE);
LCD_WriteReg(0xD42E,0x03);
LCD_WriteReg(0xD42F,0x10);
LCD_WriteReg(0xD430,0x03);
LCD_WriteReg(0xD431,0x33);
LCD_WriteReg(0xD432,0x03);
LCD_WriteReg(0xD433,0x6D);
LCD_WriteReg(0xD500,0x00);
LCD_WriteReg(0xD501,0x33);
LCD_WriteReg(0xD502,0x00);
LCD_WriteReg(0xD503,0x34);
LCD_WriteReg(0xD504,0x00);
LCD_WriteReg(0xD505,0x3A);
LCD_WriteReg(0xD506,0x00);
LCD_WriteReg(0xD507,0x4A);
LCD_WriteReg(0xD508,0x00);
LCD_WriteReg(0xD509,0x5C);
LCD_WriteReg(0xD50A,0x00);
LCD_WriteReg(0xD50B,0x81);
LCD_WriteReg(0xD50C,0x00);
LCD_WriteReg(0xD50D,0xA6);
LCD_WriteReg(0xD50E,0x00);
LCD_WriteReg(0xD50F,0xE5);
LCD_WriteReg(0xD510,0x01);
LCD_WriteReg(0xD511,0x13);
LCD_WriteReg(0xD512,0x01);
LCD_WriteReg(0xD513,0x54);
LCD_WriteReg(0xD514,0x01);
LCD_WriteReg(0xD515,0x82);
LCD_WriteReg(0xD516,0x01);
LCD_WriteReg(0xD517,0xCA);
LCD_WriteReg(0xD518,0x02);
LCD_WriteReg(0xD519,0x00);
LCD_WriteReg(0xD51A,0x02);
LCD_WriteReg(0xD51B,0x01);
LCD_WriteReg(0xD51C,0x02);
LCD_WriteReg(0xD51D,0x34);
LCD_WriteReg(0xD51E,0x02);
LCD_WriteReg(0xD51F,0x67);
LCD_WriteReg(0xD520,0x02);
LCD_WriteReg(0xD521,0x84);
LCD_WriteReg(0xD522,0x02);
LCD_WriteReg(0xD523,0xA4);
LCD_WriteReg(0xD524,0x02);
LCD_WriteReg(0xD525,0xB7);
LCD_WriteReg(0xD526,0x02);
LCD_WriteReg(0xD527,0xCF);
LCD_WriteReg(0xD528,0x02);
LCD_WriteReg(0xD529,0xDE);
LCD_WriteReg(0xD52A,0x02);
LCD_WriteReg(0xD52B,0xF2);
LCD_WriteReg(0xD52C,0x02);
LCD_WriteReg(0xD52D,0xFE);
LCD_WriteReg(0xD52E,0x03);
LCD_WriteReg(0xD52F,0x10);
LCD_WriteReg(0xD530,0x03);
LCD_WriteReg(0xD531,0x33);
LCD_WriteReg(0xD532,0x03);
LCD_WriteReg(0xD533,0x6D);
LCD_WriteReg(0xD600,0x00);
LCD_WriteReg(0xD601,0x33);
LCD_WriteReg(0xD602,0x00);
LCD_WriteReg(0xD603,0x34);
LCD_WriteReg(0xD604,0x00);
LCD_WriteReg(0xD605,0x3A);
LCD_WriteReg(0xD606,0x00);
LCD_WriteReg(0xD607,0x4A);
LCD_WriteReg(0xD608,0x00);
LCD_WriteReg(0xD609,0x5C);
LCD_WriteReg(0xD60A,0x00);
LCD_WriteReg(0xD60B,0x81);
LCD_WriteReg(0xD60C,0x00);
LCD_WriteReg(0xD60D,0xA6);
LCD_WriteReg(0xD60E,0x00);
LCD_WriteReg(0xD60F,0xE5);
LCD_WriteReg(0xD610,0x01);
LCD_WriteReg(0xD611,0x13);
LCD_WriteReg(0xD612,0x01);
LCD_WriteReg(0xD613,0x54);
LCD_WriteReg(0xD614,0x01);
LCD_WriteReg(0xD615,0x82);
LCD_WriteReg(0xD616,0x01);
LCD_WriteReg(0xD617,0xCA);
LCD_WriteReg(0xD618,0x02);
LCD_WriteReg(0xD619,0x00);
LCD_WriteReg(0xD61A,0x02);
LCD_WriteReg(0xD61B,0x01);
LCD_WriteReg(0xD61C,0x02);
LCD_WriteReg(0xD61D,0x34);
LCD_WriteReg(0xD61E,0x02);
LCD_WriteReg(0xD61F,0x67);
LCD_WriteReg(0xD620,0x02);
LCD_WriteReg(0xD621,0x84);
LCD_WriteReg(0xD622,0x02);
LCD_WriteReg(0xD623,0xA4);
LCD_WriteReg(0xD624,0x02);
LCD_WriteReg(0xD625,0xB7);
LCD_WriteReg(0xD626,0x02);
LCD_WriteReg(0xD627,0xCF);
LCD_WriteReg(0xD628,0x02);
LCD_WriteReg(0xD629,0xDE);
LCD_WriteReg(0xD62A,0x02);
LCD_WriteReg(0xD62B,0xF2);
LCD_WriteReg(0xD62C,0x02);
LCD_WriteReg(0xD62D,0xFE);
LCD_WriteReg(0xD62E,0x03);
LCD_WriteReg(0xD62F,0x10);
LCD_WriteReg(0xD630,0x03);
LCD_WriteReg(0xD631,0x33);
LCD_WriteReg(0xD632,0x03);
LCD_WriteReg(0xD633,0x6D);
//LV2 Page 0 enable
LCD_WriteReg(0xF000,0x55);
LCD_WriteReg(0xF001,0xAA);
LCD_WriteReg(0xF002,0x52);
LCD_WriteReg(0xF003,0x08);
LCD_WriteReg(0xF004,0x00);
//Display control
LCD_WriteReg(0xB100, 0xCC);
LCD_WriteReg(0xB101, 0x00);
//Source hold time
LCD_WriteReg(0xB600,0x05);
//Gate EQ control
LCD_WriteReg(0xB700,0x70);
LCD_WriteReg(0xB701,0x70);
//Source EQ control (Mode 2)
LCD_WriteReg(0xB800,0x01);
LCD_WriteReg(0xB801,0x03);
LCD_WriteReg(0xB802,0x03);
LCD_WriteReg(0xB803,0x03);
//Inversion mode (2-dot)
LCD_WriteReg(0xBC00,0x02);
LCD_WriteReg(0xBC01,0x00);
LCD_WriteReg(0xBC02,0x00);
//Timing control 4H w/ 4-delay
LCD_WriteReg(0xC900,0xD0);
LCD_WriteReg(0xC901,0x02);
LCD_WriteReg(0xC902,0x50);
LCD_WriteReg(0xC903,0x50);
LCD_WriteReg(0xC904,0x50);
LCD_WriteReg(0x3500,0x00);
LCD_WriteReg(0x3A00,0x55); //16-bit/pixel
LCD_WR_REG(0x1100);
delay_us(120);
LCD_WR_REG(0x2900);
LCD_Display_Dir(0); //默认为竖屏
LCD_LED = 1; //点亮背光
LCD_Clear(WHITE);
LCD_LED = 1;
}[/mw_shl_code][mw_shl_code=c,true]void LCD_Scan_Dir(u8 dir)
{
u16 regval = 0;
switch(dir)
{
case L2R_U2D://从左到右,从上到下
regval|=(0<<7)|(0<<6)|(0<<5);
break;
case L2R_D2U://从左到右,从下到上
regval|=(1<<7)|(0<<6)|(0<<5);
break;
case R2L_U2D://从右到左,从上到下
regval|=(0<<7)|(1<<6)|(0<<5);
break;
case R2L_D2U://从右到左,从下到上
regval|=(1<<7)|(1<<6)|(0<<5);
break;
case U2D_L2R://从上到下,从左到右
regval|=(0<<7)|(0<<6)|(1<<5);
break;
case U2D_R2L://从上到下,从右到左
regval|=(0<<7)|(1<<6)|(1<<5);
break;
case D2U_L2R://从下到上,从左到右
regval|=(1<<7)|(0<<6)|(1<<5);
break;
case D2U_R2L://从下到上,从右到左
regval|=(1<<7)|(1<<6)|(1<<5);
break;
}
/*-----------------*/
regval |= 0X08;
/*-----------------*/
LCD_WriteReg(MADCTL,regval);
LCD_WR_REG(_nt35510.setxcmd);LCD_WR_DATA(0);
LCD_WR_REG(_nt35510.setxcmd+1);LCD_WR_DATA(0);
LCD_WR_REG(_nt35510.setxcmd+2);LCD_WR_DATA((_nt35510.width-1)>>8);
LCD_WR_REG(_nt35510.setxcmd+3);LCD_WR_DATA((_nt35510.width-1)&0XFF);
LCD_WR_REG(_nt35510.setycmd);LCD_WR_DATA(0);
LCD_WR_REG(_nt35510.setycmd+1);LCD_WR_DATA(0);
LCD_WR_REG(_nt35510.setycmd+2);LCD_WR_DATA((_nt35510.height-1)>>8);
LCD_WR_REG(_nt35510.setycmd+3);LCD_WR_DATA((_nt35510.height-1)&0XFF);
}[/mw_shl_code]
[mw_shl_code=c,true]void LCD_Display_Dir(u8 dir)
{
_nt35510.wramcmd = 0x2c00;
_nt35510.setxcmd = 0x2a00;
_nt35510.setycmd = 0x2b00;
if(dir == 0) //如果是竖屏
{
_nt35510.dir = 0; //竖屏
_nt35510.width = 480;
_nt35510.height = 800;
}
else if(dir == 1)
{
_nt35510.dir = 1; //竖屏
_nt35510.width = 800;
_nt35510.height = 480;
}
LCD_Scan_Dir(DFT_SCAN_DIR);
}[/mw_shl_code]
[mw_shl_code=c,true]void LCD_Clear(u16 color)
{
u16 index1 = 0;
u16 index2 = 0;
// u32 totalpoint = _nt35510.width;
// totalpoint *= _nt35510.height; //得到总点数
LCD_SetCursor(0x00,0x0000);
LCD_WriteRAM_Prepare();
/* for(index = 0; index < totalpoint; index ++)
{
LCD->LCD_RAM = color;
opt_delay(5);
}*/
for(index1 = 0; index1 < _nt35510.height; index1 ++)
{
for(index2 = 0;index2 < _nt35510.width;index2 ++)
{
LCD->LCD_RAM = color;
}
}
}[/mw_shl_code]
一周热门 更多>