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.

ADC conversion Tiva C Launch Pad

Other Parts Discussed in Thread: TM4C123GE6PM

Hi everyone,

I have been using Tiva C Launch Pad for sampling a analogic signal  and saving the samples in a vector of 128. The code is;

#include <stdint.h>

#include <stdbool.h>

#include <stdlib.h>

#include <time.h>

#include <stdio.h>

#include <math.h>

#include <string.h>

#include "inc/hw_memmap.h"

#include "inc/hw_types.h"

#include "driverlib/debug.h"

#include "driverlib/sysctl.h"

#include "driverlib/adc.h"

#include "driverlib/gpio.h"

#include <tm4c123ge6pm.h>

#include "LaunchPad.h"

int adc [128];

long lBtn1;

long lBtn2;

int main (void) {

 

uint32_t ADC0Value[1];

volatile uint32_t ui32Loop;

char bDemoState = 0;

 

 

SysCtlClockSet(SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);

SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

GPIOPinTypeGPIOInput(GPIO_PORTD_BASE,GPIO_PIN_2);

GPIOPinTypeADC(GPIO_PORTD_BASE,GPIO_PIN_2);

 

 

 

 

ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);

ADCSequenceStepConfigure(ADC0_BASE,3,0,ADC_CTL_CH5|ADC_CTL_IE|ADC_CTL_END);

ADCSequenceEnable(ADC0_BASE, 3);

ADCIntClear(ADC0_BASE, 3);

while(1)

{

for (i=0;i<127;i++){

ADCProcessorTrigger(ADC0_BASE, 3);

while(!ADCIntStatus(ADC0_BASE, 3, false))

{ }

ADCIntClear(ADC0_BASE, 3);

 

ADCSequenceDataGet(ADC0_BASE,3,ADC0Value);

adc[i]=ADC0Value[0];

}

}

After the line with adc[i]=ADC0Value[0], the breakpoint is disabled; S/W BP- disabled. I can't figure out why. Is the code correct?

My signal has been analogically filtered and is maximum frequency should be around 30 Hz.

Thanks in advance.