我现在用S3C44B0X来驱动TFT LCM(16BIT),之前一直是用单片机,因为现在速度比较慢,内存比较小,所以改为ARM.
我将TFT LCM挂在S3C44B0X的nGCS3上,TFT LCM的读写控制分别接S3C44B0X的nOE和nWR. TFT的16bit数据线接S3C44B0的D0~D15,Reset接S3C44B0X的nReset,上电复位.
程序如是,没有反应,可否请各位帮忙分析一下,
**************************************************************** //***************************************************************************** //Project: 1.8" TFT LCM display test code //Driver IC: r61503 //nGCS2 connect to LCM CS. //16-bit and 8080 times // //test LED use portc GPC4.GPC5.GPC6.GPC7 //LCD_cs //nGCS2 //LCD_reset //nRESET // //*****************************************************************************
#include "INCDEF.H"
#include "SRCpicture.c"
#define rBWSCON (*(volatile unsigned int *) 0x0180000)
#define rPCONA (*(volatile unsigned int *)0x01d2000) //IO port A control register
#define rPCONB (*(volatile unsigned int *)0x01d2008) //IO port B control register
#define rPCONC (*(volatile unsigned int *)0x01d20010) //IO port C control register
#define rPDATA (*(volatile unsigned int *)0x01d2004) //IO port data A register
#define rPDATB (*(volatile unsigned int *)0x01d2000C) //IO port data B register #define rPDATC (*(volatile unsigned int *)0x01d20014) //IO port data C register
#define rPUPC (*(volatile unsigned int *)0x01d20018) //IO port data register
#define rSend_data(addr,i) *((volatile unsigned int *)(addr<<1))=(unsigned int) i //data0~data15 I/O port
//*****************************************************************************
S16 sx,ex,syl,syh,eyl,eyh,rgbz_data;
S16 *p;
//*****************************************************************************
void Write_command(unsigned int i);
void ShowPicture(const U8 temp[]); void Delay(S16 t);
void initial();
void Write_data(unsigned int j);
void display_scolor(S16 sx,S16 ex,S16 sy,S16 ey,S16 rgb_data);
void Display();
//***************************************************************************** int Main() {
//rBWSCON=0x01001112; rPCONA =0x00; //½«A0ÉèÖÃΪÊä³öģʽ rPCONC =0x55555555; //½«IO¿ÚÖÃΪÊä³öģʽ rPUPC=0xff; rPDATC=0x00; Delay(5); rPDATC=0xa0; Delay(5); rPDATC=0x50; Delay(5); rPCONB=0x7ff; //nGCS3 rPDATB&=0x77f; //nGCS3 LOW,and TFT LCM enable
initial(); Display();
return(0); }
//*****************************************************************************
void Delay(S16 t) { unsigned int i,j,k; for(i=0;i<=t;i++) for(j=0;j<0xff;j++) for(k=0;k<0xff;k++); }
//*****************************************************************************
void initial()
{ Write_command(0x11); Write_data(0x171b); Write_command(0x12); Write_data(0x0003); Write_command(0x13); Write_data(0x080c); Write_command(0x14); Write_data(0x0017); Write_command(0x10); Write_data(0x1208); Write_command(0x13); Write_data(0x081c); Write_command(0x01); Write_data(0x0a0c); Write_command(0x02); Write_data(0x0200); Write_command(0x03); Write_data(0x1030); Write_command(0x07); Write_data(0x0005); Write_command(0x08); Write_data(0x030a); Write_command(0x0b); Write_data(0x0004); Write_command(0x0c); Write_data(0x0000); Write_command(0xa0); Write_data(0x0100); Write_command(0xa7); Write_data(0x0011); Write_command(0x0e); Write_data(0x0002);
Write_command(0x30); Write_data(0x0000); Write_command(0x31); Write_data(0x0507); Write_command(0x32); Write_data(0x0003); Write_command(0x33); Write_data(0x0601); Write_command(0x34); Write_data(0x0407); Write_command(0x35); Write_data(0x0002); Write_command(0x36); Write_data(0x0707); Write_command(0x37); Write_data(0x0106); Write_command(0x38); Write_data(0x0200); Write_command(0x40); Write_data(0x0000); Write_command(0x42); Write_data(0x9f00); Write_command(0x07); Write_data(0x0001); Write_command(0x07); Write_data(0x0021); Write_command(0x07); Write_data(0x0023); Write_command(0x07); Write_data(0x1037); Write_command(0x21); Write_data(0x0000); }
//*****************************************************************************
void Write_command(unsigned int i) { rPDATA=0x01; rSend_data(0x06000000,i);
}
//*****************************************************************************
void Write_data(unsigned int j) { rPDATA=0x00; rSend_data(0x06000000,j); }
//***************************************************************************** void Display() { display_scolor(0,127,0,159,0x0000); //black display_scolor(0,127,0,159,0xffff); //white display_scolor(0,127,0,159,0xf800); //red display_scolor(0,127,0,159,0x07e0); //green display_scolor(0,127,0,159,0x001f); //blue ShowPicture(pho1);
}
//=============================================================
void display_scolor(S16 sx,S16 ex,S16 sy,S16 ey,S16 rgb_data) { S16 i,j,k; S16 syl,syh; k=ey; syh=0; syl=0; eyh=(k>>8)&0x01; eyl=k&0xff;
Write_command(0x2a); //Column start high address set xs8=0 Write_data(0x0000); //Column start low address set Write_data(sx); Write_data(0x0000); //Column end high address set xe8=0 Write_data(ex); //Column end low address set
Write_command(0x2b); Write_data(syh); Write_data(syl);
Write_data(eyh); Write_data(eyl);
for (i=0; i<ey-sy+1; i++) { for (j=0; j<ex-sx+1; j++) { Write_data(rgb_data); } } }
//==============================================================
/*-----------Display external----------------------*/ void ShowPicture(const U8 temp[]) { S16 j; S16 i;
Write_command(0x2a); Write_data(0x0000); //Column address set Write_data(0); Write_data(0x00); Write_data(239);
Write_command(0x2b); Write_data(0x00); Write_data(0x00);
Write_data(0x01); Write_data(0x40); temp=pho1; // *p=temp;
for (i=0;i<319;i++) { for (j=0;j<239;j++) { Write_data(*p++); } } } |