若用LPC的GPIO口模拟其总线时序,点不亮TFT屏....
其中:数据输出端口为:P0.2~P0.17
#define LCD_CS_1 {IO0SET |= (1<<18);}// rPDATD |=(1<<2)
#define LCD_CS_0 {IO0CLR |= (1<<18);}// rPDATD &=~(1<<2)
#define LCD_RS_1 {IO0SET |= (1<<19);}//rPDATD |=(1<<1)
#define LCD_RS_0 {IO0CLR |= (1<<19);}//rPDATD &=~(1<<1)
#define LCD_WR_1 {IO0SET |= (1<<20);}// rPDATD |=(1<<5)
#define LCD_WR_0 {IO0CLR |= (1<<20);}// rPDATD&=~(1<<5)
#define LCD_RD_1 {IO0SET |= (1<<21);}//rPDATD |=(1<<3)
#define LCD_RD_0 {IO0CLR |= (1<<21);}// rPDATD&=~(1<<3)
#define LCD_RESET_1 {IO0SET |= (1<<22);}//rPDATD |= 1
#define LCD_RESET_0 {IO0CLR |= (1<<22);}//rPDATD &=~1
/**************************************************************************************
* 名 称:
* 功 能:
* 参 数:
* 返 回 值:
**************************************************************************************/
void WriData(uint16 ch)
{
uint32 dat = ch;
uint32 dat2;
dat =(dat<<2)&0x0003FFFC;
dat2 = (~dat)&0x0003FFFC;
LCD_RS_1;
LCD_WR_0;
LCD_CS_0;
// rPDATC=ch;//LCD_DATA(ch);
// PORT_DATA(ch);
// temp1 = IO0SET&0x0000FFFF;
// temp2 = IO0CLR&0x0000FFFF;
//IO0SET |= dat;
// IO0CLR |= dat2;
IO0PIN |= dat;
LCD_WR_1;
LCD_CS_1;
}
/**************************************************************************************
* 名 称:
* 功 能:
* 参 数:
* 返 回 值:
**************************************************************************************/
void WriCom(uint16 ch)
{
uint32 dat = ch;
uint32 dat2;
dat = (dat<<2)&0x0003FFFC;
dat2 = (~dat)&0x0003FFFC;
LCD_RS_0;
LCD_WR_0;
LCD_CS_0;
// rPDATC=ch;//LCD_DATA(ch);
// PORT_DATA(ch);
// IO0SET |= dat;
// IO0CLR |= dat2;
IO0PIN |= dat;
LCD_WR_1;
LCD_CS_1;
}
int main (void)
{
uint16 i;
PINSEL0 = 0;
PINSEL1 = 0;
PINSEL2 = 0;
IO0DIR = 0xFFFFFFFF;
.......
}
具体程序如附件..... |