//其他的LCD控制器都是写数据时RS脚为高,写命令时RS脚为低,而RA8875刚好相反
//所以把LCD_SMD_ADDRESS和LCD_DATA_ADDRESS值反过来了,不知道对不对
//我在RS脚接了反相器,并把 LCD_CMD_ADDRESS定义为0x60000000,把LCD_DATA_ADDRESS
//定义为0x60010000也不行
#define LCD_CMD_ADDRESS 0x60010000
#define LCD_DATA_ADDRESS 0x60000000
static void WriteReg(unsigned char regAddr)
{
unsigned short temp = 0xff00;
temp |= regAddr;
*((unsigned short *)LCD_CMD_ADDRESS) = temp;
}
static void WriteCommand(unsigned char mCommand)
{
unsigned short temp = 0xff00;
temp |= mCommand;
*((unsigned short *)LCD_DATA_ADDRESS) = temp;
}
static void WriteData(unsigned short data)
{
*((unsigned short *)LCD_DATA_ADDRESS) = data;
}
static void Flexbus_Init(void)
{
SIM_CLKDIV1 |= SIM_CLKDIV1_OUTDIV3(0x2);//时钟分频96M/2=48M
SIM_SOPT2 |= SIM_SOPT2_FBSL(3);
SIM_SCGC7 |= SIM_SCGC7_FLEXBUS_MASK; //使能flexbus
FB_CSMR0 = 0;
FB_CSAR0 = LCD_CMD_ADDRESS; //设置基地址
FB_CSCR0 = FB_CSCR_PS(2) | FB_CSCR_AA_MASK | FB_CSCR_BLS_MASK; //16位数据宽度,右对齐,使能应答
FB_CSCR0 |= FB_CSCR_WS(1) | FB_CSCR_RDAH(0) | FB_CSCR_WRAH(0); //应答时间
FB_CSMR0 = FB_CSMR_BAM(0x1) | FB_CSMR_V_MASK ; //2^(1+17)=128k
//DATA
PORTD_PCR6 = PORT_PCR_MUX(5);//DB0
PORTD_PCR5 = PORT_PCR_MUX(5);//DB1
PORTD_PCR4 = PORT_PCR_MUX(5);//DB2
PORTD_PCR3 = PORT_PCR_MUX(5);//DB3
PORTD_PCR2 = PORT_PCR_MUX(5);//DB4
PORTC_PCR10 = PORT_PCR_MUX(5);//DB5
PORTC_PCR9 = PORT_PCR_MUX(5);//DB6
PORTC_PCR8 = PORT_PCR_MUX(5);//DB7
PORTC_PCR7 = PORT_PCR_MUX(5);//DB8
PORTC_PCR6 = PORT_PCR_MUX(5);//DB9
PORTC_PCR5 = PORT_PCR_MUX(5);//DB10
PORTC_PCR4 = PORT_PCR_MUX(5);//DB11
PORTC_PCR2 = PORT_PCR_MUX(5);//DB12
PORTC_PCR1 = PORT_PCR_MUX(5);//DB13
PORTC_PCR0 = PORT_PCR_MUX(5);//DB14
PORTB_PCR18 = PORT_PCR_MUX(5);//DB15
//CS
PORTD_PCR1 = PORT_PCR_MUX(5);
//WR
PORTC_PCR11 = PORT_PCR_MUX(5);
//RD
PORTB_PCR19 = PORT_PCR_MUX(5);
//D/C
PORTB_PCR17 = PORT_PCR_MUX(5);
}
楼主的这个程序遇到了什么问题 |