ATMEL9263 800*600屏驅(qū)動(dòng)問(wèn)題
后來(lái)查了一下代碼,問(wèn)題找到了,原因是改成大屏幕以后,LCD的象素時(shí)鐘變大,應(yīng)用官方提供的代碼就出現(xiàn)問(wèn)題了。
本文引用地址:http://2s4d.com/article/201611/320035.htm//------------------------------------------------------------------------------
/// Configures the internal clock of the LCD controller given the master clock of
/// the system and the desired pixel clock in MHz.
/// param masterClock Master clock frequency.
/// param pixelClock Pixel clock frequency.
//------------------------------------------------------------------------------
void LCD_SetPixelClock(unsigned int masterClock, unsigned int pixelClock)
{
AT91C_BASE_LCDC->LCDC_LCDCON1 = ((masterClock / (2 * pixelClock)) - 1) << 12;
}
當(dāng)應(yīng)用大屏幕的時(shí)候,后面的表達(dá)式算出來(lái)是一個(gè)負(fù)數(shù),所以時(shí)鐘送不出來(lái),LCD也就驅(qū)動(dòng)不起來(lái)了
修改以后:
void LCD_SetPixelClock(unsigned int masterClock, unsigned int pixelClock)
{
unsigned int value;
value = masterClock / pixelClock;
if (masterClock % pixelClock)
{
value++;
}
value = value/2;
if (!value)
AT91C_BASE_LCDC->LCDC_LCDCON1 = AT91C_LCDC_BYPASS;
else
{
value -= 1;
AT91C_BASE_LCDC->LCDC_LCDCON1 = (value << 12);
}
}
BYPASS描述:
0 LCD象素時(shí)鐘 是由LCD控制器時(shí)鐘 根據(jù)CLKVAL分頻得到
1 LCD象素時(shí)鐘 就是LCD控制器時(shí)鐘
評(píng)論