This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

16 bit edge time mode not working

I am using LM4F120H5QR

I want to measure a pulse time which varies from 1.1ms to 2.0ms

The code compiles with no error but nothing is printed on Terminal where as if I comment out the Timer part the code prints on terminal; also do i need to configure any interrupt handler for doing so using timer b time capture mode.

Code is:

/*
* main.c
*/
#define PART_LM4F120H5QR
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_timer.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/adc.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"

unsigned long ul_counter=0;
int check=0;
void
InitConsole(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);

}

void disp()
{
UARTprintf("************************************************************\n");
UARTprintf(" Author : AnuragM \n");
UARTprintf(" Pulse Width Measurement Using Timer configured as timer for edge time \n");
UARTprintf("\n");
UARTprintf("***********************************************************\n");
}

/*
*
* void Timer_Setup(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
TimerConfigure(TIMER0_BASE, TIMER_CFG_16_BIT_PAIR | TIMER_CFG_B_CAP_TIME);

TimerLoadSet(TIMER0_BASE, TIMER_B, SysCtlClockGet() / 1000);
// IntMasterEnable();
// TimerIntEnable(TIMER0_BASE, TIMER_TIMB_TIMEOUT);
// IntEnable(INT_TIMER0B);
}

*/


void main(void)


{ int time;

SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_7);
TimerConfigure(TIMER0_BASE, TIMER_CFG_16_BIT_PAIR | TIMER_CFG_B_CAP_TIME);
TimerLoadSet(TIMER0_BASE, TIMER_B, 50000);
TimerEnable(TIMER0_BASE, TIMER_B);

InitConsole();
disp();
UARTprintf("adhjj");

while(1)
{
UARTprintf("adhjj");
time=TimerValueGet(GPIO_PORTB_BASE, TIMER_B);
UARTprintf ("Clock rate :) %5d\n",SysCtlClockGet());
UARTprintf ("Time :) %5d\n",time);

}


}