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.

external interrupt trigger on both rising and falling edge

Hello all, happy thanks giving!

I have an external signal and I have set it to trigger on both rising and falling edges, but I want to set different actions, do Action A for rising edge

do Action B for falling edge

Is this possible?

THanks

Sandhya

  • Hi Sandhya,

    Sandhya Jetti said:

    do Action A for rising edge

    do Action B for falling edge

    Is this possible?

    Offcourse, it is very much possible using external interrupts.

    Regards,

    Gautam

  • Thanks for your reply Gautam

    Is there a flag or register set when it is triggered on rising edge and a different flag when triggered on falling edge?

  • Sandhya Jetti said:
    Is there a flag or register set when it is triggered on rising edge and a different flag when triggered on falling edge?

    Refer External Interrupts section in SysCtrl and Interrupts User manual of your device. Also, here are the options:

    Regards,

    Gautam

  • I know these registers Gautam, but what I am asking is how to know specifically if it triggers on rising edge and falling edge. I can read the polarity bit but it only tells me that the value is 3 which is trigger on both edges.

        EALLOW;
        GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 0;                 // GPIO
        GpioCtrlRegs.GPADIR.bit.GPIO7 = 0;                  // input
        GpioCtrlRegs.GPAQSEL1.bit.GPIO7 = 0;                // XINT1 Synch to SYSCLKOUT only
        GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 7;              // XINT1 is GPIO7
        EDIS;

        XIntruptRegs.XINT1CR.bit.POLARITY = 3;              // Rising edge interrupt and falling edge
        XIntruptRegs.XINT1CR.bit.ENABLE = 1;                // Enable XINT1

    __interrupt void xint1_isr(void)
    {
        //Do Action A on rising edge

       //Do Action B on falling edge

      
            PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
    }

    Thanks

    Sandhya

  • Sandhya,,

    Why not read the value of the GPIO inside of the ISR? Since the GPIO is configured as an input, the state of the pin will be reflected in the GPADAT register.

    if(GpioDataRegs.GPADAT.bit.GPIO7 == 1)
         //Do Action A on rising edge
    else if(GpioDataRegs.GPADAT.bit.GPIO7 == 0)
         // Do Action B on falling edge

    -Mark

  • Simple and great idea Mark!!! It works, too bad I didn't think it myself :)

    But thanks a lot :)

    -Sandhya