How to set GPIO (input) interrupt to be triggered based on rising/falling edge or steady state signal?
Im using GCT, code warrior 10.6, DSC MC56F82748
Solved! Go to Solution.
Hi, Fasih,
As you know that all the GPIO pins of MC56F827xx can be used to trigger interrupt, for the detailed inf, pls refer to the section:
34.2.6 GPIO Interrupt Enable Register (GPIOx_IENR)
34.2.7 GPIO Interrupt Polarity Register (GPIOx_IPOLR)
The register GPIOx_IPOLR can set up falling/rising edge to trigger interrupt of GPIO pins.
This is the interrupt vector table for MC56F827xx:
There is only one interrupt vector table for 16 GPIO pins, so in the ISR, you have to check which GPIO pin leads to the interrupt by checking the GPIO Interrupt Pending Register.
I will try to develop an example code based on GCT tools.
BR
XiangJun Rong
Hi, Fasih,
As you know that all the GPIO pins of MC56F827xx can be used to trigger interrupt, for the detailed inf, pls refer to the section:
34.2.6 GPIO Interrupt Enable Register (GPIOx_IENR)
34.2.7 GPIO Interrupt Polarity Register (GPIOx_IPOLR)
The register GPIOx_IPOLR can set up falling/rising edge to trigger interrupt of GPIO pins.
This is the interrupt vector table for MC56F827xx:
There is only one interrupt vector table for 16 GPIO pins, so in the ISR, you have to check which GPIO pin leads to the interrupt by checking the GPIO Interrupt Pending Register.
I will try to develop an example code based on GCT tools.
BR
XiangJun Rong
GPIOC4 pin interrupt fonfiguration:
unsigned int flag=0x01;
#pragma interrupt on
void GPIOC4_ISR(void)
{
//clear the GPIOC4 pending register
ioctlGPIO_CLEAR_EDGE_SENSITIVE_INT_FLAG(GPIO_C,0x10);
//toggle GPIOE0
if(flag)
{
ioctlGPIO_SET_PIN(GPIO_E,0x01);
}
else
{
ioctlGPIO_CLEAR_PIN(GPIO_E,0x01);
}
flag^=0x01;
}
#pragma interrupt off