Hi! all
am currently working with msp430+ cc2520. I configured ADC12 and using it. I have two routiens to read ADC channel 11 and ADC channel 12 respectively. While reading ADC, channel 11 is giving me ADC count as 2021. This is ok but the channel 12 is also giving the same value. What can be the problem ? please reply ...here the code which i am using to read adc
/*ADC channel 11*/
uint16 HalMyAdc11Read ()
{
/* Setup sampling */
ADC12CTL0 = ADC12ON + SHT0_7; //192 cycles
HAL_ADC_11_MEM_CONTROL = SREF_0 | HAL_ADC_11_CHANNEL;
/* Disable conversions */
HAL_ADC_DISABLE_12()
/* Use sampling timer */
ADC12CTL1 = HAL_ADC_11_CONV_STARTADDR | SHP;
/* Enable conversions */
HAL_ADC_ENABLE_12();
/* Start Conversion */
ADC12CTL0 |= ADC12SC;
/* Wait for conversion to be done */
while (!(ADC12IFG & HAL_ADC_11_CH_BV));
/* Get Result */
return (HAL_ADC_11_RESULT);
}
Here is the code for reading ADC 12 channel
/*ADC channel number 12*/
uint16 HalMyAdc12Read ()
{
/* Setup sampling */
ADC12CTL0 = ADC12ON + SHT0_7 ; //192 cycles
HAL_ADC_12_MEM_CONTROL = SREF_0 | HAL_ADC_12_CHANNEL;
/* Disable conversions */
HAL_ADC_DISABLE_12()
/* Use sampling timer */
ADC12CTL1 = HAL_ADC_12_CONV_STARTADDR | SHP;
/* Enable conversions */
HAL_ADC_ENABLE_12();
/* Start Conversion */
ADC12CTL0 |= ADC12SC;
/* Wait for conversion to be done */
while (!(ADC12IFG & HAL_ADC_12_CH_BV));
/* Get Result */
return (HAL_ADC_12_RESULT);
}
Channel 12 shold give a count around 0 but it is not the case here
Please reply
Thanking you
shivraj