有些GPIO口置不了位啊

[复制链接]
 楼主| isd2560 发表于 2009-3-25 10:30 | 显示全部楼层 |阅读模式
悬空,没有接外围电路,PE置高位不起作用哈,拿来做一般IO用的
程序如下
  GPIO_InitTypeDef GPIO_InitStructure;
  
  /* Configure PE.01-03 as output push-pull */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOE, &GPIO_InitStructure);

主程序中
  printf(" Try Again!!");
  
  GPIO_SetBits( GPIOE, GPIO_Pin_1);
  GPIO_SetBits( GPIOE, GPIO_Pin_2);
  GPIO_SetBits( GPIOE, GPIO_Pin_3);
  //GPIO_SetBits( GPIOE, GPIO_Pin_4);
  //GPIO_SetBits( GPIOE, GPIO_Pin_5);


香水城 发表于 2009-3-25 10:38 | 显示全部楼层

请打开对应的时钟

 楼主| isd2560 发表于 2009-3-25 10:41 | 显示全部楼层

可以了

 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
最近老是犯迷糊,调那么多多板子,谢谢香版,欧了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

93

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部