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

Msp430g2553 ADC clock division

$
0
0

dears "

i have msp430g2553 micro controller. which i want to make it run on 1 mega HZ clock from DCO which will be also the timer A clock.

and want my ADC clock to be 125 K HZ (125000 HZ) so i make the clock be from DCO and divide it by 8 as follows

void ADC_setup(){
    ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE+ADC10DIV_7;  // ADC10DIV_7 7 decimal mean 111 which mean divide by 8
 
    //enable_interrupt();
    TACCR0 = 30;                              // Delay to allow Ref to settle
      TACCTL0 |= CCIE;                          // Compare-mode interrupt.
      TACTL = TASSEL_2 | MC_1;                  // TACLK = SMCLK, Up mode.
      LPM0;                                     // Wait for delay.
      TACCTL0 &= ~CCIE;                         // Disable timer Interrupt
    //  __disable_interrupt();
}

and in main l make that

int main(void) {

    volatile int i = ADC10MEM ;

    WDTCTL = WDTPW | WDTHOLD;    // Stop watchdog timer

    BCSCTL1 = CALBC1_1MHZ;            // Set range   DCOCTL = CALDCO_1MHZ;
    BCSCTL2 &= ~(DIVS_3);            // SMCLK = DCO = 1MHz

}

the question here is ADC10DIV_7   mean divide the clock by 8    (1 MHZ / 8 = 125 KHZ) or it mean the number of division (1MHZ / 2 then (1MHZ / 2)/2 ......eight times )

any help will  appreciated .thanks in advance


Viewing all articles
Browse latest Browse all 21946

Trending Articles



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