您的位置 首页 测评

第2天-S3C2440 GPIO

GeneralPurposeInputOutput(通用输入输出)简称为GPIO,或总线扩展器,利用工业标准I2C、SMBus或SPI接口简化了IO口的扩展。当微

General Purpose Input Output (通用输入/输出)简称为GPIO,或总线扩展器,使用工业规范I2C、SMBus或SPI接口简化了I/O口的扩展。当微操控器或芯片组没有满足的I/O端口,或当体系需求选用远端串行通讯或操控时,GPIO产品能够供给额定的操控和监督功用。

S3C2440A has 130 multi-functional input/output port pins and there are eight ports as shown below:
— Port A(GPA): 25-output port
— Port B(GPB): 11-input/out port
— Port C(GPC): 16-input/output port
— Port D(GPD): 16-input/output port
— Port E(GPE): 16-input/output port
— Port F(GPF): 8-input/output port
— Port G(GPG): 16-input/output port
— Port H(GPH): 9-input/output port
— Port J(GPJ): 13-input/output 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

从上面的信息能够看出,S3C2440芯片共有130个GPIO引脚,分为9组

关于GPIO的寄存器

1. GPxCON 寄存器
用于装备引脚功用。 Configure PORT A 与 PORT B~PORT H/J 在功用挑选上有所不同,GPACON 中每一位对应一根引脚,共 23 个引脚。当某位被设为 0 时分,相应引脚为 输出引脚。此刻咱们能够在GPADAT 中相应的写入 1或许 0 来让此引脚输出高电平或许低电平;当某位被设为1时,相应引脚为地址线或用于地址操控,此刻GPADATA无用。一般来说 GPACON 通常被设为 1 ,以便拜访外部器材。
PORT B~PORT H/J
在寄存器操作方面完全相同,GPxCON 中每两位操控一根引脚,
00 输入 01 输出
10 特别功用 11 保存不必
2. GPxDAT 寄存器
GPxDAT用于读写引脚,当引脚被设为输入时分,读此寄存器可知道相应引脚的电平状况高仍是低,当引脚被设为输出时分,写此寄存器的位,可令引脚输出高电平仍是低电平。
3. GPxUP寄存器
GPxUP寄存器某位为1的时分,相应管脚没有内部上拉电阻;为 0 时分 相应管脚有内部上拉电阻。
上拉电阻效果在于,当GPIO 引脚处于第三种状况时分,既不是输出高电平,也不是输出低电平。而是出现高阻态,相当于没有接芯片。它的电平状况由上下拉电阻决议。
S3C2440中关于寄存器的英文介绍如下:

PORT CONFIGURATION REGISTER (GPACON-GPJCON)
In S3C2440A, most of the pins are multiplexed pins. So, It is determined which function is selected for each pins.
The PnCON(port control register) determines which function is used for each pin.
If PE0 – PE7 is used for the wakeup signal in power down mode, these ports must be configured in interrupt mode.
PORT DATA REGISTER (GPADAT-GPJDAT)
If Ports are configured as output ports, data can be written to the corresponding bit of PnDAT. If Ports are configured
as input ports, the data can be read from the corresponding bit of PnDAT.
PORT PULL-UP REGISTER (GPBUP-GPJUP)
The port pull-up register controls the pull-up resister enable/disable of each port group. When the corresponding bit is
0, the pull-up resister of the pin is enabled. When 1, the pull-up resister is disabled.
If the port pull-up register is enabled then the pull-up resisters work without pin’s functional setting(input, output,
DATAn, EINTn and etc

关于怎么设定寄存器,请参阅芯片手册

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ceping/258551.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部