Veronica Amigo

Problem with the interruptions, mcf5329

Discussion created by Veronica Amigo on May 29, 2007
Latest reply on Jun 10, 2007 by Alexandre Kremer
Hello,
 
I have a problem with the interruptions. I want to generate an interruption each 1 ms with a timer (PIT0) and i want to turn on a led.
 
I believe that I make all good. I form the timer and I put the interruption,
 
void main
{
 init_interrupt_timers();
 mcf5xxx_irq_enable();
.........
}
 
void init_interrupt_timers (void)
{
    MCF_INTC1_ICR43 = MCF_INTC_ICR_IL(0x07);                      
    MCF_INTC1_IMRH &= ~MCF_INTC_IMRH_INT_MASK43;
 
 
    MCF_PIT0_PCSR = MCF_PIT_PCSR_PRE(0x1) |
                    MCF_PIT_PCSR_PIE      |
                    MCF_PIT_PCSR_RLD      |
                    MCF_PIT_PCSR_EN;
    MCF_PIT0_PMR = MCF_PIT_PMR_PM(0x9c3f);
 
    MCF_PIT1_PCSR = 0;
    MCF_PIT2_PCSR = 0;
    MCF_PIT3_PCSR = 0;
}
I prepare the interrupt vectors,
 
vectorA9: .long         _irq_handler
vectorAA: .long        _irq_handler
vectorAB: .long        _PITimer0_interrupt
vectorAC: .long       _irq_handler
vectorAD: .long       _irq_handler
vectorAE: .long      _irq_handler
 
and the interruption routine is the following one:
 
__interrupt__
void PITimer0_interrupt(void)
{
uint32 i;

 MCF_PIT0_PMR |= MCF_PIT_PCSR_PIF;
 
 MCF_GPIO_PODR_TIMER &= ~MCF_GPIO_PODR_TIMER_PODR_TIMER3;// apaga los leds
 for (i=0; i<0xFFFF; i++);

    MCF_GPIO_PODR_TIMER |= MCF_GPIO_PODR_TIMER_PODR_TIMER3; // enciende los leds
    for (i=0; i<0xFFFF; i++);
}
 
What I am making bad? Please, this is important, i need aid.
 
Thanks

Outcomes