EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

ADC Conversions type

Started by Technical Kripa July 10, 2009
What is the difference between "sequence of conversions" and "single conversion" for ADC in MSP430??
Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/



Beginning Microcontrollers with the MSP430

Single conversion - ADC conversion for only one channel which is activated/selected.

sequence of conversions - ADC conversion for number of channel which is activated.
Regards
B.Bala

--- In m..., Technical Kripa wrote:
>
> What is the difference between "sequence of conversions" and "single conversion" for ADC in MSP430??
> Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/
>
>
>

It depends on which ADC you're referring to: ADC12 or ADC10.
In ADC10 a sequence starts on the current channel. Each following conversion is done on the previous channel until channel A0 is reached.
In ADC12, the sequense starts on the selected MCTL (conversion control memory register, not channel), and moves forward until a MCTL with EOS (End of Sequence) is found.

But you should have gotten this from reading the User Guide. Did you read it?

Michael K.

--- In m..., "balagangadharan_raja1122" wrote:
>
> Single conversion - ADC conversion for only one channel which is activated/selected.
>
> sequence of conversions - ADC conversion for number of channel which is activated.
> Regards
> B.Bala
>
> --- In m..., Technical Kripa wrote:
> >
> > What is the difference between "sequence of conversions" and "single conversion" for ADC in MSP430??
> >
> >
> > Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/
> >
> >
>

Thanks..!
what about single conversion and repeated conversion...?

--- On Sat, 11/7/09, balagangadharan_raja1122 wrote:
From: balagangadharan_raja1122
Subject: [msp430] Re: ADC Conversions type
To: m...
Date: Saturday, 11 July, 2009, 2:58 AM

Single conversion - ADC conversion for only one channel which is activated/selected.

sequence of conversions - ADC conversion for number of channel which is activated.

Regards
B.Bala

--- In msp430@yahoogroups. com, Technical Kripa wrote:
>
> What is the difference between "sequence of conversions" and "single conversion" for ADC in MSP430??
> Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads. yahoo.com/ in/internetexplo rer/
>
>
>

Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.com



Single conversion - A single is sampled and converted once.
example:
#include

static unsigned int results; // Needs to be global in this example
// Otherwise, the compiler removes it
// because it is not used for anything.

void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+SHT0_15; // Turn on ADC12, set sampling time
ADC12CTL1 = SHP; // Use sampling timer, set mode
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 |= ENC; // Enable conversions

while(1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
}
}

#pragma vectorC12_VECTOR
__interrupt void ADC12ISR (void)
{
results = ADC12MEM0; // Move results, IFG is cleared
_BIC_SR_IRQ(LPM0_bits); // Clear LPM0, SET BREAKPOINT HERE
}

Repeated Conversion - A single channel is sampled and converted continuously.
example:
#include

#define Num_of_Results 8 // number of repeat = 8

static unsigned int results[Num_of_Results]; // Needs to be global in this
// example. Otherwise, the
// compiler removes it because it
// is not used for anything.

void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+SHT0_8+MSC; // Turn on ADC12, set sampling time
ADC12CTL1 = SHP+CONSEQ_2; // Use sampling timer, set mode
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 |= ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits + GIE); // Enter LPM0,Enable interrupts
}
#pragma vectorC12_VECTOR
__interrupt void ADC12ISR (void)
{
static unsigned int index = 0;

results[index] = ADC12MEM0; // Move results
index = (index+1)%Num_of_Results; // Increment results index, modulo
}

sequence conversion - A sequence of channels is sampled and converted once.
example:
#include

static unsigned int results[4]; // Needs to be global in this example
// Otherwise, the compiler removes it
// because it is not used for anything.

void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+MSC+SHT0_2; // Turn on ADC12, set sampling time
ADC12CTL1 = SHP+CONSEQ_1; // Use sampling timer, single sequence
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = INCH_2; // ref+=AVcc, channel = A2
ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ENC; // Enable conversions

while(1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
}
}

#pragma vectorC12_VECTOR
__interrupt void ADC12ISR (void)
{
results[0] = ADC12MEM0; // Move results, IFG is cleared
results[1] = ADC12MEM1; // Move results, IFG is cleared
results[2] = ADC12MEM2; // Move results, IFG is cleared
results[3] = ADC12MEM3; // Move results, IFG is cleared
_BIC_SR_IRQ(LPM0_bits); // Clear LPM0, SET BREAKPOINT HERE
}

Repeat sequence of conversion:
A sequence of channels is sampled and converted repeatedly

#include

#define Num_of_Results 8

static unsigned int A0results[Num_of_Results]; // These need to be global in
static unsigned int A1results[Num_of_Results]; // this example. Otherwise, the
static unsigned int A2results[Num_of_Results]; // compiler removes them because
static unsigned int A3results[Num_of_Results]; // they are not used

void main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL = 0x0F; // Enable A/D channel inputs
ADC12CTL0 = ADC12ON+MSC+SHT0_8; // Turn on ADC12, extend sampling time
// to avoid overflow of results
ADC12CTL1 = SHP+CONSEQ_3; // Use sampling timer, repeated sequence
ADC12MCTL0 = INCH_0; // ref+=AVcc, channel = A0
ADC12MCTL1 = INCH_1; // ref+=AVcc, channel = A1
ADC12MCTL2 = INCH_2; // ref+=AVcc, channel = A2
ADC12MCTL3 = INCH_3+EOS; // ref+=AVcc, channel = A3, end seq.
ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion
_BIS_SR(LPM0_bits + GIE); // Enter LPM0, Enable interrupts
}

#pragma vectorC12_VECTOR
__interrupt void ADC12ISR (void)
{
static unsigned int index = 0;

A0results[index] = ADC12MEM0; // Move A0 results, IFG is cleared
A1results[index] = ADC12MEM1; // Move A1 results, IFG is cleared
A2results[index] = ADC12MEM2; // Move A2 results, IFG is cleared
A3results[index] = ADC12MEM3; // Move A3 results, IFG is cleared
index = (index+1)%Num_of_Results; // Increment results index, modulo; Set Breakpoint here
}

All the programs are tested in Both TI CCE and IAR Workbench complier.

Further detail please visit to TI for example related to your chip
http://focus.ti.com/mcu/docs/mcuflashtools.tsp?sectionId&tabId38&familyId42

Regards
Bala B
--- In m..., Technical Kripa wrote:
>
> Thanks..!
> what about single conversion and repeated conversion...?
>
> --- On Sat, 11/7/09, balagangadharan_raja1122 wrote:
> From: balagangadharan_raja1122
> Subject: [msp430] Re: ADC Conversions type
> To: m...
> Date: Saturday, 11 July, 2009, 2:58 AM
> Single conversion - ADC conversion for only one channel which is activated/selected.
>
> sequence of conversions - ADC conversion for number of channel which is activated.
>
> Regards
> B.Bala
>
> --- In msp430@yahoogroups. com, Technical Kripa wrote:
> >
> > What is the difference between "sequence of conversions" and "single conversion" for ADC in MSP430??
> >
> >
> > Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads. yahoo.com/ in/internetexplo rer/
> >
> >
> > Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.com
>
>
>


The 2024 Embedded Online Conference