本帖最后由 hwk612167 于 2012-10-11 20:16 编辑
以下为官方例程部分,RTC_C肯定解锁了,控制寄存器能写,但年月日等寄存器都不能写,写了没反应,不知什么问题?百度搜了下,碰到我这中问题的有几个,如http://bbs.**/viewthread.php?tid=348265&page=1&extra=page%3D1#pid1390909
http://bbs.**/thread-325917-1-1.html
// Configure RTC_C
RTCCTL0_H = RTCKEY_H; // Unlock RTC_C module
RTCCTL0_L |= RTCTEVIE | RTCAIE | RTCRDYIE; // Enable RTC time event, alarm event,
// read ready interrupt
RTCCTL1 |= RTCBCD | RTCHOLD; // RTC enable BCD mode, RTC hold
RTCYEAR = 0x2011; // Year = 0x2011 = 2011
RTCMON = 0x12; // Month = 0x12 = December
RTCDAY = 0x05; // Day = 0x05 = 5th
RTCDOW = 0x03; // Day of week = 0x03 = Wednesday
RTCHOUR = 0x24; // Hour = 0x12
RTCMIN = 0x59; // Minute = 0x57
RTCSEC = 0x55; // Seconds = 0x36
RTCADOWDAY = 0x3; // RTC Day of week alarm = 0x2
RTCADAY = 0x22; // RTC Day Alarm = 0x22
RTCAHOUR = 0x23; // RTC Hour Alarm
RTCAMIN = 0x45; // RTC Minute Alarm
RTCCTL1 &= ~(RTCHOLD); // Start RTC calendar mode
RTCCTL0_H = 0; // Lock RTC_C module |