ATMEL9263 800*600屏驱动问题
后来查了一下代码,问题找到了,原因是改成大屏幕以后,LCD的象素时钟变大,应用官方提供的代码就出现问题了。
//------------------------------------------------------------------------------
/// 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;
}
当应用大屏幕的时候,后面的表达式算出来是一个负数,所以时钟送不出来,LCD也就驱动不起来了
修改以后:
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象素时钟 是由LCD控制器时钟 根据CLKVAL分频得到
1 LCD象素时钟 就是LCD控制器时钟
ATMELat91SAM926 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)