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.

TM4C1294NCPDT: Temperature sampling with the ADC

Part Number: TM4C1294NCPDT
Hello!

I have a problem when sampling the voltages coming from a temperature sensor, the ADC obtains different data for each "step" of the ADC.

I have an NTC thermistor fitted into a voltage divider, the divider is powered with a voltage of 3.3V, and a fixed resistor of 3.9 kilo ohms, 
the fixed resistor is the one that goes to ground. The output of this voltage divider enters an operational amplifier in follower configuration
to reduce the effects of loading, the output of the operational amplifier enters a multiplexer, and the output of the multiplexer enters the
ADC pin of the microcontroller.
I debug the program to observe what the temperature and resistance of the sensor are like at all times. For testing purposes I replaced the
thermistor with resistors of fixed values, the voltages measured on the PCB are those expected according to the value of the resistance,
but the temperature in the code composer is not what corresponds to that resistance value, varying even by 10 degrees Celsius above the theoretical value. Could you give me any suggestions?

void MUX_GPIO() //CONFIGURA LOS CANALES DE ADC PARA CADA COMBINACIÓN DE LOS MULTIPLEXORES
{

    //CANAL 0 DEL ADC
     GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_0, 0x00);//ENABLE1 del primer multiplexor NEGADA EN INTEGRADO
/*
     //entrada S3
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1

      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)

      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
           {

           }
     ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc

     mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
     vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
     RT=((3900*(3.3-vol_T))/vol_T);
     T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint

     arreglo[2]=T;*/

   //entrada S4
   GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
   GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1

   ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
   ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
   ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
   ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
   ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
   ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
   ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
   ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
   ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)

   ADCSequenceEnable(ADC0_BASE,0);
   ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
   ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
   while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
        {

        }
   ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc

   mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
   vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
   RT=((3900*(3.3-vol_T))/vol_T);
   T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint

   arreglo[3]=T;




//--------------------------------------------------------------------------------------------------------------------------------

}


This is my code

Mayra
 
  • Hi,

      I don't see you configure PE3 for AIN_0. You need the below line. 

    GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3); 

      Please refer to the examples in TivaWare SDK at C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\adc

  • Hello

    
    I already have the ADC pins configured, this is my code for that. But I have realized that in the calculations 
    I perform, all the decimals that are generated are used, when doing so the temperature value changes,
    for example in the variable vol_T=3.29919434, the temperature of that voltage value is 1342 °C , when
    "theoretically", for 3.29 volts, there should be an approximate temperature value of 428°C.
    Could you give me some suggestions so that my "practical" temperature is closer to the "theoretical" one?
     


    void INIT_ADC() //inicializa el ADC
     {
         SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //habilita el periferico para ADC0
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //habilita el periferico E
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); //habilita el periferico B
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //habilita el periferico D
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK); //habilita el periferico K
         while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0));
    
         GPIOPinTypeADC(GPIO_PORTE_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTB_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTD_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTK_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
     }

  • Hi,

      What in your code are you using the array buffer_ADC. The buffer_ADC[1] has a weird value of 536871428. Do you know why?

      How are you declaring you variables like vol_T and others?

  • hi!

    No, I couldn't say why [1] has a strange value, I think it was something that happened only once.
    
    The variables are declared this way:
    uint32_t buffer_ADC[24]; // arreglo para guardar datos entrantes del ADC
    
    float arreglo[12]; //arreglo para guardar los datos de los termistores
    float vol_T=0.0; //guarda el dato de voltaje
    float RT=0.0;//guarda el dato de resistencia del termistor
    float mu_T; //guarda el promedio de muestreo del adc
    float T=0.0;//guarda el dato de temperatura
    
  • Hi,

      I will suggest you isolate the problem. First, just sample the data and read out the data without any of the floating operation. Are you getting the correct value that is stored in the ADC FIFO? This will tell if the problem is related to your floating operations. If the ADC is correct in sampling the correct value then you can investigate further on the float calculation. Since you are using floating operations, you need to make sure you have sufficient stack. Try to increase your stack and heap memory. 

  • Hello!
    
    I isolated the ADC sampling, the sampled values ​​do not correspond to those expected, 
    for the same ADC channel and a fixed resistance value, the ADC samples are changing,
    but when I apply a voltage of 3.3V (which is the supply voltage ) the ADC values ​​remain static.

    best regards

    Mayra
    
    
  • Hi,

      You have the below code. You are configuring PE3, PB3, PD3 and PK3 for ADC. Is that what you want?

    GPIOPinTypeADC(GPIO_PORTE_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
    GPIOPinTypeADC(GPIO_PORTB_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
    GPIOPinTypeADC(GPIO_PORTD_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
    GPIOPinTypeADC(GPIO_PORTK_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0

  • Hi!
    
    Yes, I occupy several ADC channels.
  • I'm confused now. On one hand, you want to sample channels on PE3, PB3, PD3 and PK3 but on your earlier posting you have the below code. Are you sure you want to sample AIN12 and AIN19? our code says you are trying to sample AIN0 eight times. You have 0 as the fourth argument for each of the 8 steps in the Sample Group 0. 

    ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
    ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
    ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
    ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
    ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
    ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
    ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
    ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
    ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)

  • Hi!
    
    Actually in my project I am testing 3 ADC channels to collect data from 12 temperature sensors, 
    the sensors are divided into 3 multiplexers that read 4 sensors each, sampling 8 times one
    channel of the multiplexer. But since I had that problem with reading my temperatures, I removed some parts of the code to
    test a single channel of a single sensor. The other channels are for some INA's that monitor current of 3 loads. This is the complete code of the 12 temperature sensors


    void MUX_GPIO() //CONFIGURA LOS CANALES DE ADC PARA CADA COMBINACIÓN DE LOS MULTIPLEXORES
    {
    
      //CANAL 0 DEL ADC
      GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_0, 0x00);//ENABLE1 del primer multiplexor NEGADA EN INTEGRADO
    /*
    
      //entrada S1
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
        ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
        ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
        ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
        ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
        ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
        ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
        ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
        ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
           {
    
           }
     ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
         mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
         vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
         RT=((3900*(3.3-vol_T))/vol_T);
         T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
         arreglo[0]=T;
    
    
        //entrada S2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
         ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
          mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
          vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
          RT=((3900*(3.3-vol_T))/vol_T);
          T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
          arreglo[1]=T;
    
    */
    /*
        //entrada S3
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
        ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
        mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
        vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
        RT=((3900*(3.3-vol_T))/vol_T);
        T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
        arreglo[2]=T;
    */
    
       //entrada S4
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
       ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
       ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
       ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
       ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
       ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
       ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
       ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
       ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
       ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
            {
    
            }
       ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[3]=T;
    
    
    
    
    //--------------------------------------------------------------------------------------------------------------------------------
    // CANAL 1 DEL ADC
    
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0x00); //ENABLE1 del segundo multiplexor NEGADA EN INTEGRADO
    /*
        //entrada S1
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
         ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
         mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
         vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
         RT=((3900*(3.3-vol_T))/vol_T);
         T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
         arreglo[4]=T;
    
         //entrada S2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
        ADCSequenceEnable(ADC0_BASE,0);
        ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
        ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
        while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
             {
    
             }
        ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
        mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
        vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
        RT=((3900*(3.3-vol_T))/vol_T);
        T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
        arreglo[5]=T;
    */
    /*
        //ENTRADA S3
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
        ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
        ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
        ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
        ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
        ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
        ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
        ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
        ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
        ADCSequenceEnable(ADC0_BASE,0);
        ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
        ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
        while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
             {
    
             }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[6]=T;
    
    
      //ENTRADA S4
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[7]=T;
      */
    
    /*
    //-------------------------------------------------------------------------------------------------------------------------------
    // CANAL 2 DEL ADC
    
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_7, 0x00); //ENABLE1 del tercer multiplexor NEGADA EN INTEGRADO
    
      //entrada S1
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[8]=T;
    
    
    //ENTRADA S2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[9]=T;
    
    
    
      //ENTRADA S3
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
           {
    
           }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[10]=T;
    
       //ENTRADA S4
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN1
    
       ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
       ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
       ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
       ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
       ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
       ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
       ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
       ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
       ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
            {
    
            }
       ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[11]=T;
    
    */
    }
    

    
    
  • Most of your code is commented out. Why don't you focus your code for one channel on one sensor. Remove all the commented out code. I also don't see in your latest code which pin is used like PE3 or whatever pin you want to use to sample. Where in your latest code do you have GPIOPinTypeADC()? For good readability, do NOT write like below.

    ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)

    You should write like below instead. It helps other people who is reading your code and it also help yourself.

    ADCSequenceStepConfigure(ADC0_BASE, 0,0, ADC_CTL_CH0);//(paso 1)

    I will suggest you just sample only one channel one time instead of 8 times. See it that works. Also run the same on a LaunchPad. I don't know if and how your hardware is playing role in the sampling as you have multiplexers outside. How are you controlling the multiplexer. Again, start with something simple and expand gradually per your application requirement. Do one channel sampling on a LaunchPad and then add another channel. If everything works, move on to add more channels and then finally test the firmware on your own custom board. 

    I'm also out of office until next Wednesday. Please expect delay in my response. 

  • Hi!
    
    I already removed the commented lines of code from the program, I made a project solely to test an ADC channel 
    (which is part of the code that I showed at the beginning), I also tested the reduced code on a Launchpad and
    the result was the same, the data read by the ADC change all the time.

    These lines of code specify which multiplexer input I want to read at that moment.

    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
    GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1

    These are the functions:

    //-----------------------------------------------------------------------------------------------------------------
    //                                               ADC
    //------------------------------------------------------------------------------------------------------------------
    
     //función de autoria propia
     void INIT_ADC() //inicializa el ADC
     {
         SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //habilita el periferico para ADC0
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //habilita el periferico E
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); //habilita el periferico B
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //habilita el periferico D
         SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK); //habilita el periferico K
         while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0));
    
         GPIOPinTypeADC(GPIO_PORTE_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTB_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTD_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
         GPIOPinTypeADC(GPIO_PORTK_BASE,GPIO_PIN_3); //PINES PARA ENTRADA ADC0
     }
    
    
     void INIT_MUX_GPIO() //configura los perifericos como GPIO para los multiplexores
    {
      //Habilitar el periferico SysCtlPeripheralEnable(uint32_t ui32Peripheral);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); //habilita el periferico D
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //habilita el periferico E
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK); //habilita el periferico K
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); //habilita el periferico B
    
        //configuración de entrada o salida  GPIOPinTypeGPIOOutput(uint32_t ui32Port, uint8_t ui8Pins);
        GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE,GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); //habilita determinados pines del periferico D
        GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE,GPIO_PIN_0);
        GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_4|GPIO_PIN_5);
        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE,GPIO_PIN_3);
        GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_4|GPIO_PIN_5);
    }
    
    //-----------------------------------------------------------------------------------------------------------------
    //                                        TERMISTOR       MULTIPLEXOR
    //-----------------------------------------------------------------------------------------------------------------
    
    void MUX_GPIO() //CONFIGURA LOS CANALES DE ADC PARA CADA COMBINACIÓN DE LOS MULTIPLEXORES
    {
    
      //CANAL 0 DEL ADC
      GPIOPinWrite(GPIO_PORTE_BASE, GPIO_PIN_0, 0x00);//ENABLE1 del primer multiplexor NEGADA EN INTEGRADO
    
      //entrada S1
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
        ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
        ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
        ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
        ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
        ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
        ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
        ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
        ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
           {
    
           }
     ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
         mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
         vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
         RT=((3900*(3.3-vol_T))/vol_T);
         T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
         arreglo[0]=T;
    
    
        //entrada S2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
         ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
          mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
          vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
          RT=((3900*(3.3-vol_T))/vol_T);
          T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
          arreglo[1]=T;
    
        //entrada S3
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
        ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
        mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
        vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
        RT=((3900*(3.3-vol_T))/vol_T);
        T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
        arreglo[2]=T;
    
    
       //entrada S4
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
       ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
       ADCSequenceStepConfigure(ADC0_BASE, 0,0, 0);//(paso 1)
       ADCSequenceStepConfigure(ADC0_BASE, 0,1, 0);//(paso 2)
       ADCSequenceStepConfigure(ADC0_BASE, 0,2, 0);//(paso 3)
       ADCSequenceStepConfigure(ADC0_BASE, 0,3, 0);//(paso 4)
       ADCSequenceStepConfigure(ADC0_BASE, 0,4, 0);//(paso 5)
       ADCSequenceStepConfigure(ADC0_BASE, 0,5, 0);//(paso 6)
       ADCSequenceStepConfigure(ADC0_BASE, 0,6, 0);//(paso 7)
       ADCSequenceStepConfigure(ADC0_BASE, 0,7, 0|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
            {
    
            }
       ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[3]=T;
    
    
    
    
    //--------------------------------------------------------------------------------------------------------------------------------
    // CANAL 1 DEL ADC
    
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, 0x00); //ENABLE1 del segundo multiplexor NEGADA EN INTEGRADO
    
        //entrada S1
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
         ADCSequenceEnable(ADC0_BASE,0);
         ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
         ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
         while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
              {
    
              }
         ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
         mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
         vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
         RT=((3900*(3.3-vol_T))/vol_T);
         T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
         arreglo[4]=T;
    
         //entrada S2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
         GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
         ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
         ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
         ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
         ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
         ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
         ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
         ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
         ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
         ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
        ADCSequenceEnable(ADC0_BASE,0);
        ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
        ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
        while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
             {
    
             }
        ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
        mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
        vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
        RT=((3900*(3.3-vol_T))/vol_T);
        T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
        arreglo[5]=T;
    
        //ENTRADA S3
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
        GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
        ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
        ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
        ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
        ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
        ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
        ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
        ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
        ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
        ADCSequenceEnable(ADC0_BASE,0);
        ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
        ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
        while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
             {
    
             }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[6]=T;
    
    
      //ENTRADA S4
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 1);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 1);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 1);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 1);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 1);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 1);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 1);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 1|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[7]=T;
    
    //-------------------------------------------------------------------------------------------------------------------------------
    // CANAL 2 DEL ADC
    
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_7, 0x00); //ENABLE1 del tercer multiplexor NEGADA EN INTEGRADO
    
      //entrada S1
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[8]=T;
    
    
    //ENTRADA S2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0x00);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
      {
    
      }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
      mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
      vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
      RT=((3900*(3.3-vol_T))/vol_T);
      T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
      arreglo[9]=T;
    
    
    
      //ENTRADA S3
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN2
      GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0x00);//IN1
    
      ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
      ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
      ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
      ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
      ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
      ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
      ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
      ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
      ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
      ADCSequenceEnable(ADC0_BASE,0);
      ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
      ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
      while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
           {
    
           }
      ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[10]=T;
    
       //ENTRADA S4
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, 0xFF);//IN2
       GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, 0xFF);//IN1
    
       ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR,0);
       ADCSequenceStepConfigure(ADC0_BASE, 0,0, 2);//(paso 1)
       ADCSequenceStepConfigure(ADC0_BASE, 0,1, 2);//(paso 2)
       ADCSequenceStepConfigure(ADC0_BASE, 0,2, 2);//(paso 3)
       ADCSequenceStepConfigure(ADC0_BASE, 0,3, 2);//(paso 4)
       ADCSequenceStepConfigure(ADC0_BASE, 0,4, 2);//(paso 5)
       ADCSequenceStepConfigure(ADC0_BASE, 0,5, 2);//(paso 6)
       ADCSequenceStepConfigure(ADC0_BASE, 0,6, 2);//(paso 7)
       ADCSequenceStepConfigure(ADC0_BASE, 0,7, 2|ADC_CTL_IE|ADC_CTL_END);//(paso 8)
    
       ADCSequenceEnable(ADC0_BASE,0);
       ADCIntClear(ADC0_BASE,0); //limpia las banderas de interrupción del ADC
       ADCProcessorTrigger(ADC0_BASE,0); //Causa un trigger para una secuencia de muestreo
       while(!ADCIntStatus(ADC0_BASE,0,false)) //indica el estado de las interrupciones
            {
    
            }
       ADCSequenceDataGet(ADC0_BASE,0,buffer_ADC);//obtiene los datos capturados por el adc
    
       mu_T=(buffer_ADC[0]+buffer_ADC[1]+buffer_ADC[2]+buffer_ADC[3]+buffer_ADC[4]+buffer_ADC[5]+buffer_ADC[6]+buffer_ADC[7])/8;
       vol_T=mu_T*3.3/4096; //aqui hubo breakpoint
       RT=((3900*(3.3-vol_T))/vol_T);
       T=(1/(0.000634544+(0.000321866*log(RT))+(-0.000000306*pow(log(RT),3))))-273.15;//aqui hubo breakpoint
    
       arreglo[11]=T;
    
    
    }
    

  • Hi Mayray - Charles,

    If you are running PWM (3x INA'S) sampling ADC data will likely require significant oversampling as to get a stable temperature reading from OP amp. Also must have proper impedance matching of ADC channel inputs. Decoupling capacitors can actually introduce PWM ground noise into the count. Interestingly, a pulldown resistor (2K) or greater can help to stabilize sampling count providing a discharge path for the ADC internal sampling capacitor.  BTW keep in mind as Charles mentions several steps are configured in your code, the ADC steps are cyclical must POP each array to unload the desired step data then clear or drain the sequencers prior to the next sampling. 

    Regards,