|
请问一下,我移植了UCOS与UCGUI,想用RTC来显示实时时间问题,但一进RTC中断发现程序跑飞了,后面的程序都死了,请问是什么原因?
static void AppTaskStart (void *p_arg)
{
(void)p_arg;
BSP_Init(); /* Initialize BSP functions */
GUI_Init();
cursor_Init();
MainMenu();
RTC_APP();
for(;;)
OSTimeDly(400);
}
RTC_APP()程序如下:
/*****************************************************************************
** Main Function main()
******************************************************************************/
void RTC_APP (void)
{
int i;
/* Initialize RTC module */
RTCInit();
local_time.RTC_Sec = 0;
local_time.RTC_Min = 0;
local_time.RTC_Hour = 0;
local_time.RTC_Mday = 6;
local_time.RTC_Wday = 3;
local_time.RTC_Yday = 12; /* current date 07/12/2008 */
local_time.RTC_Mon = 8;
local_time.RTC_Year = 2008;
RTCSetTime( local_time ); /* Set local time */
alarm_time.RTC_Sec = 0;
alarm_time.RTC_Min = 0;
alarm_time.RTC_Hour = 0;
alarm_time.RTC_Mday = 1;
alarm_time.RTC_Wday = 0;
alarm_time.RTC_Yday = 1; /* alarm date 01/01/2009 */
alarm_time.RTC_Mon = 1;
alarm_time.RTC_Year = 2009;
RTCSetAlarm( alarm_time ); /* set alarm time */
/* install RTC timer handler mainly for alarm control */
if ( install_irq( RTC_INT, (void *)RTCHandler, HIGHEST_PRIORITY ) == FALSE )
{
while ( 1 ); /* very bad happened */
}
/* mask off alarm mask, turn on IMYEAR in the counter increment interrupt
register */
RTCSetAlarmMask(AMRSEC|AMRMIN|AMRHOUR|AMRDOM|AMRDOW|AMRDOY|AMRMON|AMRYEAR);
CIIR = IMMIN | IMYEAR;
/* 2007/01/01/00:00:00 is the alarm on */
GUI_DispDecAt(current_time.RTC_Sec,200,200,2);
RTCStart();
while (1)
{
current_time = RTCGetTime();
GUI_DispDecAt(current_time.RTC_Sec,250,250,2); //此处没法显示时间,程序跑不到这里
RTC = ¤t_time;
FormatDate(RTC,Year_Mon_Day);
UARTSend(" ",3);
FormatTime(RTC,Hour_Minu_Miao);
i=10000000;
while(i)
{i--;}
}
}
请高人指点迷津。
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|