Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: Msp430g2553 ADC clock division

$
0
0
Hi celeb ' I don't know how to thank you for that great support and your time. after your modification now i can read adc signal as the rang i expect . but for some reasons i can't read the full data sent ( transmitter send infrared signal) . By the way i have that code works well by avr atmega family . so i think the main problem in the different adc registers between msp430 family and atmega family. the code i use as follows . void ADC_setup(){ ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE ; ADC10CTL1 |= ADC10DIV_7 + ADC10SSEL_2 ; // Set ADC source clock to MCLK (1MHz) and divide by 8 = 125kHz } void conversion_start(void){ ADC10AE0 &= ~(0x07) ; //clearing enabled channels ADC10CTL1 = INCH_1; // input A1 ADC10AE0 |= 0x02; // PA.1 ADC option select ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start } int conversion_read(void){ while( ADC10IFG < 0) ; // adc flag that mean finish conversion equal to " while(bit_is_set(ADCSRA, ADSC)); " in avr return ADC10MEM ; // ADC10MEM register equal adc register in avr } i have great Doubt in that two lines of code ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start and while( ADC10IFG < 0) ; // adc flag that mean finish conversion thanks in advance .

Viewing all articles
Browse latest Browse all 62309

Trending Articles



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