Hey TI og others.
I have been doing the tutorial Lab 5 where he samples a temperature signal on the stellaris LM4F120XL. Now I want to sample an external analog signal through to a chosen pin, but I am pretty confused of how to configure it and which pins the analog signal input to, can anybody help me?
My guess was:
Void Unit_ADC_analog_input (void) {
SysCtlPeripheralEnable (SYSCTL_PERIPH_ADC0);
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_250KSPS);
ADCSequenceDisable(ADC0_BASE, 1);
ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); // Cant I use that pin to sample analog signal???
ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH0); // I don't which channals to use here, just used CHO, should I use a different one ???
ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 1);
}
void main (void) {
unsigned long Analog_sample[4] ;
ADCIntClear(ADC0_BASE, 1);
ADCProcessorTrigger(ADC0_BASE, 1);
while(!ADCIntStatus(ADC0_BASE, 1, false))
{
}
ADCSequenceDataGet(ADC0_BASE, 1, Analog_sample);
}