高级会员

- 积分
- 894
- 金钱
- 894
- 注册时间
- 2015-10-25
- 在线时间
- 117 小时
|

楼主 |
发表于 2016-6-19 12:19:54
|
显示全部楼层
[mw_shl_code=c,true]void BEEP_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);//使能GPIOF时钟
//初始化蜂鸣器对应引脚GPIOF8
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;//下拉
GPIO_Init(GPIOF, &GPIO_InitStructure);//初始化GPIO
GPIO_ResetBits(GPIOF,GPIO_Pin_8); //蜂鸣器对应引脚GPIOF8拉低,
}
上面代码中,下拉和引脚拉低区别是什么,能不能只设置其中一个来控制引脚电平变化啊?[/mw_shl_code] |
|