//时钟初始化函数
void RTC_Ini(void)
{
//PREINT = Fpclk / 32768 - 1; // 使用内部时钟,设置基准时钟分频器
//PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
YEAR = 2004; // 初化年
MONTH = 11; // 初化月
DOM = 1; // 初化日
CIIR = 0x01; // 设置秒值的增量产生一次中断
ILR = 0x03;
CCR = 0x11; // 启动RTC,使用独立时钟源
VICIntSelect = 0x00;
VICVectCntl3 = 0x20 | 13;
VICVectAddr3 = (int)RTC_Int;
VICIntEnable |= (1 << 13);
}
请问:在RTC_Int中断中怎么写?
答 1:
我的是这样的,希望能帮助你ILR = ILR; //清中断
SysInfo.DayTimePtr.Second = CTIME0&0x3f;
SysInfo.DayTimePtr.Minute = (CTIME0&0x3f00) >> 8;
SysInfo.DayTimePtr.Hour = (CTIME0&0x1f0000) >> 16;
SysInfo.DayTimePtr.Week = (CTIME0&0x7000000) >> 24;
SysInfo.DayTimePtr.Day = (CTIME1&0x1f);
SysInfo.DayTimePtr.Month = (CTIME1&0xf00) >> 8;
SysInfo.DayTimePtr.Year = ((CTIME1&0xfff0000) >> 16)%100;
if(WorkMode == CONTROL && DispEn.DateTime == 1) //刷新时间日期
{
DispDateTime();
}
VICVectAddr = 0; // 通知中断控制器中断结束 |