板子是原子的Mini STM32.程序基本上都是原子送的例程,自己读懂以后基本上都是抄写了一遍,只不过程序只对应我板子上的芯片型号(先下载了例程,串口输出的芯片ID是4531),所以只保留了该芯片的初始化程序,并直接使用竖屏和快速IO模式。
现在的情况是,屏幕能够正常显示,各个功能函数能够正常使用,就是那个读取ID返回的值一直是FFFF。非常不解,请大家帮忙纠正下!谢谢~~~
delay_ms(50); // delay 50 ms
LCD_WriteReg(0x0000,0x0001); //打开TFTLCD模块的振荡器
delay_ms(50); // delay 50 ms
DeviceCode = LCD_ReadReg(0x00); //读取TFTLCD驱动芯片的型号
printf(" LCD ID:%x
",DeviceCode); //打印LCD ID
//上面的读取ID的函数没有修改啊,为何返回值就不对了呢,但是使用原子的程序又没有什么问题!
//驱动芯片初始化 芯片型号4531,直接拷贝,没有修改的
LCD_WriteReg(0X00,0X0001);
delay_ms(10);
LCD_WriteReg(0X10,0X1628);
LCD_WriteReg(0X12,0X000e);//0x0006
LCD_WriteReg(0X13,0X0A39);
delay_ms(10);
LCD_WriteReg(0X11,0X0040);
LCD_WriteReg(0X15,0X0050);
delay_ms(10);
LCD_WriteReg(0X12,0X001e);//16
delay_ms(10);
LCD_WriteReg(0X10,0X1620);
LCD_WriteReg(0X13,0X2A39);
delay_ms(10);
LCD_WriteReg(0X01,0X0100);
LCD_WriteReg(0X02,0X0300);
LCD_WriteReg(0X03,0X1030);//改变方向的
LCD_WriteReg(0X08,0X0202);
LCD_WriteReg(0X0A,0X0008);
LCD_WriteReg(0X30,0X0000);
LCD_WriteReg(0X31,0X0402);
LCD_WriteReg(0X32,0X0106);
LCD_WriteReg(0X33,0X0503);
LCD_WriteReg(0X34,0X0104);
LCD_WriteReg(0X35,0X0301);
LCD_WriteReg(0X36,0X0707);
LCD_WriteReg(0X37,0X0305);
LCD_WriteReg(0X38,0X0208);
LCD_WriteReg(0X39,0X0F0B);
LCD_WriteReg(0X41,0X0002);
LCD_WriteReg(0X60,0X2700);
LCD_WriteReg(0X61,0X0001);
LCD_WriteReg(0X90,0X0210);
LCD_WriteReg(0X92,0X010A);
LCD_WriteReg(0X93,0X0004);
LCD_WriteReg(0XA0,0X0100);
LCD_WriteReg(0X07,0X0001);
LCD_WriteReg(0X07,0X0021);
LCD_WriteReg(0X07,0X0023);
LCD_WriteReg(0X07,0X0033);
LCD_WriteReg(0X07,0X0133);
LCD_WriteReg(0XA0,0X0000);
//驱动芯片初始化完毕
LCD_LED = 1;//点亮背光
LCD_Clear(WHITE);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
ALIENTEK MINISTM32 实验10 TFTLCD显示实验
int main(void)
{
u8 x=0;
SystemInit();
delay_init(72); //延时初始化
NVIC_Configuration();
uart_init(9600);
LED_Init();
KEY_Init();
LCD_Init();
POINT_COLOR=RED;
while(1)
{
switch(x)
{
case 0CD_Clear(WHITE);break;
case 1CD_Clear(BLACK);break;
case 2CD_Clear(BLUE);break;
case 3CD_Clear(RED);break;
case 4CD_Clear(MAGENTA);break;
case 5CD_Clear(GREEN);break;
case 6CD_Clear(CYAN);break;
case 7CD_Clear(YELLOW);break;
case 8CD_Clear(BRRED);break;
case 9CD_Clear(GRAY);break;
case 10:LCD_Clear(LGRAY);break;
case 11:LCD_Clear(BROWN);break;
}
POINT_COLOR=RED;
LCD_ShowString(30,50,"Mini STM32 ^_^");
LCD_ShowString(30,70,"2.4'/2.8' TFTLCD TEST");
LCD_ShowString(30,90,"ATOM@ALIENTEK");
LCD_ShowString(30,110,"2010/12/30");
x++;
if(x==12)x=0;
LED0=!LED0;
delay_ms(1000);
}
}
u16 LCD_ReadReg(u8 LCD_Reg)
{
u16 t;
LCD_WR_REG(LCD_Reg); //写入要读的寄存器号
GPIOB->CRL=0X88888888; //PB0-7 上拉输入
GPIOB->CRH=0X88888888; //PB8-15 上拉输入
GPIOB->ODR=0XFFFF; //全部输出高
。。。。
GPIOB->CRL=0X33333333; //PB0-7 上拉输出
GPIOB->CRH=0X33333333; //PB8-15 上拉输出
GPIOB->ODR=0XFFFF; //全部输出高
return t;
所以:
DeviceCode = LCD_ReadReg(0x0000);
DeviceCode =0XFFFF;
一周热门 更多>