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

LPC2129 timer0

i am using LPC2129,i need to program for capture , pwm and 1sec delay all using timer 0,how to use an single timer for those things...

Is there any manuals gave answer for this means give me a URL..

Parents Reply Children
  • Not sure what you are saying.

    Did you not find the user manual, or do you find chapter 15 of the manual no good?

  • Do you mean that "I need to control the timing for A , B and C, all using timer0, how to use an single timer for those things".

    If so, how about use several counters in the timer0 ISR?

    void Timer0Handler (void) __irq
    {
        timer0_counter++;
    
        if ( timer_A != 0 )
            timer_A--;
    
        if ( timer_B != 0 )
            timer_B--;
    
        if ( timer_C != 0 )
            timer_C--;
    
        T0IR = 1;                   /* clear interrupt flag */
        VICVectAddr = 0;            /* Acknowledge Interrupt */
    }
    
    

    In your application, check if the counters of A/B/C become 0; if it is 0 "already", then do something and reset the counter.

    The disadvantage is, it is not precise. Maybe someone else knows a better way. :)

  • Note that each timer has multiple compare/match registers, so it can generate interrupts or toggle a pin at different phases of the countdown.