打印
[N32G43x]

N32G435IO口做为输入读取值为0

[复制链接]
87|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
liuxy67|  楼主 | 2024-4-24 14:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
经朋友推荐使用了国民技术的N32G435CBL7芯片,用PA4,PA5,PB4,PB5,PB6做为基本IO输入口,结果是除了PA4为1,其它均为0,请专家指导。
void EXT_Key_Config(void)
{
    GPIO_InitType GPIO_InitStructure;
//    EXTI_InitType EXTI_InitStructure;

    /* Enable GPIO clock */
    RCC_EnableAPB2PeriphClk(KEY_INT_GPIO_CLK, ENABLE);
   

    /*--------------------------KEY1\2  PA5\PA6 Configuration-----------------------------*/
    /* Initialize GPIO_InitStructure */
    GPIO_InitStruct(&GPIO_InitStructure);
    /* Configure KEY1 as input floating */
    GPIO_InitStructure.Pin       = KEY_INT_GPIO_PIN;        //PA5|PA6
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Input;       
                GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
    GPIO_InitPeripheral(KEY_INT_GPIO_PORT, &GPIO_InitStructure);        //PA

        /*--------------------------PAUSE Configuration PB4,PB5,PB6-----------------------------*/
    /* Initialize GPIO_InitStructure */
    RCC_EnableAPB2PeriphClk(PAUSE_INT_GPIO_CLK, ENABLE);                //PB
   // RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_AFIO, ENABLE);

                GPIO_InitStruct(&GPIO_InitStructure);
    /* Configure PAUSEN as input floating */
    GPIO_InitStructure.Pin       = PAUSE_INT_GPIO_PIN;                //PB4|PB5|PB6
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Input;
                GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;               
    GPIO_InitPeripheral(PAUSE_INT_GPIO_PORT, &GPIO_InitStructure);        //PB

}

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

3

帖子

0

粉丝