This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reset Timer_0 Interrupt

Hi!

I wanna reset an Timer0 Interrupt with this Code:

void isr_TIMER0_INT (void) __irq {
T0IR = 1;

// do code
VICVectAddr = 0;
}

But the Problem is, MR0 Interrupt in T0IR won't be resettet. Thus, I'll never receive a 2nd Interrupt.

Has anyone an idea??

Parents Reply Children
  • Oh jeah...

    That's right. It's the LPC2368. Timer0_Match-Register-0

    I've done T0IR=1. But the Interrupt won't be resettet.

  • What exactly are you expecting to happen?

    When a timer0 interrupt occurs, a bit is set in the t0IR register. This allows you to determine which of the 8 possible conditions caused the timer0 irq so you can handle it accordingly. When you write this register (T0IR=1) you are clearing the corresponding bits, telling the cpu that you have "handled" that irq condition.

    If you dont clear these bits, the VIC will think that you haven't "handled" all of the interrupts and call the irq again immediately (at least in the simulator).

    You should check out the Timer and and VIC peripherals in the simulator. Simulating this with the peripheral windows open will help you understand what is going on. You can also check out the MCB2300 blinky example, it uses timer0 interrupts on a lpc23xx.

  • Hi Drew!
    I've done that. If I hadn't I wouldn't start a thread.

    My Problem is:

    When I'm writing: T0IR = 1;

    The Interrupt in Timer0_MatchRegister_0, the corresponding bit, isn't cleared.

    They're is still T0IR = 0x01

  • What are your values for T0CCR and T0MCR? There are 8 different conditions that can cause a timer0 irq, and writing a 1 will only clear one of them.

    Have you tried the simulator yet? You can set a break point in the isr and watch T0IR variable and the MR/CR interrupt flags in the Timer0 peripheral window.

    Please give details when describing what you have done and the results you receive.

  • Hi!

    I succeeded ...

    without an TOIR rest: void isr_TIMER0_INT (void) __irq { T0IR = 1; // code VICVectAddr = 0; }

    without the TOIR reset:
    void isr_TIMER0_INT (void) __irq { // code VICVectAddr = 0; T0IR = 1; }