A PIT (periodic interrupt timer) is generally used for such work.
It is very easy to set up but does require the interrupt controller to also be set up correctly. It may be easier for you to start with a complete project (see the uTasker project which is free for non-commercial use). Below is the PIT0 code to configure a periodic interrupt (TICK_RESOLUTION would be 10 in your case) and then handle the interrupt, calling a function names fnRtmkSystemTick():
// calculate the settings//#define REQUIRED_MS ((1000/TICK_RESOLUTION)) // the TICK frequency we require in kHz#if TICK_RESOLUTION > 4 #if TICK_RESOLUTION > 64 #define TICK_DIVIDE (((BUS_CLOCK/2/32768) + REQUIRED_MS/2)/REQUIRED_MS) // the divide ratio required (32k prescaler assumed) #define PIT_PRESCALE PIT_PRESCALE_32K #else #define TICK_DIVIDE (((BUS_CLOCK/2/4096) + REQUIRED_MS/2)/REQUIRED_MS) // the divide ratio required (4k prescaler assumed) #define PIT_PRESCALE PIT_PRESCALE_4K #endif#else #define TICK_DIVIDE (((BUS_CLOCK/2/1048) + REQUIRED_MS/2)/REQUIRED_MS) // the divide ratio required (1k prescaler assumed) #define PIT_PRESCALE PIT_PRESCALE_1K#endif// TICK uses PIT 0//extern void fnStartTick(void){ PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD); // prepare for load PIT_PMR_0 = (TICK_DIVIDE - 1); // load interval value fnSetIntHandler(PIT0_VECTOR, (unsigned char *)_RealTimeInterrupt); IC_ICR_0_55 = TICK_INTERRUPT_PRIORITY; // define interrupt level and priority IC_IMRH_0 &= ~(PIT_0_PIF_INT_H); // unmask interrupt source IC_IMRL_0 &= ~(MASK_ALL_INT); // clear global mask PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD | PIT_PIE | PIT_EN); // start PIT with interrupt enabled}static __interrupt__ void _RealTimeInterrupt(void){ PIT_PCSR_0 = (PIT_PRESCALE | PIT_DBG | PIT_OVW | PIT_PIF | PIT_RLD | PIT_PIE | PIT_EN); // reset interrupt request flag fnRtmkSystemTick(); // operating system tick}