OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 3720|回复: 2

把两个IO口一个设置为上拉输出,一个设置为下拉输出,怎么改啊

[复制链接]

21

主题

70

帖子

0

精华

中级会员

Rank: 3Rank: 3

积分
227
金钱
227
注册时间
2016-4-12
在线时间
82 小时
发表于 2016-5-19 20:25:16 | 显示全部楼层 |阅读模式
1金钱
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6|GPIO_Pin_7;        
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;      
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;       
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;     
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;        
        GPIO_Init(GPIOA,&GPIO_InitStructure);            



这段代码怎么改啊?把7改为下拉!

最佳答案

查看完整内容[请看2#楼]

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOA,&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin ...
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

0

主题

14

帖子

0

精华

初级会员

Rank: 2

积分
89
金钱
89
注册时间
2015-11-26
在线时间
9 小时
发表于 2016-5-19 20:25:17 | 显示全部楼层

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;        
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;      
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;        
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;     
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;        
        GPIO_Init(GPIOA,&GPIO_InitStructure);   

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;        
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;      
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;        
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;     
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;        
        GPIO_Init(GPIOA,&GPIO_InitStructure);   
回复

使用道具 举报

3

主题

2165

帖子

0

精华

资深版主

Rank: 8Rank: 8

积分
5759
金钱
5759
注册时间
2013-11-22
在线时间
1208 小时
发表于 2016-5-19 23:45:37 | 显示全部楼层
分开设置上拉GPIO_PuPd_UP,下拉GPIO_PuPd_DOWN
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-2-27 09:34

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表