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.

TMS320F28335: TMS320F28335 external interrupt timer

Part Number: TMS320F28335

Hello,

I need to use the external interrupt counter (XINT1CTR) in my code for if-else statement. I am setting and clearing status of GPIO pin (configured as an output) based on status of XINT1CTR. Can anyone help ?Thanks in advance.

interrupt void xint1_isr(void)
{
counterxint++ ;

GpioDataRegs.GPASET.bit.GPIO30=1;

if (XINT1CTR>500)   // i need to use XINT1CTR to switch the status of GPIO30
{
GpioDataRegs.GPACLEAR.bit.GPIO30=1;

}


PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

EINT;


}

Regards

Nikhil

  • Hi Nikhil,

    To get the value of the interrupt counter on your device you would use

    XIntruptRegs.XINT1CTR

    So your statement would look something like:

    if(XIntruptRegs.XINT1CTR > 500)

    You can reference DSP2833x_XIntrupt.h or your device's user guide for more information.  See page 138.

    Regards,

    Kris

  • Hello Kris,

    I tried what you had told, but the status of GPIO pin did not change. It was set to 1 only. Also, I tried to find this register in the Pdf, could'nt find it.


    Regards
    Nikhil
  • Did you look on page 138 as mentioned?

    The counter is reset when the event occurs. It will not be 500 by the time that statement is executed in the ISR so the GPIO is not being cleared.
  • Hello Kris,

    I looked at the Page 138 as you mentioned. The XINT1CTR counter should not be cleared as long as it is not exiting the interrupt . So, when (counterxint<500)...GPIO30 = 3.3V and when (counterxint>500)...GPIO30 = 0V

    interrupt void xint1_isr(void)
    {


    GpioDataRegs.GPASET.bit.GPIO30=1;

    counterxint = XIntruptRegs.XINT1CTR;

    while (counterxint>500)
    {

    GpioDataRegs.GPACLEAR.bit.GPIO30=1;

    }

    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

    EINT;

    }

    Regards
    Nikhil