新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ATMEL9263 800*600屏驅(qū)動(dòng)問(wèn)題

ATMEL9263 800*600屏驅(qū)動(dòng)問(wèn)題

作者: 時(shí)間:2016-11-22 來(lái)源:網(wǎng)絡(luò) 收藏
前段時(shí)間跟某院有個(gè)合作,應(yīng)用我們公司的ATMEL at91SAM9263,評(píng)估板套件應(yīng)用我們的800*480屏幕沒(méi)有問(wèn)題,但是稍微一改大屏幕的配置,就驅(qū)動(dòng)不起來(lái)了。

后來(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);
}

}
參考數(shù)據(jù)手冊(cè)LCD寄存器描述,可以清楚的明白

BYPASS描述:

0 LCD象素時(shí)鐘 是由LCD控制器時(shí)鐘 根據(jù)CLKVAL分頻得到

1 LCD象素時(shí)鐘 就是LCD控制器時(shí)鐘



關(guān)鍵詞: ATMELat91SAM926

評(píng)論


技術(shù)專(zhuān)區(qū)

關(guān)閉