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

CCS/MSP430FR5994: ADC12 minimum voltage detection or detecting shut off voltage

$
0
0

Part Number:MSP430FR5994

Tool/software: Code Composer Studio

Hi, I've been trying to store the system clock cycle just before it shuts off in FRAM

to do that I've been using the adc12 windows comparater

for the high voltage threshold i set it to 2.3 and the low threshold to 1.9

but the low threshold interrupt never goes off when it is 1.9 or even 2 it works fine if the threshold is at around 2.1 

I'm wondering what is the minimum voltage detection of the ADC12 and if its not as low as 1.9 or 1.8 which i suspect, what else can i use to detect a low voltage such as 1.8 to 1.9

Thanks for any help and the code that i used is posted below 

void initAdcMonitor()
{
    /* Initialize timer for ADC trigger. */
    TA0CCR0 = (SMCLK_FREQUENCY/ADC_MONITOR_FREQUENCY);
    TA0CCR1 = TA0CCR0/2;
    TA0CCTL1 = OUTMOD_3;
    TA0CTL = TASSEL__SMCLK | MC__UP;

    /* Configure internal 2.0V reference. */
    while(REFCTL0 & REFGENBUSY);
    REFCTL0 |= REFVSEL_1 | REFON;
    while(!(REFCTL0 & REFGENRDY));

    ADC12CTL0 = ADC12SHT0_2 | ADC12ON;
    ADC12CTL1 = ADC12SHS_1 | ADC12SSEL_0 | ADC12CONSEQ_2 | ADC12SHP;
    ADC12CTL3 = ADC12BATMAP;
    ADC12MCTL0 = ADC12INCH_31 | ADC12VRSEL_1 | ADC12WINC;
    ADC12HI = (uint16_t)(4096*((ADC_MONITOR_THRESHOLD+0.4)/2)/(2.0));
    ADC12LO = (uint16_t)(4096*(ADC_MONITOR_THRESHOLD/2)/(2.0));
    ADC12IFGR2 &= ~(ADC12HIIFG | ADC12LOIFG | ADC12INIFG);
    ADC12IER2 = ADC12INIE;
    ADC12CTL0 |= ADC12ENC;
}
#pragma vector = ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{
    switch(__even_in_range(ADC12IV, ADC12IV_ADC12LOIFG)) {
        case ADC12IV_NONE:        break;        // Vector  0: No interrupt
        case ADC12IV_ADC12OVIFG:  break;        // Vector  2: ADC12MEMx Overflow
        case ADC12IV_ADC12TOVIFG: break;        // Vector  4: Conversion time overflow
        case ADC12IV_ADC12HIIFG:                // Vector  6: Window comparator high side
            /* Disable the high side and enable the low side interrupt. */
            break;
        case ADC12IV_ADC12INIFG:

            check = 0;
            ADC12IER2 &= ~ADC12INIE;
            ADC12IER2 |= ADC12LOIE;
            ADC12IFGR2 &= ~ADC12LOIFG;
            break;
        case ADC12IV_ADC12LOIFG:                // Vector  8: Window comparator low side
            //P1OUT |= BIT1;
            P1OUT &=~ BIT0;
            //P1OUT |= BIT0;
            count = count+1;
            status = nvs_data_commit(nvsHandle4, &count);
            /* Disable the low side and enable the high side interrupt. */
            ADC12IER2 &= ~ADC12LOIE;
            ADC12IER2 |= ADC12INIE;
            ADC12IFGR2 &= ~ ADC12INIFG;
            break;
        default: break;
    }
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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