EmbeddedRelated.com
Forums

adc10 sequence sampling problem

Started by markl963 October 27, 2008
Hi all,
I have a bit of problem with sequence adc sampling on the msp430F22x2.
I trying to sample five channels sequentially but it seem the data
transfer stop working after sampling the first three channels. Has
anyone come across this problem before? I am using a MSP430F2232
micro & rowley.

#include "msp430x22x2.h"
unsigned result[5];

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL1 = INCH_2 + CONSEQ_1; // A2/A1/A0, single sequence
ADC10CTL0 = ADC10SHT_2 + MSC + ADC10ON + ADC10IE;
ADC10DTC1 = 0x05; // 5 conversions
ADC10AE0 |= 0x1F; // P2.4,3,2,1,0 ADC10
option select
P1DIR |= 0x01; // Set P1.0 output

for (;;)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY); // Wait if ADC10 core is
active
ADC10SA = (unsigned int)&result; // Data
buffer start
P1OUT |= 0x01; // P1.0 = 1
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion
start
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will
force exit
P1OUT &= ~0x01; // P1.0 = 0
}
}

// ADC10 interrupt service routine
void adc10_isr (void) __interrupt[ADC10_VECTOR]
{
__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
}
mark

Beginning Microcontrollers with the MSP430

your code is telling it to only sample the 1st 3 channels.. look at the comments you copied!.. a2,a1,a0 says it all

the "5 conversions" means 5sample sequences, so 3 channles are each sampled 5 times
I didn;t check if all the necessary its are set to actually do the above..


--- On Mon, 10/27/08, markl963 wrote:

From: markl963
Subject: [msp430] adc10 sequence sampling problem
To: m...
Date: Monday, October 27, 2008, 8:31 AM

Hi all,
I have a bit of problem with sequence adc sampling on the msp430F22x2.
I trying to sample five channels sequentially but it seem the data
transfer stop working after sampling the first three channels. Has
anyone come across this problem before? I am using a MSP430F2232
micro & rowley.

#include "msp430x22x2. h"
unsigned result[5];

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
ADC10CTL1 = INCH_2 + CONSEQ_1; // A2/A1/A0, single sequence
ADC10CTL0 = ADC10SHT_2 + MSC + ADC10ON + ADC10IE;
ADC10DTC1 = 0x05; // 5 conversions
ADC10AE0 |= 0x1F; // P2.4,3,2,1,0 ADC10
option select
P1DIR |= 0x01; // Set P1.0 output

for (;;)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY); // Wait if ADC10 core is
active
ADC10SA = (unsigned int)&result; // Data
buffer start
P1OUT |= 0x01; // P1.0 = 1
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion
start
__bis_SR_register( CPUOFF + GIE); // LPM0, ADC10_ISR will
force exit
P1OUT &= ~0x01; // P1.0 = 0
}
}

// ADC10 interrupt service routine
void adc10_isr (void) __interrupt[ ADC10_VECTOR]
{
__bic_SR_register_ on_exit(CPUOFF) ; // Clear CPUOFF bit from 0(SR)
}

mark




Hi Joe,
It's a typo. I did change to INCH_4 but it still doesn't work.
However, I did found our the main cuase of the problem, it was a slow
MCLK. I was running the mclk @ ~150khz but changing to 800khz fixed
the problem. thx for your help anyway .

Mark

--- In m..., Joe Radomski wrote:
>
> your code is telling it to only sample the 1st 3 channels.. look at
the comments you copied!.. a2,a1,a0 says it all
>
> the "5 conversions" means 5sample sequences, so 3 channles are
each sampled 5 times
> I didn;t check if all the necessary its are set to actually do the
above..
>
>
> --- On Mon, 10/27/08, markl963 wrote:
>
> From: markl963
> Subject: [msp430] adc10 sequence sampling problem
> To: m...
> Date: Monday, October 27, 2008, 8:31 AM
>
>
>
>
>
>
> Hi all,
> I have a bit of problem with sequence adc sampling on the msp430F22x2.
> I trying to sample five channels sequentially but it seem the data
> transfer stop working after sampling the first three channels. Has
> anyone come across this problem before? I am using a MSP430F2232
> micro & rowley.
>
> #include "msp430x22x2. h"
> unsigned result[5];
>
> void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD; // Stop WDT
> ADC10CTL1 = INCH_2 + CONSEQ_1; // A2/A1/A0, single sequence
> ADC10CTL0 = ADC10SHT_2 + MSC + ADC10ON + ADC10IE;
> ADC10DTC1 = 0x05; // 5 conversions
> ADC10AE0 |= 0x1F; // P2.4,3,2,1,0 ADC10
> option select
> P1DIR |= 0x01; // Set P1.0 output
>
> for (;;)
> {
> ADC10CTL0 &= ~ENC;
> while (ADC10CTL1 & BUSY); // Wait if ADC10 core is
> active
> ADC10SA = (unsigned int)&result; // Data
> buffer start
> P1OUT |= 0x01; // P1.0 = 1
> ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion
> start
> __bis_SR_register( CPUOFF + GIE); // LPM0, ADC10_ISR will
> force exit
> P1OUT &= ~0x01; // P1.0 = 0
> }
> }
>
> // ADC10 interrupt service routine
> void adc10_isr (void) __interrupt[ ADC10_VECTOR]
> {
> __bic_SR_register_ on_exit(CPUOFF) ; // Clear CPUOFF bit from 0(SR)
> }
>
> mark
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>