当前位置:网站首页>STM32GPIO口的工作原理
STM32GPIO口的工作原理
2022-07-07 23:23:00 【一骜】
stm32f4有7组IO口,每组有16个IO口,GPIO的的引脚与外部设备连接,可以实现与外部的通信,控制外部硬件,采集外部硬件数据的功能,与之对应的常见应用分别为串口,电机 ,ADC采集。
GPIO口的基本结构
每个GPIO口的内部都有这样一个电路图
GPIO有四种输入模式(浮空输入,上拉输入,下拉输入,模拟输入),四种输出模式(开漏输出,开漏复用输出,推挽输出,推挽复用输出)。
此外,GPIO在输出模式下支持三种翻转速度2MHz,10MHz,50MHz,在不要求转换速度很快的情况下,一般采用低速,目的是节省功耗。但是在通信协议中一般采用50MHz,
GPIO_Mode_AIN 模拟输入
GPIO_Mode_IN_FLOATING 浮空输入
GPIO_Mode_IPD 下拉输入
GPIO_Mode_IPU 上拉输入
GPIO_Mode_Out_OD 开漏输出
GPIO_Mode_Out_PP 推挽输出
GPIO_Mode_AF_OD 复用开漏输出
GPIO_Mode_AF_PP 复用推挽输出
浮空输入
浮空输入模式下,外部电平直接输入数据寄存器,也就是说,IO口输入多少的电平,CPU会读取多少的电平,在引脚悬空,没有信号输入的前提下,读取端口的电平不确定。
上拉输入
上拉输入模式下,IO口的数据信号直接进入数据寄存器,但在没有输入情况下,输入端电平保持在高电平。
下拉模式
下拉输入模式下,IO口的数据信号直接进入数据寄存器,但在没有输入情况下,输入端电平保持在低电平。
模拟输入
在模拟模式下,IO口的模拟信号(电压信号)直接模拟输入到片上外设模块。
如何选择IO口模式
浮空输入_IN_FLOATING ——浮空输入,可以做KEY识别,RX1
带上拉输入_IPU——IO内部上拉电阻输入
带下拉输入_IPD—— IO内部下拉电阻输入
模拟输入_AIN ——应用ADC模拟输入,或者低功耗下省电
开漏输出_OUT_OD ——IO输出0接GND,IO输出1,悬空,需要外接上拉电阻,才能实现输出高电平。当输出为1时,IO口的状态由上拉电阻拉高电平,但由于是开漏输出模式,这样IO口也就可以由外部电路改变为低电平或不变。可以读IO输入电平变化,实现C51的IO双向功能
推挽输出_OUT_PP ——IO输出0-接GND, IO输出1 -接VCC,读输入值是未知的
复用功能的推挽输出_AF_PP ——片内外设功能(I2C的SCL、SDA)
复用功能的开漏输出_AF_OD——片内外设功能(TX1、MOSI、MISO.SCK.SS)
边栏推荐
- 2、TD+Learning
- The Ministry of housing and urban rural development officially issued the technical standard for urban information model (CIM) basic platform, which will be implemented from June 1
- How to write mark down on vscode
- Serial port receives a packet of data
- Chapter IV decision tree
- Get started quickly using the local testing tool postman
- 6. Dropout application
- Recommend a document management tool mendely Reference Manager
- 130. Zones environnantes
- Kaptcha generates verification code on Web page
猜你喜欢
[deep learning] AI one click to change the sky
2022 low voltage electrician examination content and low voltage electrician simulation examination question bank
130. Zones environnantes
Talk about smart Park
跨模态语义关联对齐检索-图像文本匹配(Image-Text Matching)
Cs5261type-c to HDMI alternative ag9310 | ag9310 alternative
USB type-C mobile phone projection scheme | USB type-C docking station scheme | TV / projector type-C converter scheme | ag9300ag9310ag9320
【深度学习】AI一键换天
Use "recombined netlist" to automatically activate eco "APR netlist"
Chapter XI feature selection
随机推荐
Capstone/cs5210 chip | cs5210 design scheme | cs5210 design data
2022 refrigeration and air conditioning equipment operation examination questions and refrigeration and air conditioning equipment operation examination skills
For the first time in China, three Tsinghua Yaoban undergraduates won the stoc best student thesis award
Vscode is added to the right-click function menu
50MHz generation time
Y59. Chapter III kubernetes from entry to proficiency - continuous integration and deployment (III, II)
2022 examination for safety production management personnel of hazardous chemical production units and new version of examination questions for safety production management personnel of hazardous chem
A speed Limited large file transmission tool for every major network disk
Authorization code of Axure rp9
Su embedded training - Day6
Transportation, new infrastructure and smart highway
2022 high altitude installation, maintenance and demolition examination materials and high altitude installation, maintenance and demolition operation certificate examination
Ag9310 for type-C docking station scheme circuit design method | ag9310 for type-C audio and video converter scheme circuit design reference
2022 low voltage electrician examination content and low voltage electrician simulation examination question bank
2022 safety officer-a certificate free examination questions and safety officer-a certificate mock examination
6. Dropout application
How to get the first and last days of a given month
利用GPU训练网络模型
Common configurations in rectangular coordinate system
Solve the error: NPM warn config global ` --global`, `--local` are deprecated Use `--location=global` instead.