System time

Right now I have worked a long time on customizing a timer found in Kevin’s interrupt code to run indefinatly. I was wondering if anyone was able to get a system timer that runs fast enough to use for speed but slow enough so I can get and it doesn’t get too big to handle?
/I used a 1:1 pre-scalar for an interrupt and the controller freaked out, overflowing a 16 bit value every 26.6 ms/

Use a 32 bit timer :slight_smile:

In other words, when your 16 bit timer gets to big, add it to a 32 bit variable and reset it.

If 16 bits overflows in 26.6ms, 17 bits will overflow in 53.2ms, and so on.

32 bits shouldn’t overflow for 29 minutes.