liuxy67 发表于 2024-4-24 14:25

N32G435IO口做为输入读取值为0

经朋友推荐使用了国民技术的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\2PA5\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

}
页: [1]
查看完整版本: N32G435IO口做为输入读取值为0