ATmega16L驱动ILI9325/9328
时间:11-20
来源:互联网
点击:
- LCD_DATA_PORT=regID>>A_PORT=regID>>8;
- LCD_WR_L;
- LCD_WR_H;
- LCD_DATA_PORT=regID;
- LCD_WR_L;
- LCD_WR_H;
- LCD_RS_H;
- LCD_DATA_PORT=regData>>8;
- LCD_WR_L;
- LCD_WR_H;
- LCD_DATA_PORT=regData;
- LCD_WR_L;
- LCD_WR_H;
- }
- /*********************************************************************************************************
- **Functionname:LCD_ReadReg
- **Descriptions:读取指定寄存器的数据
- **inputparameters:寄存器地址:regID
- **outputparameters:无
- **Returnedvalue:读出数据(16位)
- *********************************************************************************************************/
- ////////////////////////////////////////////////////////////////////////////////////////////////////
- //nCS----\_____________________________________________________________/--------//
- //RS----\____________________________/-----------------------------------------//
- //nRD-----------------------------------\_____/------\_____/------------------//
- //nWR------\______/--------\_____/----------------------------------------------//
- //DB[10:17]---[寄存器高8位]--[寄存器低8位]--[数据高8位]--[数据低8位]---------------//
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- unsignedintLCD_ReadReg(uint32regID)
- {
- uint32regData;
- LCD_WriteCmd(regID);
- LCD_DATA_IN;
- LCD_RS_H;
- LCD_RD_L;
- LCD_RD_H;
- regData=LCD_DATA_PIN;
- regData=regData<8;
- LCD_RD_L;
- LCD_RD_H;
- regData|=LCD_DATA_PIN;
- LCD_WR_L;
- LCD_WR_H;
- LCD_DATA_OUT;
- returnregData;
- }
- /*********************************************************************************************************
- **Functionname:LCD_ILI9325_Init
- **Descriptions:9325/28内部寄存器的初始化
- **inputparameters:无
- **outputparameters:无
- **Returnedvalue:无
- *********************************************************************************************************/
- voidLCD_ILI9325_Init(void)
- {
- uint32ID=0x0000;
- LCD_Port_Init();
- LCD_REST_L;//复位
- Delay_nMS(50);
- LCD_REST_H;
- Delay_nMS(50);
- LCD_SELECT();
- ID=LCD_ReadReg(0x0000);//读LCD的ID,这里是9328
- Uart_Transmit(ID>>8);//串口观察
- Uart_Transmit(ID);
- LCD_WriteReg(0x0001,0x0100);
- LCD_WriteReg(0x0002,0x0700);
- LCD_WriteReg(0x0003,0x1030);//转换RGB至GBR,水平扫描
- LCD_WriteReg(0x0004,0x0000);
- LCD_WriteReg(0x0008,0x0207);
- LCD_WriteReg(0x0009,0x0000);
- LCD_WriteReg(0x000A,0x0000);
- LCD_WriteReg(0x000C,0x0000);
- LCD_WriteReg(0x000D,0x0000);
- LCD_WriteReg(0x000F,0x0000);
- //poweronsequenceVGHVGL
- LCD_WriteReg(0x0010,0x0000);
- LCD_WriteReg(0x0011,0x0007);
- LCD_WriteReg(0x0012,0x0000);
- LCD_WriteReg(0x0013,0x0000);
- //vgh
- LCD_WriteReg(0x0010,0x1290);
- LCD_WriteReg(0x0011,0x0227);
- //vregiout
- LCD_WriteReg(0x0012,0x001d);//0x001b
- //vomamplitude
- LCD_WriteReg(0x0013,0x1500);
- //vomH
- LCD_WriteReg(0x0029,0x0018);
- LCD_WriteReg(0x002B,0x000D);
- //gamma
- LCD_WriteReg(0x0030,0x0004);
- LCD_WriteReg(0x0031,0x0307);
- LCD_WriteReg(0x0032,0x0002);//0006
- LCD_WriteReg(0x0035,0x0206);
- LCD_WriteReg(0x0036,0x0408);
- LCD_WriteReg(0x0037,0x0507);
- LCD_WriteReg(0x0038,0x0204);//0200
- LCD_WriteReg(0x0039,0x0707);
- LCD_WriteReg(0x003C,0x0405);//0504
- LCD_WriteReg(0x003D,0x0F02);
- //ram
- LCD_WriteReg(0x0050,0x0000);
- LCD_WriteReg(0x0051,0x00EF);
- LCD_WriteReg(0x0052,0x0000);
- LCD_WriteReg(0x0053,0x013F);
- LCD_WriteReg(0x0060,0xA700);
- LCD_WriteReg(0x0061,0x0001);
- LCD_WriteReg(0x006A,0x0000);
- //
- LCD_WriteReg(0x0080,0x0000);
- LCD_WriteReg(0x0081,0x0000);
- LCD_WriteReg(0x0082,0x0000);
- LCD_WriteReg(0x0083,0x0000);
- LCD_WriteReg(0x0084,0x0000);
- LCD_WriteReg(0x0085,0x0000);
- //
- LCD_WriteReg(0x0090,0x0010);
- LCD_WriteReg(0x0092,0x0600);
- LCD_WriteReg(0x0093,0x0003);
- LCD_WriteReg(0x0095,0x0110);
- LCD_WriteReg(0x0097,0x0000);
- LCD_WriteReg(0x0098,0x0000);
- LCD_WriteReg(0x0007,0x0133);
- LCD_DIS_SELECT();
- }
- /*********************************************************************************************************
- **Functionname:LCD
ATmega16LILI9325932 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)