新聞中心

        第2天-S3C2440 GPIO

        作者: 時(shí)間:2016-11-26 來(lái)源:網(wǎng)絡(luò) 收藏
        General Purpose Input Output (通用輸入/輸出)簡(jiǎn)稱為GPIO,或總線擴(kuò)展器,利用工業(yè)標(biāo)準(zhǔn)I2C、SMBus或SPI接口簡(jiǎn)化了I/O口的擴(kuò)展。當(dāng)微控制器或芯片組沒有足夠的I/O端口,或當(dāng)系統(tǒng)需要采用遠(yuǎn)端串行通信或控制時(shí),GPIO產(chǎn)品能夠提供額外的控制和監(jiān)視功能。

        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

        本文引用地址:http://www.104case.com/article/201611/321983.htm

        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個(gè)GPIO引腳,分為9組

        關(guān)于GPIO的寄存器

        1. GPxCON 寄存器
        用于配置引腳功能。 Configure PORT A 與 PORT B~PORT H/J 在功能選擇上有所不同,GPACON 中每一位對(duì)應(yīng)一根引腳,共 23 個(gè)引腳。當(dāng)某位被設(shè)為 0 時(shí)候,相應(yīng)引腳為 輸出引腳。此時(shí)我們可以在GPADAT 中相應(yīng)的寫入 1或者 0 來(lái)讓此引腳輸出高電平或者低電平;當(dāng)某位被設(shè)為1時(shí),相應(yīng)引腳為地址線或用于地址控制,此時(shí)GPADATA無(wú)用。一般而言 GPACON 通常被設(shè)為 1 ,以便訪問(wèn)外部器件。
        PORT B~PORT H/J
        在寄存器操作方面完全相同,GPxCON 中每?jī)晌豢刂埔桓_,
        00 輸入 01 輸出
        10 特殊功能 11 保留不用
        2. GPxDAT 寄存器
        GPxDAT用于讀寫引腳,當(dāng)引腳被設(shè)為輸入時(shí)候,讀此寄存器可知道相應(yīng)引腳的電平狀態(tài)高還是低,當(dāng)引腳被設(shè)為輸出時(shí)候,寫此寄存器的位,可令引腳輸出高電平還是低電平。
        3. GPxUP寄存器
        GPxUP寄存器某位為1的時(shí)候,相應(yīng)管腳沒有內(nèi)部上拉電阻;為 0 時(shí)候 相應(yīng)管腳有內(nèi)部上拉電阻。
        上拉電阻作用在于,當(dāng)GPIO 引腳處于第三種狀態(tài)時(shí)候,既不是輸出高電平,也不是輸出低電平。而是呈現(xiàn)高阻態(tài),相當(dāng)于沒有接芯片。它的電平狀態(tài)由上下拉電阻決定。
        S3C2440中關(guān)于寄存器的英文介紹如下:

        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

        關(guān)于如何設(shè)定寄存器,請(qǐng)參考芯片手冊(cè)



        關(guān)鍵詞: S3C2440GPI

        評(píng)論


        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 黎川县| 江达县| 富源县| 集贤县| 金寨县| 长武县| 泰来县| 清丰县| 黄陵县| 旌德县| 金寨县| 沂南县| 荆门市| 临清市| 屯留县| 西乌珠穆沁旗| 顺义区| 纳雍县| 从化市| 光泽县| 积石山| 万源市| 泗洪县| 垣曲县| 田林县| 鸡西市| 阳新县| 报价| 泸溪县| 绥德县| 内丘县| 铜鼓县| 桃园市| 东乌珠穆沁旗| 共和县| 景东| 本溪| 北川| 武威市| 高邑县| 额济纳旗|