LPC1549 how to implement a 32-bit millisecond timer?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1549 how to implement a 32-bit millisecond timer?

580 Views
anmolthind
Contributor I

Hi,

I'm trying to figure out how to make timer which increments every millisecond for timestamping purposes, unfortunately the SCT prescalers are only 8 bit and can only use system clock as the source so it's not possible to use a single SCT without setting sysclock super low. I was wondering if you could chain two SCT's together to implement it? The documentation mentions chaining but I have no idea how to go about doing it.

Any help would be appreciated

Labels (1)
0 Kudos
1 Reply

334 Views
volkeroth
Contributor II

Do you need that timestamp for a capture event? If so, you could use the SCT event to trigger a DMA transfer from a millisecond counter that you created by other means.

The simplest way to create that would be to use e.g. the RIT to create a millisecond interrupt and just increase a 32bit value there. If you need a more accurate approach, the RTC can be configured to 1kHz "high resolution" timing. I haven't really looked into the details though. I kinda think that in 1ms mode, the timer is only 16bit.

Last but not least it should be possible to use an SCT input as clock source through CONFIG.CLKMODE (0x2 SCT input). Then you could use another SCT channel to create a 1kHz signal and route it to your SCT input used as clock.

0 Kudos