TMR0 can be setup as a 8 or 16 bit counter clocked by your signal attached to the T0CKI-pin, you can choose rising or falling edge. It can also be set to interrupt on overflow so if you want to run your sub every 2000 counts simply preload the TMR0 register pair with 63536 and after 2000 counts an interrupt will occur. Remember to reload the TMR0 register pairs again, otherwise it'll keep counting from 0.
Or you can just read the count at your leasure if that's better/easier/more suitable. When using 16bit mode there's a special order in which you must read/write the TMR0 register pairs, make sure to read the datasheet.
Bookmarks