初级会员
- 积分
- 121
- 金钱
- 121
- 注册时间
- 2014-11-5
- 在线时间
- 11 小时
|
2金钱
本帖最后由 mk_欣驰 于 2016-10-19 23:02 编辑
竖屏时:LCD_Disp_Dir(0); // 0竖屏,1,横屏
显示是对的。
横屏就不对了。
是哪里不对,求大神指教!!!!!
代码如下:
[mw_shl_code=c,true]void LCDx_Init(void)
{
LCD_FSMC_Init();
Delay(0xfffff);
LCD_WriteReg(0x00E5,0x78F0);
LCD_WriteReg(0x0001,0x0100);
LCD_WriteReg(0x0002,0x0700);
LCD_WriteReg(0x0003,0x1030);
LCD_WriteReg(0x0004,0x0000);
LCD_WriteReg(0x0008,0x0202);
LCD_WriteReg(0x0009,0x0000);
LCD_WriteReg(0x000A,0x0000);
LCD_WriteReg(0x000C,0x0000);
LCD_WriteReg(0x000D,0x0000);
LCD_WriteReg(0x000F,0x0000);
//power on sequence VGHVGL
LCD_WriteReg(0x0010,0x0000);
LCD_WriteReg(0x0011,0x0007);
LCD_WriteReg(0x0012,0x0000);
LCD_WriteReg(0x0013,0x0000);
LCD_WriteReg(0x0007,0x0000);
//vgh
LCD_WriteReg(0x0010,0x1690);
LCD_WriteReg(0x0011,0x0227);
//delayms(100);
//vregiout
LCD_WriteReg(0x0012,0x009D); //0x001b
//delayms(100);
//vom amplitude
LCD_WriteReg(0x0013,0x1900);
//delayms(100);
//vom H
LCD_WriteReg(0x0029,0x0025);
LCD_WriteReg(0x002B,0x000D);
//gamma
LCD_WriteReg(0x0030,0x0007);
LCD_WriteReg(0x0031,0x0303);
LCD_WriteReg(0x0032,0x0003);// 0006
LCD_WriteReg(0x0035,0x0206);
LCD_WriteReg(0x0036,0x0008);
LCD_WriteReg(0x0037,0x0406);
LCD_WriteReg(0x0038,0x0304);//0200
LCD_WriteReg(0x0039,0x0007);
LCD_WriteReg(0x003C,0x0602);// 0504
LCD_WriteReg(0x003D,0x0008);
//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(0x0007,0x0133);
LCD_WriteReg(0x00,0x0022);//
LCD_Disp_Dir(0); // 0竖屏,1,横屏
LCD_LED;
} [/mw_shl_code]
[mw_shl_code=applescript,true]void LCD_Disp_Dir(u8 dir)
{
if(dir==0)//竖屏
{
lcddev.dir=0;
lcddev.width=240;
lcddev.height=320;
lcddev.wramcmd=0X22;
lcddev.setxcmd=0X20;
lcddev.setycmd=0X21;
}
else //横屏
{
lcddev.dir=1;
lcddev.width=320;
lcddev.height=240;
lcddev.wramcmd=0X22;
lcddev.setxcmd=0X21;
lcddev.setycmd=0X20;
}
LCD_Scan_Dir(dir); //设置扫描方向[mw_shl_code=applescript,true]//éèÖÃ1a±êλÖÃ
[mw_shl_code=applescript,true]//éèÖÃLCDμÄ×Ô¶ˉé¨Ãè·½Ïò
void LCD_Scan_Dir(u8 dir)
{
u16 regval=0;
if(dir==0) {regval|=V_L2R_U2D;} //竖屏时;从左到右,从上到下
else {regval|=H_L2R_U2D;} //横屏时;从左到右,从上到下
regval|=1<<12;
LCD_WriteReg(0X03,regval);
} [/mw_shl_code]
[mw_shl_code=applescript,true]//设置光标位置
//Xposá×ø±ê
//Ypos:×Y×ø±ê
void LCD_SetCursor(u16 Xpos, u16 Ypos)
{
LCD_WriteReg(lcddev.setxcmd, Xpos);
LCD_WriteReg(lcddev.setycmd, Ypos);
} [/mw_shl_code]
|
|