Problems occurring during ADC10 reading :-
Below is my sample code, through which I am reading voltages on four ADC channels, but in all cases I am getting the same voltage levels on all channels, that is one channel reading on the other channels.
Initiation :
ADC10CTL1 = SHS_0 + CONSEQ_1;
ADC10CTL0 = SREF_0 + ADC10SHT_0 + REFON + ADC10ON + ENC ;
ADC10DTC1=0x01;
conversion Code:
int Adc_Conv( int channel ) {
ADC10CTL1 = channel;
ADC10CTL0 |= ENC + ADC10SC;
while( ADC10CTL1 & ADC10BUSY );
ADC10CTL0 &= ~ENC;
return ADC10MEM;
}
If I read from the ADC Channels:
Temp1= Adc_Conv( 0x0400 );
Temp2= Adc_Conv( 0x1400 );
Temp3= Adc_Conv( 0x2400 );
Temp4= Adc_Conv( 0x3400 );
On all channels I am getting the first ADC Channel Reading , where I have to make change in order to read each channel separately.