初级会员

- 积分
- 84
- 金钱
- 84
- 注册时间
- 2016-1-24
- 在线时间
- 11 小时
|
1金钱
开发板LED等一端接高电平,另一端接GPIOF,写初始化库函数的时候,输出模式为推挽输出,上拉方式,开机后灯是亮的
请教:上拉方式LED两端应该都是高电平,为什么会亮?
------------------------------
代码:
GPIO_InitTypeDef struct_GPIO_led;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
struct_GPIO_led.GPIO_Mode =GPIO_Mode_OUT;
struct_GPIO_led.GPIO_OType=GPIO_OType_OD;
struct_GPIO_led.GPIO_Pin=GPIO_Pin_9;
struct_GPIO_led.GPIO_PuPd=GPIO_PuPd_UP;
struct_GPIO_led.GPIO_Speed=GPIO_Low_Speed;
GPIO_Init(GPIOF, &struct_GPIO_led);
-------------------------------
另外,上面代码里初始化结构体定义必须在使能之前,否则报错,为什么?
初学,谢谢!
|
|