We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi!
I am try to wake up after 1 minute using RTC(Real Time Clock) on XC164CS(. I checked sleep mode is working well, but I think some settings are missed. When I read the user manunal especillay RTC part, I found a clue when user enter the sleep mode the system clock stop completely and the RTC would stop counting. In this case RTC can be switched to Asynchrous mode. Firt time I set synchrous mode(defualt setting) which is setted by DAVE. and it does not wake up. And then I try to change Asynchronous mode, It also did not working. I think it may be missing. Please let me know what is the problem?
E-mail : hssong@katech.re.kr
Below is my test program.
// RTC function // 1 min RTC interrupt setting void RTC_vInit(void) { MAIN_vUnlockProtecReg(); //unlock SYSCON0 SYSCON0_RTCCM = 1; // disable access to control bits while((RTC_CON & 0x8000) == 0x8000); RTC_CON = 0x0002; // load RTC control register /// - overflow period on T14: 1.0000 [s] /// - overflow period on CNT0: 1.0000 [min] /// - overflow period on CNT1: 1.0000 [h] /// - overflow period on CNT2: 1.0000 [days] /// - overflow period on CNT3: 1.0139 [years] RTC_T14REL = 0x85EE; // load T14 count/reload register RTC_RTCL = 0x13C4; // load RTC low register RTC_RELL = 0x13C4; // load RTC reload low register RTC_RTCH = 0xA4E8; // load RTC high register RTC_RELH = 0xA4E8; // load RTC reload high register // ----------------------------------------------------------------------- /// Configuration of the used RTC Interrupts: /// ----------------------------------------------------------------------- /// RTC service request node configuration: /// - RTC interrupt priority level (ILVL) = 7 /// - RTC interrupt group level (GLVL) = 0 /// - RTC group priority extension (GPX) = 0 RTC_IC = 0x005C; RTC_ISNC = 0x0004; // load RTC interrupt sub node register } // RTC Interrupt routine void RTC_viRTC(void) interrupt RTCINT { if(RTC_ISNC_0IR) // if counter CNT0 overflow { RTC_flag = 1; RTC_ISNC_0IR = 0; } } // End of function RTC_viRTC // main() function void main() { // 1 min RTC Interrupt setting RTC_vInit(); // RTC RUN RTC_CON_RUN = 1; // Enter sleep mode Enter_Sleep_mode(); // it is user coding , its ok // After 1 min. RTC wake up if(RTC_flag == 1){ printf("RTC wake up OK \n"); } }