GetTickCount- System 'uptime' in milliseconds implementation

I had some issues with the clock(); function - i.e. not being able to reset it / reconfigure it on clock change, so I wrote a new function that uses the LPC1768 System Tick Timer to count ticks. It's a pretty handy function for benchmarking, debouncing interrupts, etc. You might know this as millis() from ardunio. The counter is a 32-bit unsigned integer, so it'll reset - "rollover" after 50 days automatically.



You need to init the counter first by calling GetTickCount_Start(). The tick counter has a resolution of 10ms as is in milliseconds.


void GetTickCount_Start(void)

Starts the counter.

void GetTickCount_Stop(void)

Stops the counter.

void GetTickCount_Reset(void)

Resets the counter.

unsigned int GetTickCount(void)

Returns the current value of the counter. 


You need to log in to post a comment