This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129DNCPDT: GPIO口(port N)作为输入引脚,读取的data值不对。

Part Number: TM4C129DNCPDT

void bsp_InitGPIO(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);

HWREG(GPIO_PORTN_BASE + GPIO_O_LOCK)=(HWREG(GPIO_PORTN_BASE + GPIO_O_LOCK))|0x4C4F434B; //解锁

//SW BIT0~BIT7  拨码开关输入的8个GPIO引脚
GPIOPinTypeGPIOInput(GPIO_PORTN_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5); //PN0~PN5
GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_3); //PQ3--output
GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_0); //PM0--output

HWREG(GPIO_PORTN_BASE + GPIO_O_CR)=(HWREG(GPIO_PORTN_BASE + GPIO_O_CR))|GPIO_LOCK_LOCKED; //

}