Hello,
I'm making an app using msp430 F2272 to measure the battery voltage each second. It means that i have to do the measurement etc. then it must go to sleep and after 1 second do the same procedure again. Here is what i will use for measurment:
TACCTL0 &= ~CCIE;
ADC10CTL1 = INCH_1 + CONSEQ_2;
ADC10CTL0 = SREF_1 + REFON + REF2_5V + ADC10ON + ADC10SHT_3 + ADC10IE; // use internal ref, turn on 2.5V ref or 1.5V, set samp time = 64 cycles
ADC10AE0 |= 0x02 ; // analog input enable for A1
ADC10CTL0 |= ENC + ADC10SC; // Enable conversions
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
while (!(ADC10CTL0 & ADC10IFG)); // while reading is finished
adcValue = ADC10MEM;
if (adcValue>= batLow)
{
LED_GREEN();
}
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
return adcValue;
Then I'm thinking of making a sleep() function. I have added that ISR but i'm not sure how to use it exactly.
Can you give me some ideas/suggestions and also what you think about the measurement function. I will appreciate any comment.
Vasil