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 );
for the first time , that is for Temp1 this code works fine but for the rest all it is not doing conversion so please, if any can help me out where i have to make change inorder to do all channels readings thanks in advance. regards Boni