Hi guys,
I'm trying to set up a timer that triggers an ISR every 200 milliseconds. I'm a little less familiar with timers but after reading through the datasheet and the tivaware library I think this is a periodic timer? To get it to trigger every 200 ms I set the Load to 200 * TicksPerMS, which I've pound defined as 40000 since I'm using a 40 mhz clock. I'm using that the value in the TimerLoadSet command is the value you want in ticks. Do I need to make the timer count up to this value, or will it count down from this loaded value and then automatically start again?
I've got a few lines of code which I think is enough to get me started. If I'm making any big errors please let me know, thanks.
void isr_timer(void){
TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
//insert code to poll the accelerometer
}
void timer_init(void){
TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); //Set as periodic timer counting up ( I think)
TimerLoadSet(TIMER0_BASE, TIMER_A, 200*TicksPerMS); //
TimerIntRegister(TIMER0_BASE, TIMER_A, isr_timer);
TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
TimerEnable(TIMER0_BASE, TIMER_A);
}