Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22733

CC430f5137 ADC12 trigger by timer

$
0
0

Hi ,

I need help.

I am working on ADC using cc430f5137

#include <msp430.h>
//#include <studio.h>

#define Num_of_Results 8
unsigned int ADC_value;

void ConfigureAdc(void)
{
P2SEL |= BIT2; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; // Turn on ADC12_A, extend sampling time
// to avoid overflow of results
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_3; // Use sampling timer, repeated sequence
ADC12MCTL2 = ADC12INCH_2; // ref+=AVcc, channel = A2
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ADC12ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion - software trigger
}

int main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer

ConfigureAdc();
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
__no_operation(); // For debugger
}


#pragma vector=ADC12_VECTOR
__interrupt void ADC12_ISR (void)

{
ADC_value = ADC12MEM2;

}

with this code I am getting correct ADC value but I want to trigger ADC by timer.

I don't understand how to setup timer to trigger ADC.

Please give me some suggestion and anybody have example code please share with me. 

Nahid


Viewing all articles
Browse latest Browse all 22733

Trending Articles



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