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.

MSP430FR59941: unable to write to ADC12CTL0

Part Number: MSP430FR59941

Dear Sirs:

    I'm using the ADC12B  a/d converter to measure temperature sensor.  It is fast enough to not need to run under interrupt.  It works for a while then starts reading 0.

The initialization doesn't seem to be able to write to ADC12CTL0 register.  The function is as follows:

// Configure ADC12 whenever ADC12ENC=0
ADC12CTL0 &= ~ADC12ENC; //set ADC12ENC to 0                                                                             ADC12CTL0 reads 0x800 after this instr

ADC12CTL0 = (ADC12ON + ADC12SHT0_2 ); // Turn on ADC12, set sampling time                           ADC12CTL0 still reads 0800 after this instr
ADC12CTL1 = ADC12SHP; // Use sampling timer. ADC12SHP is sample and hold pulse
ADC12CTL2 = ADC12RES_2; // 12-bit conversion results


ADC12MCTL0 = ADC12INCH_15 | ADC12VRSEL_4; // Vr+ = VeREF+ (ext) and Vr-=AVss, inch_15 =A15, inch_12=A12 P3.0
//ADC12MCTL0 = ADC12INCH_30 | ADC12VRSEL_4; // temp sensor is x1E=30d
ADC12CTL0 |= ADC12ENC; // Enable conversions.

_disable_interrupts();
ADC12CTL0 |= ADC12SC; // Start conversion-software trigger
while (!(Stat & BIT0)) //always BIT0
Stat=ADC12IFGR0;;
ADCvar = ADC12MEM0; // Read conversion result (1st conv goes into mem0 apparently)
__no_operation(); // SET BREAKPOINT HERE

_enable_interrupts();
return ADCvar; //return bat V

Hope you can see what's wrong with this!

Thanks

John Moore

**Attention** This is a public forum