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

Forum Post: RE: MSP430G2553 ,ADC10 and WDT Trigger

$
0
0
Hi tejaChintalapati, Thank you for your quick reply I have modified the code as per your suggestion .!!! 1)Please go through and suggest me weather is this a right way to proceed? // Please note that ADC Conversion should happen within 1 msec before next WDT to trigger. 1.1)Am i satisfying the requirement? 2)Moreover Can i trigger ADC Conversion with the rising edge of the pwm signal generated with the help of timer as per one example code? 3)if yes, which method is better? to trigger ADC Conversion through watchdog timer or PWM set/reset opeartion? // i have spent a lot of time and still NOT able to find out the better option between these two. // Watchdog Timer interrupt service routine #pragma vector = WDT_VECTOR __interrupt void WDT_ISR(void) { adc_flag = 1; ADC10CTL0 |= ADC10ENC + ADC10SC; // Sampling and conversion start __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } void main() { if(adc_flag==1) { while (ADC10CTL1 & ADC10BUSY); // Wait for conversion ADC10SA = (unsigned int)ADC_Readings; // Transfer adc readings to an array using DTC ADC10CTL0 &= ~ENC; //CLEAR ENC bit /*code for calculating average value of 10 samples by accessing array*/ } }

Viewing all articles
Browse latest Browse all 62309

Trending Articles