
本帖最后由 wambob 于 2015-1-18 21:45 编辑 开漏输出,没有外接上拉电阻 void LCD_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStructure ; RCC_AHBPeriphClockCmd(LCD_PORT_CLK ,ENABLE); GPIO_InitStructure.GPIO_Pin = LCD_CLK_PIN|LCD_SID_PIN ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(LCD_PRORT, &GPIO_InitStructure); } LCD_SID_PIN 用的PB5端口 按原理来说.不+上拉电阻,输出不可能是高电平 1 #define LCD_SID_1 GPIO_SetBits(LCD_PRORT, LCD_SID_PIN ) #define LCD_SID_0 GPIO_ResetBits(LCD_PRORT, LCD_SID_PIN ) LCD_SID_1; Delay_Ms(500); LCD_SID_0; Delay_Ms(500); 但是我外接个LED,结果能闪亮,这是怎么回事 |
这句有问题,注释掉就好了,是不是因为没有关闭输入模式的问题
输出开漏 +输入上拉 近似== 输出推挽
赞同