打印

请帮忙看看这个44B0点8080接口TFT的程序哪里有问题

[复制链接]
2364|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
murphy.he|  楼主 | 2009-5-3 21:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我在调,可似乎没反应,下面是部分代码
int main (void) {

  init_timer();                             /* Initialize Timer */
  init_serial();                            /* Initialize Serial Interface */
  printf ("Welcom to S3C44B0 DEMO Kit ! ");             /* Print "Hello World !" */
  LED_Blink(3);
    init_lcd_interface( );
    HX8347_Init( );
    LCD_BlockWrite_HX8347(0,0,200,300,0x001f);



#define UINT32 unsigned int
#define UINT16 unsigned short
//     set interface GPIO mode :RESET, CS,     RD,    WR,    A0,    D0-D15
//  RESET     ->    nGCS5        @GPIO mode
//     LCD_CS    ->    EMI_nGCS4        @set mode to CS4 
//     LCD_WR     ->  EMI_nWE            @NC
//     LCD_RD     ->     EMI_nOE            @NC
//     LCD_A0    ->    EMI_ADDR1        @NC
//    LCD_D0-D15    ->    EMI_D0-D15     @NC 


#define LCD_PARALLEL0_A0_LOW_ADDR            0x08000000
#define LCD_PARALLEL0_A0_HIGH_ADDR            0x08000002

#define MAIN_LCD_CMD_ADDR               LCD_PARALLEL0_A0_LOW_ADDR
#define MAIN_LCD_DATA_ADDR              LCD_PARALLEL0_A0_HIGH_ADDR

#define MAIN_LCD_16BIT_MODE

#define MAIN_LCD_OUTPUT_FORMAT    LCM_16BIT_16_BPP_RGB565_1

void LCD_Delay(UINT32 delay_count)
{
    UINT32 delay;
    for (delay =0;delay <delay_count;delay++) {}
}

extern void wait (unsigned long);
void Delay_ms(UINT32 data)
{
    wait(data);
}
//PB10
#define CLR_LCD_CTRL_RESET_PIN 
    REG16(0x01D2000C) &= (~0x0001<<10)

#define SET_LCD_CTRL_RESET_PIN    
    REG16(0x01D2000C) |= (0x0001<<10)

#if defined (MAIN_LCD_16BIT_MODE)
#define LCD_CtrlWrite_HX8347(_data)  
    {
        REG16(MAIN_LCD_CMD_ADDR) = _data ;
        LCD_Delay(2);
    }

#define LCD_DataWrite_HX8347(_data)  
    {
        REG16(MAIN_LCD_DATA_ADDR) = _data ;
        LCD_Delay(2);
    }
#endif     //#ifdef (MAIN_LCD_16BIT_MODE)    


//*************************************************************************************//
//        LCD DRIVER API
//*************************************************************************************//


void init_lcd_interface(void)
{
//     set interface GPIO mode :RESET, CS,     RD,    WR,    A0,    D0-D15
//  RESET     ->    nGCS5        @GPIO mode
//     LCD_CS    ->    nGCS4        @set mode to CS4 
//     LCD_WR     ->  EMI_nWE            @NC
//     LCD_RD     ->     EMI_nOE            @NC
//     LCD_A0    ->    EMI_ADDR1        @NC
//    LCD_D0-D15    ->    EMI_D0-D15     @NC                    
// SET BANK4 to 16bits ROM  mode, 0001
    REG32(0x01C80000) &= (0x000f0000);    //mask bank4 setting
    REG32(0x01C80000) |= (0x00010000);    //set to 16bits,no waiting ,not use UB/LB

// set nGCS4,nGCS5
    REG16(0x01D20008) |= (0x0001<<9) ;        //set GPB9 to nGCS4 mode
    REG16(0x01D20008) &= (~0x0001<<10) ;    //set GPB10 to GPO mode
    SET_LCD_CTRL_RESET_PIN;        //set GPB10 
//set timing ,0111 1111 1111 0100
//    REG16(0x01C80014) =0x7FF4;
     
//reset LCD Moudle
    CLR_LCD_CTRL_RESET_PIN;
    Delay_ms(20);
    SET_LCD_CTRL_RESET_PIN;
    Delay_ms(400);
}    /* init_lcd_interface() */

void LCD_write_reg_HX8347(UINT16 reg_index, UINT16 reg_dat)
{
    LCD_CtrlWrite_HX8347(reg_index);
    LCD_DataWrite_HX8347(reg_dat);
}

void HX8347_Init (void)
{
         //=========Initial HX8347  for INL2.8"QVGA Panel======//
           UINT16 LCDID,ii;

           LCD_write_reg_HX8347(0x0042,0x0008);  
          //Gamma setting 
           LCD_write_reg_HX8347(0x0046,0x0033);
           LCD_write_reg_HX8347(0x0047,0x0033);
           LCD_write_reg_HX8347(0x0048,0x0033);
           LCD_write_reg_HX8347(0x0049,0x0067);
           LCD_write_reg_HX8347(0x004A,0x0015);
           LCD_write_reg_HX8347(0x004B,0x0026);
           LCD_write_reg_HX8347(0x004C,0x0001);
           LCD_write_reg_HX8347(0x004D,0x0044);
           LCD_write_reg_HX8347(0x004E,0x0005); 
           LCD_write_reg_HX8347(0x004F,0x0010); 
           LCD_write_reg_HX8347(0x0050,0x0008); 
           LCD_write_reg_HX8347(0x0051,0x000a); 
           
         //Window Setting
         
           LCD_write_reg_HX8347(0x0002,0x0000);
           LCD_write_reg_HX8347(0x0003,0x0000);
           LCD_write_reg_HX8347(0x0004,0x0000);
           LCD_write_reg_HX8347(0x0005,0x00EF);
           LCD_write_reg_HX8347(0x0006,0x0000);
           LCD_write_reg_HX8347(0x0007,0x0000);
           LCD_write_reg_HX8347(0x0008,0x0001);
           LCD_write_reg_HX8347(0x0009,0x003F);
                 
           LCD_Delay(10);
           
           LCD_write_reg_HX8347(0x0001,0x0006);
        
           LCD_write_reg_HX8347(0x0016,0x00C8);  
           LCD_write_reg_HX8347(0x0023,0x0095);
           LCD_write_reg_HX8347(0x0024,0x0095);
           LCD_write_reg_HX8347(0x0025,0x00FF);
           LCD_write_reg_HX8347(0x0027,0x0002);
           LCD_write_reg_HX8347(0x0028,0x0002);
           LCD_write_reg_HX8347(0x0029,0x0002);
           LCD_write_reg_HX8347(0x002A,0x0002);
           LCD_write_reg_HX8347(0x002C,0x0002);
           LCD_write_reg_HX8347(0x002D,0x0002);
         
           LCD_write_reg_HX8347(0x003A,0x0001); 
           LCD_write_reg_HX8347(0x003B,0x0001); 
           LCD_write_reg_HX8347(0x003C,0x00F0);   
           LCD_write_reg_HX8347(0x003D,0x0000);
         
           LCD_Delay(20);
         
           LCD_write_reg_HX8347(0x0035,0x0038);
           LCD_write_reg_HX8347(0x0036,0x0078);
           LCD_write_reg_HX8347(0x003E,0x0038);
           LCD_write_reg_HX8347(0x0040,0x000F);
           LCD_write_reg_HX8347(0x0041,0x00F0); 
         
           LCD_write_reg_HX8347(0x0038,0x0000);
         
          // Power Setting
         
           LCD_write_reg_HX8347(0x0019,0x0049); 
           LCD_write_reg_HX8347(0x0093,0x000A);
         
           LCD_Delay(10);
         
           LCD_write_reg_HX8347(0x0020,0x0020);  
         
           LCD_write_reg_HX8347(0x001D,0x0003);  
           LCD_write_reg_HX8347(0x001E,0x0000); 
         
           LCD_write_reg_HX8347(0x001F,0x0009);  
         
           LCD_write_reg_HX8347(0x0044,0x0053); 
           LCD_write_reg_HX8347(0x0045,0x0010);  
         
           LCD_Delay(10); 
         
           LCD_write_reg_HX8347(0x001C,0x0004); 
         
           LCD_Delay(20);
         
           LCD_write_reg_HX8347(0x0043,0x0080);   
         
           LCD_Delay(5);
         
           LCD_write_reg_HX8347(0x001B,0x000a);   
         
           LCD_Delay(40); 
         
           LCD_write_reg_HX8347(0x001B,0x0012);   
         
           LCD_Delay(40);    
          //Display On Setting
         
           LCD_write_reg_HX8347(0x0090,0x007F);
           LCD_write_reg_HX8347(0x0026,0x0004);
          
           LCD_Delay(40); 
         
           LCD_write_reg_HX8347(0x0026,0x0024);
           LCD_write_reg_HX8347(0x0026,0x002C);
          
           LCD_Delay(40);    
           LCD_write_reg_HX8347(0x0070,0x0008);
           LCD_write_reg_HX8347(0x0026,0x003C); 
           LCD_write_reg_HX8347(0x0057,0x0002);
           LCD_write_reg_HX8347(0x0055,0x0000);
           LCD_write_reg_HX8347(0x0057,0x0000);
           LCD_CtrlWrite_HX8347(0x0000);           
           LCDID=REG16(MAIN_LCD_DATA_ADDR);
           printf("reg%d = %x  ----",ii,LCDID ); 
      
           LCD_CtrlWrite_HX8347(0x0022);    //??
  
}

void LCD_BlockWrite_HX8347(UINT16 startx,UINT16 starty,UINT16 endx,UINT16 endy,UINT16 pdata)
{
    UINT32 aa,bb;

     LCD_CtrlWrite_HX8347(0x0002);
    LCD_DataWrite_HX8347((startx>>8)&0xff);
    LCD_CtrlWrite_HX8347(0x0003);
    LCD_DataWrite_HX8347((startx&0xff));
     LCD_CtrlWrite_HX8347(0x0004);
    LCD_DataWrite_HX8347((endx>>8)&0xff);
    LCD_CtrlWrite_HX8347(0x0005);
    LCD_DataWrite_HX8347(endx&0xff);
     LCD_CtrlWrite_HX8347(0x0006);
    LCD_DataWrite_HX8347((starty>>8)&0xff);
    LCD_CtrlWrite_HX8347(0x0007);
    LCD_DataWrite_HX8347(starty&0xff);
    LCD_CtrlWrite_HX8347(0x0008);
    LCD_DataWrite_HX8347((endy>>8)&0xff);
     LCD_CtrlWrite_HX8347(0x0009);
    LCD_DataWrite_HX8347(endy&0xff);
    LCD_CtrlWrite_HX8347(0x0016);
    LCD_DataWrite_HX8347(0x00C8);
      LCD_CtrlWrite_HX8347(0x0022);

    for(aa=startx;aa<endx;aa++)
    {
        for(bb=starty;bb<endy;bb++)
        {
            //LCD_DataWrite_TA7601(*pdata);
            LCD_DataWrite_HX8347(pdata);
            //pdata++;
        }
    }
}

void SetBrightLevel_HX8347(UINT32 level)
{
/*you can use PWM to control backlight level*/

}

相关帖子

沙发
huanben| | 2011-5-7 22:49 | 只看该作者
你这个是什么驱动的饿?

使用特权

评论回复
板凳
wyhkerry2007| | 2011-5-10 12:07 | 只看该作者
好长啊  要是可以的话 在线调试 试试  刚开始学习啊!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

56

主题

291

帖子

1

粉丝