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.

Issue with disabling Timer0 Interrupt

Guru 19935 points
Other Parts Discussed in Thread: CONTROLSUITE

Hello,

I want to disable Timer's 0 interrupt while performing a small amount of code, i.e.

CpuTimer1Regs.TCR.bit.TIE = 0
Some Code
CpuTimer1Regs.TCR.bit.TIE = 1

However, if the timer wraps around during the execution of some code, the ISR won't be called after re-enabling the interrupt.

Disabling the the PIE doesn't work either, i.e.

PieCtrlRegs.PIEIER1.bit.INTx7=0
Some Code
PieCtrlRegs.PIEIER1.bit.INTx7=1

because SEQ1INT will be called if the interrupt occurs during the execution of some code.


What am I missing?

Stephen

 

  • Hi Stephen,

    CpuTimer1Regs.TCR.bit.TIE = 0
    Some Code
    CpuTimer1Regs.TCR.bit.TIE = 1

    The above code should do the trick. I don't know why it isn't working for you. I would like you to check the same with cpu_timer example code available in controlSuite.
    Regards,
    Gautam
  • Hello Stephen,

    stevenh said:
    CpuTimer1Regs.TCR.bit.TIE = 0 Some Code CpuTimer1Regs.TCR.bit.TIE = 1

    Shouldn't it be:

    CpuTimer0Regs.TCR.bit.TIE = 0 // Disable timer 0

    Some code

    CpuTimer0Regs.TCR.bit.TIE = 1 // Enable timer 0

    if you want to stop timer 0.

    Best regards,

    Maria