LPC1549 how to implement a 32-bit millisecond timer?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC1549 how to implement a 32-bit millisecond timer?

551件の閲覧回数
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

ラベル(1)
0 件の賞賛
1 返信

305件の閲覧回数
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 件の賞賛