Hello,
I use the MSP430G2231 and I'm trying to get the temperatur and the supply voltage with the ADC10. The measurments are all ok if I measure only one channel but if I use it with the DTC the values from temperature and supply voltage measurment in the arry where i put them are in other places after each conversion.
And if I try to use the ADC without the DTC but with multi-channel i have the same problem. I really do't get what i'm doing wrong.
Here is my code:
#include "msp430x20x2.h"
static unsigned int res[11];
void adc_init(void){
ADC10CTL0 &= ~ENC;
ADC10CTL0 = SREF_1 + REFON + ADC10ON + ADC10SHT_3 + ADC10IE + REF2_5V + MSC + REFBURST; // use internal ref, turn on 2.5V ref, set samp time = 64 cycles REF2_5V +
ADC10CTL1 = INCH_11 + CONSEQ_3 + ADC10DIV_1; //Kanal auswählen; Art der Messung bestimmen;Teiler für ADC
ADC10DTC0 = ADC10CT;
ADC10DTC1 = 0x0B;
ADC10SA = (int)res;
ADC10CTL0 &= ~ADC10IFG;
ADC10CTL0 |= ENC + ADC10SC;;
}
#pragma vector=ADC10_VECTOR
__interrupt void adc10_isr(void) {
static unsigned int Toffset=11;
unsigned long temp_V = ((ADC10MEM/ 1024)*2.5); //Ref 2.5 V Spannungsmessung
unsigned long temp_C=(((2.5*((float)ADC10MEM + Toffset))/1023)-0.986)/0.00355; //Temperatur berechnen
ADC10CTL0 &= ~ADC10IFG;
}
Thanks