初中生
最后登录1970-1-1
在线时间 小时
注册时间2023-5-20
|
FSMC把数据宽度配置成8bit,显示白屏。应该是显示屏驱动异常,改成16bit后能显示,但是不管是显示字符还是字符串,每个字母都是显示两个,连方块都是显示两个。不知道哪出了问题。
把教程里面的例子移植过去也是显示也是这样子
源代码在附件,大神请帮忙看看,谢谢。
//不知道这命令和数据函数是不是写的有问题,
//LCD命令操作函数
void user_LCD_CMD(uint8_t cmd)
{
*(volatile uint8_t *) (LCD_CMD) = cmd;
}
//LCD数据写入函数
void user_LCD_DATA(uint8_t data)
{
*(volatile uint8_t *) (LCD_DATA) = data;
}
//FSMC配置函数
void user_FSMC_Config(void)
{
FSMC_NORSRAMTimingInitTypeDef LCD_FSMC_Timing;
FSMC_NORSRAMInitTypeDef LCD_FSMC_Config;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
LCD_FSMC_Timing.FSMC_AccessMode = FSMC_AccessMode_B;
LCD_FSMC_Timing.FSMC_AddressHoldTime = 0x00;
LCD_FSMC_Timing.FSMC_AddressSetupTime = 0x00;
LCD_FSMC_Timing.FSMC_BusTurnAroundDuration = 0x00;
LCD_FSMC_Timing.FSMC_CLKDivision = 0x00;
LCD_FSMC_Timing.FSMC_DataLatency = 0x00;
LCD_FSMC_Timing.FSMC_DataLatency = 0x00;
LCD_FSMC_Timing.FSMC_DataSetupTime = 0x02;
LCD_FSMC_Config.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable;
LCD_FSMC_Config.FSMC_Bank = FSMC_Bank1_NORSRAM1;
LCD_FSMC_Config.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
LCD_FSMC_Config.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
LCD_FSMC_Config.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
LCD_FSMC_Config.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;//直接把这个改成_8b,显示白屏。
LCD_FSMC_Config.FSMC_MemoryType = FSMC_MemoryType_SRAM;
LCD_FSMC_Config.FSMC_ReadWriteTimingStruct = &LCD_FSMC_Timing;
LCD_FSMC_Config.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
LCD_FSMC_Config.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
LCD_FSMC_Config.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
LCD_FSMC_Config.FSMC_WrapMode = FSMC_WrapMode_Disable;
LCD_FSMC_Config.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
LCD_FSMC_Config.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
LCD_FSMC_Config.FSMC_WriteTimingStruct = &LCD_FSMC_Timing;
FSMC_NORSRAMInit(&LCD_FSMC_Config);
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM1, ENABLE);
}
|
|