Sort of off topic discussion, 

You don't have the corresponding IE set in the ADC12IE control register.  You 
need:
    ADC12IE = 0x1;                // Select IRQ for ADCMEM0
    ADC12MCTL0 = INCH_0 + SREF_0; // Select channel A0, AVcc
As for ADC12MCTL0, I never like trusting that these variables will be set to 
all zero's,
so I make sure to initiate to whatever I want, even set it to zero if that's 
what I
want.
Make sure to capture the data from the ADC like this:

interrupt (ADC_VECTOR) ADCIRQ(void)
{
    adcraw = ADC12MEM0;  // Move results, IFG is auto-cleared
}

Also, probably want to declare adcraw as volatile.  Remember, if you access it 
twice in
the same main loop, you might get different results.  So, only access it once 
(per
loop).

In fact, the method I described has a few other differences.  I suggested 
having the
TimerA IRQ trigger the Start conversion.  In order to do that, set:
    ADC12CTL1 = SHP;    // ADC12SC starts conversion
    TACTL = TASSEL_2+MC_2+TAIE;  // Timer_A setup
And add this line to the TimerA IRQ routine:
interrupt (TIMERA1_VECTOR) TimerA1( void )
{
    ADC12CTL0 |= ADC12SC;    // Perform one conversion
}

Hope this doesn't make things more confusing.  The ADC is definitely confusing. 
 Also,
I'm not an expert at using TimerA in this regards.  I am using TimerB similar 
to this (I
know, they are similar, etc).  One more thing.  Make sure SMCLK is running.  
Might be
better to recalculate the TimerA frequency based on ACLK, that way all of this 
can
happen in LPM3.  To test SMCLK, just set it to be output on the SMCLK output
(temporarily).  Also, a quick LED and a simple code toggle on the TimerA IRQ 
would let
you know the ADC is being told to start.
Enjoy and good luck!
-Mark 



-----Original Message-----
From: Gao Zhengsu [mailto:g...@clarkson.edu] 
Sent: Wednesday, April 14, 2004 1:44 PM
To: mspgcc-users@lists.sourceforge.net
Subject: Re: [Mspgcc-users] About msp430x149


Hi,Mark 
        Thank you for your good way!!
        I read manual said that we can use TamerA OUTPUT UNIT1 to trigger ADC12 
conversion like this

  TACTL = TASSEL_2+MC_2;                // Timer_A setup
  TACCTL1 = OUTMOD_3;                   // CCR1 setup
  TACCR1 = 0x0fff;                      // Compare value
  
  ADC12CTL0 = ADC12ON+SHT0_2;           // Turn on ADC12, set sampling time
  ADC12CTL1 = SHS_1+SHP;                // TAOUT.1 triggers sampling timer
    ADC12CTL0 |= ENC;                   // Enable conversions
    ADC12CTL0 |= ADC12SC;               // Start conversion

but this doen's work to my code , it never stop by ADC interrupt routine. 
What's the reason?
Thank you!
Regards
Zhengsu
 



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to