使用stm32f407给ST7565R 6800 12864写驱动,无论写指令还是数据什么反应都没有。 求大神帮忙看一下,头一次使用stm32写驱动程序,一直调都不出来,好崩溃~ #include "bsp_lcd.h" #include "bsp_SysTick.h" void LCD_GPIO_OUT_Config(void) { RCC_AHB1PeriphClockCmd(LCD_GPIO_RCC , ENABLE); GPIO_InitTypeDef GPIO_InitStruct ; GPIO_InitStruct. GPIO_Pin = DATA_IO|RS|CS|RST; GPIO_InitStruct. GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct. GPIO_OType = GPIO_OType_PP; GPIO_InitStruct. GPIO_Speed = GPIO_Medium_Speed ; GPIO_InitStruct. GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(LCD_GPIO_INIT, &GPIO_InitStruct); } void LCD_Init(void) { CS_0; RST_0; Delay_ms(20); RST_1; Delay_ms(20); W_COM(0XE2); Delay_ms(50); W_COM(0x2c); Delay_ms(50); W_COM(0x2e); Delay_ms(50); W_COM(0x2f); Delay_ms(50); W_COM(0x25); Delay_ms(10); W_COM(0x81); W_COM(0x1A); W_COM(0xa2); W_COM(0xc8); W_COM(0xa0); W_COM(0x60); W_COM(0xaf); W_COM(0x60); CS_1; //增加04161210 } void Trans_D(u8 x) { LCD_GPIO_INIT -> ODR = ((LCD_GPIO_INIT -> ODR & 0xff00) | x) ; } void W_COM(u8 x) { CS_0; RS_0; RD_1; WR_0; // Delay_us(1); Trans_D(x); // Delay_ms(1); RD_0; CS_1; } void W_Data(u8 x_1) // if语句仿真失败, 确认正常04191900 { CS_0; RS_1; RD_1; WR_0; // Delay_us(1); Trans_D(x_1); RD_0; CS_1; } void LCD_ADDR(u8 page, u8 column) { u8 column1; CS_0; column1 = column & 0x0f; W_COM(0xb0 + page); W_COM(((column >> 4) & 0x0f) + 0x10); W_COM(column1); } void Test_Disp(u8 data1, u8 data2) { u16 i, j; for(j = 0; j < 8; j ++) { CS_0; LCD_ADDR(j , 1); for(i = 0; i < 64; i ++) { W_Data(data1); Delay_ms(2000); W_Data(data2); } } } void Clear_LCD(void) { u8 i,j; CS_0; for(i=0;i<9;i++) { LCD_ADDR(i+1,1); for(j=0;j<132;j++) { W_Data(0x00); } } } |
如果是6800 模式,DATA_IO需要8位,看楼主的初始化GPIO代码中,DATA_IO貌似只有1位
评分
查看全部评分
GPIO_InitStruct. GPIO_Pin = DATA_IO|RS|CS|RST; 这样配置是不行的,上网找吧,这种STM32的12864屏免费程序多得是。
评分
查看全部评分