Skip to content
Alex edited this page Jul 13, 2020 · 4 revisions

RTC which stands for Real Time Clock is a set of instructions provided by CC430 which can control the internal timer used for timekeeping and logging purposes such as retrieving time & date based events (e.g. at 12:34 on 12-04-2017 something happened) as well as triggering alarms at specified time & dates. Such instructions are independent on the core CPU so low powered applications can benefit from this API. The following instructions can be used:

RTCDATA rtcData; //Required to instantiate RTC object first
panstamp.rtc.startCalendar(&rtcData); //Start RTC module in calendar mode, rtcData pointer to struct containing date, time and alarm information declared bellow
panstamp.rtc.startCalendar(); //Start/continue RTC module in calendar mode
panstamp.rtc.stopCalendar(); //Stop/halt RTC module in calendar mode
panstamp.rtc.sleep(uint16_t time, RTCSRC source=RTCSRC_VLO); //Put panStamp into Power-down state during "time". * @param time Sleeping time in seconds * @param ACLK source (RTCSRC_XT1 or RTCSRC_VLO)
panstamp.rtc.calendarIsRunning; //Check if calendar running, (returns a bool)
panstamp.rtc.disableAlarm(); //Enable/disable RTC alarm

//Setting values for alarm calendar
panstamp.rtc.setAlarmDayOfMonth(uint8_t day); //Set RTC alarm - Day of month * @param day Day of month (1 to 31)
panstamp.rtc.setAlarmDayOfWeek(uint8_t dow);//Set RTC alarm - Day of week * @param dow Day of week (0 to 6)
panstamp.rtc.setAlarmHour(uint8_t hour) ; //Set RTC alarm - Hour * @param hour Hour (0 to 23)
panstamp.rtc.setAlarmMinutes(uint8_t min); // Set RTC alarm - Minutes * @param min Minutes day (0 to 59)

//Setting/declaring the time & date
rtcData.year = year;  // Year
rtcData.mon = month; //1 to 12
rtcData.day = day; //1 to 31
rtcData.wday = dow  //Day of the week - 0 to 6
rtcData.hour = hour //0 to 23
rtcData.min = min; //0 to 59
rtcData.sec = sec; //0 to 59

//Retreive the time/date data from the register/MCU
RTC_GET_YEAR();
RTC_GET_MONTH();
RTC_GET_DAY();
RTC_GET_DOW();
RTC_GET_HOUR();
RTC_GET_MIN();
RTC_GET_SEC();