hi,i am trying to toggle my led state after every 1 second....for this purpose i m using my timer1 in 16 bit mode Along with that i m using a prescalar of 255....but it's not working?
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
int main(void)
{
/*Set the clocking to directly run from the crystal at 16MHz*/
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1,0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
TimerConfigure(TIMER1_BASE, TIMER_CFG_A_PERIODIC);
TimerPrescaleSet(TIMER1_BASE,TIMER_A,254);
//ulPeriod = (SysCtlClockGet() / 10) / 2;
//TimerLoadSet(TIMER1_BASE, TIMER_A, ulPeriod -1);
IntEnable(INT_TIMER1A);
TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
IntMasterEnable();
TimerEnable(TIMER1_BASE, TIMER_A);
while(1)
{
}
}
void Timer1IntHandler(void)
{
// Clear the timer interrupt
TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1);
SysCtlDelay(SysCtlClockGet()/3);
}