Hi,
I have the Tiva C Series TM4C123G Launchpad. I have been trying to configure the Compare Match interrupt for Timer0 but am unable to make it fire. Will be glad if anyone can help me out. Below is my code.
void Timer0AIntHandler(void) { // Clear the timer interrupt TimerIntClear(TIMER0_BASE, TIMER_CAPA_MATCH); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1 ); } void timer_init0() { SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure( TIMER0_BASE, TIMER_CFG_PERIODIC ); TimerLoadSet(TIMER0_BASE, TIMER_A, 8000 ); TimerMatchSet(TIMER0_BASE, TIMER_A, 5000 ); IntEnable(INT_TIMER0A); TimerIntEnable(TIMER0_BASE, TIMER_CAPA_MATCH); IntMasterEnable(); TimerIntRegister(TIMER0_BASE, TIMER_A, Timer0AIntHandler); TimerEnable(TIMER0_BASE, TIMER_A); }
Also I've been unable to understand what is prescalar and prescalar match. My experience tells me that prescalar is used for getting a different clock frequency for the timer than the system clock. And is prescalar match the Timer Match when using the prescalar?