stm32探索者引脚输出电平

2019-07-20 03:25发布

为什么io引脚配置以后,用示波器测引脚的输出电平,不是我的程序控制的结果,并且在每个引脚(包括我没配置的)上都测得相同的波形,求大神指教
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
12条回答
overload
2019-07-20 10:28
peng1554 发表于 2019-3-7 11:40
代码是怎么写的?实现的功能是?>

void ModuleCtrl_Init(void)
{
        GPIO_InitTypeDef GPIO_Initinstructure;
       
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE);
        RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB,ENABLE);
       
       
        GPIO_Initinstructure.GPIO_Mode=GPIO_Mode_OUT;
        GPIO_Initinstructure.GPIO_OType=GPIO_OType_PP;
        GPIO_Initinstructure.GPIO_Pin=GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12;
        GPIO_Initinstructure.GPIO_PuPd=GPIO_PuPd_NOPULL;
        GPIO_Initinstructure.GPIO_Speed=GPIO_Speed_100MHz;
        GPIO_Init(GPIOA,&GPIO_Initinstructure);
        GPIO_ResetBits(GPIOA,GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12);
       
        GPIO_Initinstructure.GPIO_Mode=GPIO_Mode_OUT;
        GPIO_Initinstructure.GPIO_OType=GPIO_OType_PP;
        GPIO_Initinstructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_5|GPIO_Pin_6;
        GPIO_Initinstructure.GPIO_PuPd=GPIO_PuPd_NOPULL;
        GPIO_Initinstructure.GPIO_Speed=GPIO_Speed_100MHz;
        GPIO_Init(GPIOB,&GPIO_Initinstructure);
        GPIO_ResetBits(GPIOB,GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12);
}
是这样配置的,是不是配置的有问题啊?

一周热门 更多>