Tool/software: Code Composer Studio
Hi,
we are using the TM4C1294NCPDT launchpad. In that launchpad , we did the program to generate 1ms delay by using timer, but we are not able to generate the delay.
when we are loading the less value (eg: 120000) in to the timer register , in this case after time elapsed it's not going in to the isr.
Kindly go through the code....
int main(void)
{
ui32SysClock=SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480),120000000);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE , GPIO_PIN_0 | GPIO_PIN_1);
TimerConfigure(TIMER0_BASE , TIMER_CFG_PERIODIC);
TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC);
period = 120000;
TimerLoadSet(TIMER0_BASE , TIMER_A , period-1);
IntEnable(INT_TIMER0A);
TimerIntEnable(TIMER0_BASE , TIMER_TIMA_TIMEOUT);
IntMasterEnable();
TimerEnable(TIMER0_BASE , TIMER_A);
while(1);
return 0;
}
void Timer0IntHandler(void)
{
TimerIntClear(TIMER0_BASE , TIMER_TIMA_TIMEOUT);
if(GPIOPinRead(GPIO_PORTN_BASE , GPIO_PIN_1))
{
GPIOPinWrite(GPIO_PORTN_BASE , GPIO_PIN_1 , 0);
}
else
{
GPIOPinWrite(GPIO_PORTN_BASE , GPIO_PIN_1, 2);
}
}
Thanks and Best Regards,
Venkatadri