Following is the code.. Kindly look at it
Doesn't seem to be working
#define PART_LM4F120H5QR
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/timer.h"
#include "driverlib/pwm.h"
#include "utils/uartstdio.h"
int pulse_time_1;
int a,b,c;
void TIMER_Initialize(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinConfigure(GPIO_PB5_T1CCP1);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_5);
TimerConfigure(TIMER1_BASE, TIMER_CFG_16_BIT_PAIR |TIMER_CFG_B_CAP_COUNT);
TimerControlEvent(TIMER1_BASE,TIMER_B,TIMER_EVENT_BOTH_EDGES);
IntEnable(INT_TIMER1B);
TimerIntEnable(TIMER1_BASE, TIMER_CAPA_EVENT);
IntMasterEnable();
TimerEnable(TIMER1_BASE, TIMER_B);
}
void UART_Initialize()
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3|GPIO_PIN_2);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
}
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_64 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
TIMER_Initialize();
UART_Initialize();
while(1)
{
pulse_time_1=TimerLoadGet(TIMER1_BASE, TIMER_B);
TimerEnable(TIMER1_BASE, TIMER_B);
UARTprintf("%d",pulse_time_1);
//UARTCharPut(UART0_BASE,'$');
}
}
void Timer1IntHandler(void)
{
TimerIntClear(TIMER1_BASE, TIMER_CAPA_EVENT);
b=TimerValueGet(TIMER1_BASE, TIMER_B);
if (b<a) c=65535+a-b;
else c=a-b;
pulse_time_1=c/3125;
a= TimerValueGet(TIMER1_BASE, TIMER_B);
}