Hi,
Below is my code for an ADC sampling. i'm writing a ADC code for sampling the result from a pressure transducer.
Below is my code and i having 2 error when i build the program, but i have no idea how to get the input from the pressure transducer. Anyone can check for the code below?
#include <stdint.h>
#include <stdbool.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 "driverlib/timer.h"
#include "driverlib/interrupt.h"
int main(void)
{
uint32_t ui32ADC0Value[4];
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //Enable ADC0 Peripheral
ADCSequenceEnable(ADC0_BASE,0);
ADCHardwareOversampleConfigure(ADC0_BASE, 64);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE,0,0,ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE,0,1,ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE,0,2,ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE,0,3,ADC_CTL_CH0|ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 0);
while(1)
{
ADCIntClear(ADC0_BASE,0);//Clear ADC interrupt
ADCProcessorTrigger(ADC0_BASE,0); //Trigger ADC interrupt
while(!ADCIntStatus(ADC0_BASE, 0, false))
{
}
ADCSequenceDataGet(ADC0_BASE,0,ui32ADC0Value);
SysCtlDelay(2000000);
}
}
Thank you.