This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi everyone,
I had a problem about adc12 single channel single conversation modes. I cannot read A1,A2,A3... just can read A0 when i select single channel mode i cannot configure it. Accualy I dont want to use interrupt services , start the conversion wait them finish and save the result. But first need read A1,A2,A3... with single channel single conversation. here is my code ;
int main(void) { P6SEL |= 0x02; // P6.1 ADC option select WDTCTL = WDTPW + WDTHOLD; // Stop WDT ADC12CTL0 = SHT0_2 + ADC12ON +ENC+CSTARTADD_1; // Set sampling time, turn on ADC12 ADC12CTL1 = SHP; // Use sampling timer ADC12MCTL1 = INCH_1; ADC12IE = 0x02; // Enable interrupt ADC12CTL0 |= ADC12SC; // start conversion while(1){ ADC12CTL0 |= ADC12SC; } } #pragma vector=ADC12_VECTOR __interrupt void ADC12_ISR (void) { int a; a = ADC12MEM1; }
of course :) .
that code i used for single channel single conversation mode ;
#include <msp430.h> /*ADC12MCTL0 register used for select input adc pin memory always writing ADC12MEM0 if you place debug point in if state u can see just how is working */ int main(void) { P6SEL |= 0xB67; // ADC option select WDTCTL = WDTPW + WDTHOLD; // Stop WDT ADC12CTL0 = SHT0_8 + ADC12ON; // Set sampling time, turn on ADC12 ADC12CTL1 = SHP; // Use sampling timer ADC12MCTL0 = INCH_5+EOS; // u can change there INCH_7//INCH_0//INCH_4//INCH_2//INCH_1 //ADC12IE = 0x01; // Enable interrupt ADC12CTL0 |= ENC; // start conversion ADC12CTL0 |= ADC12SC; // start conversion __enable_interrupt(); while(1){ if(ADC12CTL1 & ADC12BUSY){ //ADC12CTL0 |= ADC12SC; // start conversion __no_operation(); } } }
**Attention** This is a public forum