新聞中心

        STM32F051R8T6的GPIO配置

        作者: 時(shí)間:2016-11-10 來(lái)源:網(wǎng)絡(luò) 收藏
        GPIO輸入模式

        void GPIO_Configuration(void)
        {
        GPIO_InitTypeDef GPIO_InitStructure;

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

        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        GPIO_Init(GPIOC, &GPIO_InitStructure);
        }

        GPIO輸出模式

        void GPIO_Configuration(void)
        {
        GPIO_InitTypeDef GPIO_InitStructure;

        RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);


        /************************* LED *************************/
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
        GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
        GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
        GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
        GPIO_Init(GPIOD, &GPIO_InitStructure);
        GPIO_WriteBit(GPIOD, GPIO_Pin_2, Bit_RESET);
        }



        關(guān)鍵詞: STM32F051R8T6GPIO配

        評(píng)論


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

        關(guān)閉
        主站蜘蛛池模板: 冷水江市| 罗田县| 遂宁市| 绥芬河市| 定州市| 洱源县| 定兴县| 高淳县| 休宁县| 水富县| 黔西县| 革吉县| 汕头市| 惠州市| 惠安县| 阿巴嘎旗| 泉州市| 景宁| 东兴市| 舒城县| 夏河县| 界首市| 秀山| 新田县| 肇源县| 邯郸县| 龙山县| 察雅县| 和林格尔县| 成安县| 英德市| 日喀则市| 沭阳县| 武邑县| 杭锦旗| 凤台县| 文登市| 古田县| 柘荣县| 班戈县| 余庆县|