AnsweredAssumed Answered

LPC1769 Timer with 1ms Interrupt

Question asked by Thore T on Dec 27, 2016
Latest reply on Dec 28, 2016 by R Sudjian

Hi,

I need a Timer with 1 ms Interrupt.

 

Is it right that the LPC1769 works/counts with 96 MHz default?

 

        LPC_SC->PCONP |= 1 << 1; //Power up Timer

         LPC_SC->PCLKSEL0 |= 1<<1; //100 MHz
        LPC_SC->PCLKSEL0 |= 1<<1; //96 MHz
        LPC_TIM0->MR0 = 1000; //1ms
        LPC_TIM0->MCR |= 1 << 0; // Interrupt on Match0 compare
        LPC_TIM0->MCR |= 1 << 1; // Reset timer on Match 0
        LPC_TIM0->TCR |= 1 << 1; // Reset Timer0

 

        NVIC_EnableIRQ(TIMER0_IRQn);

 

 

I test it with LED ans set " LPC_TIM0->MR0 = 1000000; //1s". It seems that the LED blink 1s on and off

But I didn't understand the mathematik behind. How can I calculate 1 second with 96MHz und 1000000?

 

If I didn't set "LPC_SC->PCLKSEL0 |= 1<<1; //96 MHz" It should be the same, because I think 96 is default. But the LED blink different.

 

Could you explain me the calculation. With settins I nedd for 1ms , or for example for 1µs.

Outcomes