Other Parts Discussed in Thread: TM4C1294NCPDT
Tool/software: Code Composer Studio
Dear Bob Sir,
Hope you are fine.This time is going to be a difficult time over the whole world. I'm sorry and sympathetic the people of America and the whole world. Allah bless & hidayyat the people in world. I write a new program . . .In ADC programming here some thing error. Please show my program below-
#include<stdint.h>
#include "inc/tm4c1294ncpdt.h"
int main(void)
{
SYSCTL_RCGCADC_R |=(1<<0); //1. Enable the ADC clock using the RCGCADC register (see page 403).
//2. Enable the clock to the appropriate GPIO modules via the RCGCGPIO register (see page 389).
// To find out which GPIO ports to enable, refer to “Signal Description” on page 1179.
SYSCTL_RCGCGPIO_R|=(1<<4)|(1<<0); // PortE enable for ADC & PortA for O/p
// configure led pin
GPIO_PORTA_AHB_DIR_R |=(1<<6); //make output pin
GPIO_PORTA_AHB_DEN_R |=(1<<6); // enable digital
GPIO_PORTA_AHB_AFSEL_R &=~(1<<6);// alternate function is disable
GPIO_PORTA_AHB_DATA_R |=(1<<6); //
//configure ADC
// 3. Set the GPIO AFSEL bits for the ADC input pins (see page 778). To determine which GPIOs to
//configure, see Table 29-4 on page 1921.
GPIO_PORTE_AHB_AFSEL_R|=(1<<3); //use PE3 (of Port E) ANI3
//4. Configure the AINx signals to be analog inputs by clearing the corresponding DEN bit in the
//GPIO Digital Enable (GPIODEN) register (see page 789).
GPIO_PORTE_AHB_DEN_R &=~(1<<3); //PE3
//5. Disable the analog isolation circuit for all ADC input pins that are to be used by writing a 1 to
//the appropriate bits of the GPIOAMSEL register (see page 794) in the associated GPIO block.
GPIO_PORTE_AHB_AMSEL_R |=(1<<3); // PE3
//6. If required by the application, reconfigure the sample sequencer priorities in the ADCSSPRI
//register. The default configuration has Sample Sequencer 0 with the highest priority and Sample
//Sequencer 3 as the lowest priority.
//18.4.2 Sample Sequencer Configuration
//1. Ensure that the sample sequencer is disabled by clearing the corresponding ASENn bit in the
//ADCACTSS register. Programming of the sample sequencers is allowed without having them
//enabled. Disabling the sequencer during programming prevents erroneous execution if a trigger
//event were to occur during the configuration process.
ADC_ACTSS_ASEN3 &=~(1<<3);
return 0;
}
Please solve this problem.