Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62388

Forum Post: ADC10MEM reg giving zero value as adc output

$
0
0
Hi, I'm using msp-exp430g2 development kit and through this kit I'm doing 10bit ADC. I programmed the code and debugged it through CCS v6. The problem that I'm facing is that when I run the code and when I checked the ADC10MEM register I found out that the value is coimg zero.I can't get it why is this happening so ? The analog input is actually heartbeat sound which I'm taking as input and is providing to the mcu. Since heartbeat sound is of low frequency signal so I preferred to use ACLK. I assigned the sampling rate as 100Hz. I tried single stepping but all in vain. I couldn't exactly point out where the mistake is? Kindly please help me identify the mistake or any suggestion for my problem. #include void configure_adc(void); void configure_timer(void); int datain; void main (void) { WDTCTL = WDTPW + WDTHOLD; // stop WDT BCSCTL3 |= LFXT1S_2; //ACLK set to operate in VLO mode i.e near 12khz since bcoz of low freq operation mode required configure_adc(); while(1) { //__delay_cycles(1000); // Wait for ADC Ref to settle ADC10CTL0 |= ENC + ADC10SC; // Start Conversion __bis_SR_register(CPUOFF + GIE); // Low Power Mode 0 with interrupts enable } } #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer0_A0 (void) { // while (ADC10CTL1 & ADC10BUSY); // check for ADC conversion is completed datain = ADC10MEM; __bic_SR_register_on_exit(CPUOFF); // Return to active mode } void configure_timer(void) { TA0CCTL0=CCIE; // Enable Timer A0 interrupts, bit 4=1 TACCR0=119; // Count limit is set so that 100Hz frequency is obtained TA0CTL=TASSEL_1 + MC_1; // Timer A0 with ACLK, count UP } void configure_adc(void) { ADC10CTL0= SREF_0 + ADC10SHT_2 + ADC10ON + ADC10IE; // VCC=3V ADC10CTL1= INCH_0 + SHS_2 + ADC10SSEL_0 + CONSEQ_2; // SHS=2 bcoz timer A output unit 0, ADC10OSC as ADC10CLK source, single channel repeated conv mode ADC10AE0 |= BIT0; //analog input enable P1.0 configure_timer(); } Thanks.

Viewing all articles
Browse latest Browse all 62388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>