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??
Setting bit 1 in T0MCR will cause a reset on a MR0 match. You are able to set both bits (T0MCR = 0x03), ie causing a both an interrupt and TC to reset.
Yeah! Taht's right & I did it how you explained.
But I don't really understand how this schould help to reset the Interrupt.
We don't even know which processor. Note that the ARM is a processor core. There are many ARM processors out there with different interrupt controllers and timers.
I don't understand what you mean by resetting the interrupt. T0IR simply tells you what caused the timer 0 irq (mr0-3, cr0-3). Setting T0IR = 1 tells the device that you have acknowledged that a MR0 irq has taken place.
Setting bit 1 in T0MCR resets the timer back to 0 when you have a MR0 match. This allows you to have another irq the next time the timer = MR0.
(I assume your referencing a lpc21xx device, else we may be looking at 2 different things)
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.
Jeah.
I know Drew. But when I'm doing T0IR = 1, the processor will do nothing. The Interrupt will not 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.
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; }