Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

MSP430FG4618: ADC12 MSP430FG4618 unstable

$
0
0

Part Number:MSP430FG4618

Hello,

I'm having trouble instability in the conversion of channel ADC12 of MSP430FG4618.

At each reading and conversion, it shows a conversion variation and values.

Here is the snippet of code for review:

P2OUT &=~ BIT0; // Habilita o Circuito de Alimentação do Sensor de Pressão
P6SEL = 0x0F; // Seleciona o AD0 como entrada A/D
ADC12CTL0 = SHT0_15 + REF2_5V + REFON + ADC12ON; //Sample-and-hold time, 1024 cycles, Referencia 2,5V (ON), ADC12 on
ADC12CTL1 = SHP + ADC12DIV_7; // Sampling timer, Sourse: ADC12SC, divide por 8
ADC12MCTL0 = SREF_1; // Canal 10, Vref+
ADC12IE = 0x01; // Enable interrupt
ADC12CTL0 |= ENC;
ADC12CTL0 |= ADC12SC; // Start conversion
pressao_manometrica = (((long)ADCresult - zero) * 264.00)/4095;
for (unsigned long int i = 0; i < 500; i++); // Loop para Temporização
P2OUT |= BIT0; // Desabilita o Circuito de Alimentação do Sensor de Pressão
ADC12CTL0 = 0; // Desabilita o ADC12
ADC12CTL0 = 1;
ADC12CTL1 = 0;
ADC12CTL1 = 1;
ADC12CTL0 &=~ ENC; // Desabilita a Interrupção do Conversor ADC12

//////////////////////////////////////////////////////////////////////////
// Tratamento da interrupção do Conversor AD 12Bits
//////////////////////////////////////////////////////////////////////////
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
{
ADCresult = ADC12MEM0;
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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