打印

大家帮看看为什么这样配置GPIO就不好使呢?

[复制链接]
336|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
我想使用PF0、PF1、PF2、PF3,这4个管教控制两个电机的IN1,IN2,IN3,IN4管脚,GPIO配置如下
void LED_Init(void)
{            
  GPIO_InitTypeDef  GPIO_InitStructure;

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);//
        
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1| GPIO_Pin_2| GPIO_Pin_3;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//
  GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;//????
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//
  GPIO_Init(GPIOF, &GPIO_InitStructure);//
        
  GPIO_SetBits(GPIOF,GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3);
}

根据例程中的LED程序改的,谢谢啦,帮看一看!!!

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

457

主题

483

帖子

1

粉丝