当前位置:网站首页>GPIO初识
GPIO初识
2022-06-23 08:58:00 【七月流星.】
1,GPIO的七个寄存器:
两个32位配置寄存器:GPIOx_CRL,GPIOx_CRH (x=A,B,C,D,E)
两个32位数据寄存器:GPIOx_IDR,GPIOx_ODR
一个16位置位/复位寄存器:GPIOx_BSRR
一个16位复位寄存器:GPIOx_BRR
一个32位锁定寄存器:GPIOx_LCKR
2,GOIO操作:
输出驱动电路:
内部(写操作)-->位设置/复位寄存器-->输出数据寄存器-->输出控制--
输入驱动电路:
模拟输入时,上拉和下拉开关都断开,浮空输入
通用(GPIO)和复用(AFIO)功能
输入:输入浮空,输入上拉,输入下拉,模拟输入
输出:开漏输出,推挽输出,推挽式复用输出,开漏复用
3,GPIO端口位配置
CRL控制寄存器,两位控制一个引脚,CRL控制低八位,CRH控制高八位
IDR输入数据寄存器,只使用低16个位的数据,每一位控制一个引脚
ODR输出数据寄存器功能同上,高16位功能保留。
GPIO寄存器操作:
1.引脚输出高/低电平
GPIOA->CRL = 0x33;
GPIOA->ODR = 0x0000; //0
GPIOA->ODR = 0x3; //1
2.GPIOA_Pin_0的状态随GPIOA_Pin_8的状态变化
1.GPIOA的0脚作为输出,50MHZ;GPIOA的8脚作为输入
2.GPIOA_Pin_0 == GPIOA_Pin_8
GPIOA->CRL = 0x03; //0脚推挽式输出,50MHZ
GPIOA->CRH = 0x04; //8脚浮空输入
while(1)
{
if((GPIOA->IDR&0x0100) == 0x0100)
GPIOA->ODR = 0x01;
else
GPIOA->ODR = 0x00;
}
边栏推荐
- 线性表(SequenceList)的顺序表示与实现----线性结构
- Leetcode topic analysis 3sum closest
- Unity grid programming 06
- 6、 Web Architecture Design
- [learning resources] understand and love mathematics
- The sliding window of the force button "step by step" (209. sub array with the smallest length, 904. fruit basket)
- 【云原生 | Kubernetes篇】Kubernetes原理与安装(二)
- An idea of using keep alive to cache data in vue3 form pages
- Why is the easycvr Video Fusion platform offline when cascading with the Hikvision platform? How to solve it?
- 986. Interval List Intersections
猜你喜欢

【活动报名】SOFAStack × CSDN 联合举办开源系列 Meetup ,6 月 24 日火热开启

Linux MySQL installation

3. caller service call - dapr

Community article | mosn building subset optimization ideas sharing

The sliding window of the force button "step by step" (209. sub array with the smallest length, 904. fruit basket)

自定义标签——jsp标签增强

Mysql 数据库入门总结

636. Exclusive Time of Functions

Simple student management

Typora设置图片上传服务
随机推荐
A method of realizing video call and interactive live broadcast in small programs
Typora设置图片上传服务
670. Maximum Swap
Leetcode topic analysis group anagrams
6、 Web Architecture Design
线性表(LinkList)的链式表示和实现----线性结构
Custom tags - JSP tag enhancements
125. Valid Palindrome
node request模块cookie使用
(resolved) difference between leftmost prefix and overlay index
65. Valid Number
C#之Lambda不得不说的用法
Combination sum III of leetcode topic analysis
Flink错误--Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered “time“
[qnx hypervisor 2.2 user manual]6.1 using the QNX hypervisor system
Flutter achieves the effect of selecting seats in the cinema!
297. Serialize and Deserialize Binary Tree
3. caller service call - dapr
Android kotlin coroutines KTX extension
3、 System analysis and design