完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
博主以循循渐进的方式理解
总结如下: GPxCON 配置引脚功能 一般把引脚配置为输出模式进行对外设的控制 GPxDAT 设置引脚高低电平 一般设置为高/低电平 解释如下: OVERVIEW: 总览 S3C2451 has 174 multi-functional input/output port pins and there are 12 ports as shown below: S3C2451具有174个多功能输入/输出端口引脚,如下所示12个端口 • Port A(GPA) : 27-output port // 端口A 下的0---27这28个引脚仅有输出功能 • Port B(GPB) : 11-input/output port//端口B 下的0---27这28个引脚既有输出功能又有输入功能 ...... • Port L(GPL) : 15-input/output port • Port M(GPM) : 2-input port Each port can be easily configured by software to meet various system configurations and design requirements. 每个端口都可以通过软件轻松地配置,以满足不同的系统配置和设计要求 You have to define which function of each pin is used before starting the main program. If a pin is not used for multiplexed functions, the pin can be configured as I/O ports. 在启动主程序之前,必须定义每个pin的功能。如果该引脚没被用作多路复用,则该引脚可以配置为I / O端口 那么问题来了,如何配置引脚功能? 2 PORT CONTROL DESCRIPTIONS: 端口控制描述 2.1 PORT CONFIGURATION REGISTER (GPACON-GPMCON) 端口配置寄存器(GPACON-GPMCON) In S3C2451, most of the pins are multiplexed pins. So, It is determined which function is selected for each pins. The GPxCON(port control register) determines which function is used for each pin. GPxCON(端口控制寄存器)决定哪个引脚使用什么功能。 2.2 PORT DATA REGISTER (GPADAT-GPMDAT) 端口数据寄存器(GPADAT-GPMDAT) If ports are configured as output ports, data can be written to the corresponding bit of GPxDAT. If Ports are configured as input ports, the data can be read from the corresponding bit of GPxDAT. 如果将端口配置为输出端口,则S3C2451可以将数据写入相应的GPxDAT中。如果端口是 配置为 输入 端口,则S3C2451可以从相应的GPxDAT中 读取 数据 . 那么问题来了,何为输入何为输出? 引脚配置为输入是指处理器通过寄存器采集引脚状态 比如,通过GPIOB的某个引脚采集按键Key1是否按下 引脚配置为输出是指处理器通过配置寄存器来给引脚赋值 比如,通过配置GPIOB的某个引脚来控制LED灯的亮灭 回过头来,看GPxCON 、GPxDAT的配置方法(暂且只谈这俩,因为常用) 以GPB为例 3.2 PORT B CONTROL REGISTERS (GPBCON, GPBDAT, GPBUDP, GPBSEL) Register AddressR/W Description Reset Value GPBCON 0x56000010R/W Configures the pins of port B(配置端口B的引脚) 0x0 GPBDAT 0x56000014R/W The data register for port B (用于端口B的数据寄存器)0x0 GPBUDP 0x56000018 R/W Pull-up/down control register for port B0x00154555 GPBSEL 0x5600001cR/W Selects the function of port B 0x1 GPBCON Bit Description Reserved [31:22] Reserved GPB10 [21:20]//两bit控制一个引脚00 = Input01 = Output 10 = nXDREQ[0] 11 = XDREQ[0] GPB9 [19:18] 00 = Input 01 = Output 10 = nXDACK[0] 11 = XDACK[0] GPB8 [17:16] 00 = Input 01 = Output 10 = nXDREQ[1] 11 = XDREQ[1] GPB7 [15:14] 00 = Input 01 = Output 10 = nXDACK[1] 11 = XDACK[1] GPB6 [13:12] 00 = Input 01 = Output 10 = nXBREQ 11 = XBREQ GPB5 [11:10] 00 = Input 01 = Output 10 = nXBACK 11 = XBACK GPB4//特殊 [9:8] 00 = Input 01 = Output 10 = TCLK 11 = reserved GPB3 [7:6] 00 = Input 01 = Output 10 = TOUT3 11 = reserved GPB2 [5:4] 00 = Input 01 = Output 10 = TOUT2 11 = reserved GPB1 [3:2] 00 = Input 01 = Output 10 = TOUT1 11 = reserved GPB0 [1:0] 00 = Input 01 = Output 10 = TOUT0 11 = reserved GPBDAT Bit Description Reserved(预留位) [31:11] Reserved(未定义的值) GPBDAT [10:0] [10:0] When the port is configured as input port, the corresponding bit is the pin state. When the port is configured as output port, the pin state is the same as the corresponding bit. When the port is configured as functional pin, the undefined value will be read. 当端口被配置为输入端口时,相应的位就是引脚的状态。当端口被配置为输出端口时,引脚的状态就是相应的位。当端口被配置为功能引脚时未定义的值将被读取。 原作者:识海拾贝 |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
【米尔-国产瑞芯微RK3568开发板试用体验】评测一 系统配置
1259 浏览 0 评论
1448 浏览 0 评论
2604 浏览 1 评论
如何配置Linux操作系统设备树让我的开发板可以将板子上的GPIO接口用作 I2S输出??
2808 浏览 1 评论
1672 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-9-1 20:19 , Processed in 0.493923 second(s), Total 40, Slave 33 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191