主题中讨论的其他器件: TM4C123
你好。
Q1> 按下 PA [2]至 PA[5]按钮时、无法从主()跳转至 ISR (ButtonKeyIntHandler)。
请解释错误的地方
此致、
Jame、Shin
ButtonKeyIntHandler ()
{
uint32_t ui32Ints;
ui32Ints = GPIOIntStatus (GPIO_Porta_base、true);
if (ui32Ints = GPIO_INT_PIN_2)
{
…
}
if (ui32Ints = GPIO_INT_PIN_3)
{
…
}
if (ui32Ints = GPIO_INT_PIN_4)
{
…
}
if (ui32Ints =GPIO_INT_PIN_5)
{
…
}
}
MAIN ()
{
。
//设置中断配置 GPIO PA[2]、PA[3]、PA[4];PA[5]
//
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA);
GPIOPadConfigSet (GPIO_Porta_base、GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5、 GPIO_Strength _8mA、GPIO_PIN_TYPE_STD_WPU);
GPIOIntTypeSet (GPIO_Porta_base、GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5、GPIO_FALLING_EDGE);
GPIOIntRegister (GPIO_Porta_base、ButtonKeyIntHandler);
//
// GPIO 提交控制 PA[5:2]、GPIO 锁定
//
HWREG (GPIO_PORta_base + GPIO_LOCK)= GPIO_LOCK_KEY;
HWREG (GPIO_PORta_base + GPIO_CR)|=(GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5);
…μ A。
GPIOIntEnable (GPIO_Porta_base、GPIO_INT_PIN_2|GPIO_INT_PIN_3|GPIO_INT_PIN_4|GPIO_INT_PIN_5);
while (1)
{
。
}
}