您好~我使用MSP430F6720
電路:AUXVCC1 ,AUXVCC2 接地,AUXVCC3 接電池
目的: 為了確保斷電後RTC_C 能透過電池能保持運作就好,其他周邊電源不須保持。
目前在CODE 的部分 先進行AUX 設定
因不須備用電源 關閉了AUX1 與 AUX2
AUXCTL1 |= AUX1MD|AUX2MD; // AUX2MD=1
AUXCTL1 &= ~(AUX1OK|AUX2OK); // AUX2OK=0
在 RTC init 時 運行
if (SYSRSTIV == SYSRSTIV_LPM5WU)
{
// When woken up from LPM3.5, reinit since LPMx.5 will cause a BOR.
PMMCTL0_H = PMMPW_H; // open PMM
PM5CTL0 &= ~LOCKIO; // Clear LOCKBAK and enable ports
PMMCTL0_H = 0x00; // close PMM
// Reconfigure RTC to read RTC registers
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL0_H))) = RTCKEY_H;
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) |= RTCHOLD;
(*((volatile uint16_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) &= ~(RTCBCD);
(*((volatile uint16_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) |= RTC_C_FORMAT_BCD;
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) &= ~(RTCHOLD);
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL0_H)))= 0x00;
}else{ // Reconfigure RTC to read RTC registers
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL0_H))) = RTCKEY_H;
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) |= RTCHOLD;
(*((volatile uint16_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) &= ~(RTCBCD);
(*((volatile uint16_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) |= RTC_C_FORMAT_BCD;
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL13_L))) &= ~(RTCHOLD);
(*((volatile uint8_t*)((uint16_t)RTC_C_BASE + OFS_RTCCTL0_H)))= 0x00;
}
// GPIO Port Configuration for lowest power configuration
P1OUT = 0x00;P2OUT = 0x00;P3OUT = 0x00;P4OUT = 0x00;P5OUT = 0x00;P6OUT = 0x00;
P7OUT = 0x00;P8OUT = 0x00;P9OUT = 0x00;PJOUT = 0x00;
P1DIR = 0xFF;P2DIR = 0xFF;P3DIR = 0xFF;P4DIR = 0xFF;P5DIR = 0xFF;P6DIR = 0xFF;
P7DIR = 0xFF;P8DIR = 0xFF;P9DIR = 0xFF;PJDIR = 0xFF;
RTC_C_setCalendarEvent(RTC_C_BASE,RTC_C_TIME_EVENT_INTERRUPT); RTC_C_setCalendarEvent(RTC_C_BASE,RTC_C_CALENDAREVENT_MINUTECHANGE);
RTC_C_enableInterrupt(RTC_C_BASE,RTCRDYIE + RTCTEVIE ); //Start RTC Clock
RTC_C_startClock(RTC_C_BASE);
但還是無法達到我所需要的目的
目的: 為了確保斷電後RTC_C 能透過電池能保持運作就好,其他周邊電源不須保持。
請教各位先進~~
灰小子:
楼主可以参考下这个帖子:http://www.deyisupport.com/question_answer/microcontrollers/msp430/f/55/p/46216/123552.aspx#123552