[TI首届低功耗设计大赛]+实时时钟
借助RTC实现个
实时时钟
通过触摸设置参数
初始化
static void Clock_App_init(void)
{
Calendar clockCalendar;
//RTC_B_holdClock(__MSP430_BASEADDRESS_RTC_B__); //关闭RTC
// Disable CapSense Pins
//GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN3 | GPIO_PIN4 | GPIO_PIN5);
//GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN4 | GPIO_PIN5 | GPIO_PIN6);
//RTC 停止,再初始化
if((RTCCTL1&0x40)==0x40)
{
clockCalendar.Seconds = 0; // Set clock to generic time
clockCalendar.Minutes = 37;
clockCalendar.Hours = 16;
clockCalendar.DayOfWeek = 6;
clockCalendar.DayOfMonth = 22;
clockCalendar.Month = 11;
clockCalendar.Year = 2014;
//初始化设置操作RTC日历模式
RTC_B_calendarInit(__MSP430_BASEADDRESS_RTC_B__, clockCalendar, RTC_B_FORMAT_BINARY);
RTCSEC = 0; // Reset seconds
RTC_B_definePrescaleEvent(__MSP430_BASEADDRESS_RTC_B__, RTC_B_PRESCALE_1, RTC_B_PSEVENTDIVIDER_128);
RTC_B_enableInterrupt(__MSP430_BASEADDRESS_RTC_B__, RTC_B_PRESCALE_TIMER1_INTERRUPT);
RTC_B_startClock(__MSP430_BASEADDRESS_RTC_B__); //开始RTC
setClock = 0;
}
oldSliderPos[0] = 20;
oldSliderPos[1] = 20;
sliderPos[0] = 20;
sliderPos[1] = 20;
}