Hi all, I'm using Kinetis controller and ihave a question for lpt(low power timer). I'm using LPT as counter(counter and compare registers are 16-bit wide) and i need to count 32 bit value instead of 16 bit. can i cascaded the LPT?
Hi!
Let's say you have uint32_t count value. What you need to do is to split counting in two steps:
In the first step you configure LPTMR to run 65536 times slower to count (count & 0xFFFF0000) clock cycles. Then you disable prescaler to count the remaining time - the lower 16 bits of your count value.
Hi Sujai,
It is possible. You can configure both timers, start one timer at any moment and then start the second timer inside the interrupts of the first timer. E.g.
int main(void)
{
init_LPTMR0 ();
init_LPTMR1 ();
LPTMR0_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
while(1)
{
}
return 0;
}
void LPTimer0_IRQHandler(void)
{
LPTMR1_CSR |= LPTMR_CSR_TEN_MASK; //Turn on LPT and start counting
}
Best regards,
Carlos
Technical Support Engineer
Hi Sujai,
I am glad your problem was solved.
If you find our responses useful I encourage you to mark them as helpful or correct answer. This will help other members find the best answers as well.
Best regards,
Carlos
Technical Support Engineer