本帖最后由 tanglei9098 于 2010-7-7 22:26 编辑
我的开发板是Mini2440,使用统宝LCD显示屏。
LCD初始化代码如下:
static void LCD_Init(void)
{
rLCDCON1 = (8 << 8) | (3 << 5) | (12 << 1) | 1;
//CLKVAL = HCLK / (VCLK * 2) - 1, HCLK = 405/4; VCLK = 5.44
rLCDCON2 = (2 << 24) | (319 << 14) | (1 << 6) | (0 << 0);
//VBPD + 1 = 3(24), LINEVAL + 1 = 320(14), VFPD + 1 = 2(6), VSPW + 1 = 1(0)
rLCDCON3 = (19 << 19) | (239 << 8) | (9 << 0);
//HBPD + 1 = 20(19), HOZVAL + 1 = 240(8), HFPD + 1 = 10(0)
rLCDCON4 = 9;
//HSPW + 1 = 10(0)
rLCDCON5 = (1 << 1) | (1 << 9) | (1 << 8) | (1 << 3) ;
//LSB valid(12):0, 5:6:5 Format(11):1, faling edge(10):0, HSYNC Inverted(9):1, VSYNC Inverted(8):1,
// VDEN normal(6):0, PWREN Enable(3):1, Half-Word swap Enable(0):1,
//LCD使用16bpp显示,因此缓存需要240*320个半字空间
//其中,LCDBANK是缓存地址的[30:22]位,LCDBASEU是缓存首地址的[21:1]位,LCDBASEL是缓存尾地址的[21:1]位。因为缓存最小是以半字的单位,所以地址最后一位一直为0
rLCDSADDR1 = (((U32)LCD_BUFFE >> 22) << 21) | ((M5D((U32)LCD_BUFFE >> 1)) << 0);
rLCDSADDR2 = M5D(((U32)LCD_BUFFE + 320 * 240 * 2) >> 1);
rLCDSADDR3 = 240; //不使用虚拟屏,OFFSIZE设成0,PAGEWIDTH为HOZVAL + 1
rLCDINTMSK |= 3; //屏蔽LCD中断
}
主函数里面使用如下代码,想在LCD屏的四个角显示出不同颜色的箭头:
for(i = 0; i < 50; i++)
{
LCD_BUFFE = 0x7e0;
LCD_BUFFE[0] = 0x7e0;
LCD_BUFFE[0] = 0x7e0;
LCD_BUFFE[239-i] = 0xf800;
LCD_BUFFE[0][239-i] = 0xf800;
LCD_BUFFE[239] = 0xf800;
LCD_BUFFE[319-i] = 0x1f;
LCD_BUFFE[319] = 0x1f;
LCD_BUFFE[319-i][0] = 0x1f;
LCD_BUFFE[319-i][239-i] = 0x7ff;
LCD_BUFFE[319][239-i] = 0x7ff;
LCD_BUFFE[319-i][239] = 0x7ff;
}
预期的显示结果为左边的图,可是实际显示结果为右边的图,请大家帮我看看为什么 |