GPIO interrupt rising/falling edge

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

GPIO interrupt rising/falling edge

跳至解决方案
6,666 次查看
fasihahmed
Contributor IV

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

标签 (1)
1 解答
6,514 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

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)

pastedImage_25.png

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:

pastedImage_26.png

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

在原帖中查看解决方案

2 回复数
6,515 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

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)

pastedImage_25.png

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:

pastedImage_26.png

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

6,514 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

pastedImage_1.png

GPIOC4 pin interrupt fonfiguration:

pastedImage_2.png

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