HOW TO ENTER INTO LPM3 MODE WHEN POWER OFF
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.
#include "driverlib.h"
#include <stdint.h>
Calendar currentTime;
char TIME[10],DATE[12];
char SEC_OK ;
uint16_t PWROFF,MNTH,YER;
int main(void)
{
WDT_A_hold(WDT_A_BASE);
PMM_unlockLPM5();
INIT_PORTS();
INIT_CLOCKS();
LCD_INIT();
INIT_ADC();
if (SYSRSTIV == SYSRSTIV_LPM5WU)
{
RTC_C_clearInterrupt(RTC_C_BASE, RTC_C_CLOCK_READ_READY_INTERRUPT|RTC_C_OSCILLATOR_FAULT_INTERRUPT);
RTC_C_enableInterrupt(RTC_C_BASE,RTC_C_CLOCK_READ_READY_INTERRUPT|RTC_C_OSCILLATOR_FAULT_INTERRUPT);
RTC_C_startClock(RTC_C_BASE);
}
SET_TIME_AND_ALRM();
__bis_SR_register(GIE);
SEC_OK = 0;
PWROFF = 0;
while(1)
{
if(PWROFF ==0)
{
if(SEC_OK == 1)
{
//ADC MEASURES THE INPUT
currentTime = RTC_C_getCalendarTime(RTC_C_BASE);
}
}
else
{
__bis_SR_register(LPM3_bits | GIE);
}
}
}
#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
{
switch(__even_in_range(RTCIV, 16))
{
case RTCIV_NONE: break; //No interrupts
case RTCIV_RTCOFIFG: break; //RTCOFIFG
case RTCIV_RTCRDYIFG: //RTCRDYIFG
SEC_OK = 1;
break;
case RTCIV_RTCTEVIFG: //RTCEVIFG
//Interrupts every minute
__no_operation();
break;
case RTCIV_RTCAIFG: //RTCAIFG
__no_operation();
break;
case RTCIV_RT0PSIFG:
__bic_SR_register_on_exit(LPM3_bits);
break; //RT0PSIFG
case RTCIV_RT1PSIFG:
__bic_SR_register_on_exit(LPM3_bits);
break; //RT1PSIFG
default: break;
}
}
#pragma vector=PORT1_VECTOR
__interrupt void RTC_INTIAL(void)
{
if(GPIO_getInterruptStatus(GPIO_PORT_P1, GPIO_PIN1))
{
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN2);
PWROFF = 1;
}
if(GPIO_getInterruptStatus(GPIO_PORT_P1, GPIO_PIN1))
{
GPIO_clearInterrupt(GPIO_PORT_P1, GPIO_PIN2);
__bic_SR_register_on_exit(LPM3_bits);
}
}
FROM ABOVE I HAD GIVEN A BATTERY BACKUP WITH A DIODE TO DVCC
AND A CIRCUIT WHICH TRIGGERS THE P1.1 WHEN POWER ON AND P1.2 WHEN POWER OFF
MY QUESTION IS WHEN I PRESS A RESET BUTTON RTC REGISTERS BECOMES RESET THAT IS RTC IS NOT CONTINUING TO RUN FROM PREVIOUS
**Attention** This is a public forum