Hello! everyone.
I want to trigger the ADC12 with Timer B.
My plan is Timer B triggers ADC12 about once per 0.1 second.
I configurated the timer B and ADC12. But it didnt worked. where am i missing?
I understood if i SHS in ADC12CTL1 is '10' (TIMER B), ADC12 work every 0.1 seconds.
Did i get it wrong?
My code was working only the first conversion is performed, then not working.
This is my code under the text.
Timer B = UpMode, ACLK, output = toogle ADC12 = A0, Single channel single-conversion, Vref = 2.5V
ACLK = 32,768 Hz
TB0CCR0 = 3275; TB0CTL |= TIMER_B_MC_UP + TIMER_B_TBSSEL_ACLK; TB0CCTL0 = TIMER_B_CCIE+TIMER_B_OUTMOD_4; TB0CTL |= TIMER_B_TBCLR; P6SEL |= BIT0; REFCTL0|= REFON + REFMSTR + REFVSEL_2 + REFTCOFF; ADC12CTL0 |= ADC12ON + ADC12SHT0_2; ADC12CTL1 |= ADC12SHS_2 + ADC12SHP; ADC12MCTL0 |= ADC12SREF_1; ADC12IE |= ADC12IE0; ADC12CTL0 |= ADC12SHS_2 + ADC12ENC; // temp variable = Global variable #pragma vector = ADC12_VECTOR __interrupt void ADC12_A_ISR(void) { static int i =0; switch(_even_in_range(ADC12IV, 0x24)) { case 0x06: if(i==10) i = 0; temp[i++] = ADC12MEM0; break; default: break; } }
Not using ADC12SC. Because it's not precise.
Anyone help me~!