Tool/software: Code Composer Studio
Hi all,
I am trying to read analog sensor using tm4c123gxl.But the problem i am having using following code is that when i try to see value of variable to which value of ADC is supposed to be stored,it say "identifier not found" in Expression window, but if put break point anywhere between while loop, the value of variable changes to zero.
#include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/adc.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "inc/hw_types.h" #include "driverlib/rom_map.h" #include "driverlib/rom.h" #include "inc/tm4c123gh6pm.h" #include "driverlib/debug.h" int main(void) { SysCtlClockSet ( SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ ) ; SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END); ADCSequenceEnable(ADC0_BASE, 3); ADCIntClear(ADC0_BASE, 3); volatile uint32_t ui32ADC0Value; while(1) { ADCProcessorTrigger(ADC0_BASE, 3); while(!ADCIntStatus(ADC0_BASE, 3, false)) { } ADCIntClear(ADC0_BASE, 3); // // Read ADC Value. // ADCSequenceDataGet(ADC0_BASE, 3, ui32ADC0Value); SysCtlDelay(SysCtlClockGet() / 12); } }