AnsweredAssumed Answered

RTC Configuration

Question asked by Jairo Javier Sanchez on Dec 4, 2009
Latest reply on Dec 7, 2009 by Petr MacHala

Hi, i was working with an application using the RTC module, but i'm getting troubles with it. I based my code on the rtc example but apparently the System Clock is not working, i make consults to the time struct with an event, and then print it to terminal, but always display 00d 00hrs 00m 00s, the initialization code is posted below. I begin to have this problem when i implemented the ADC and another task that is checking for several alarms setted (this task has a _time_delay of 60s).

 

 


//__________________RTC_______________
    _rtc_init(RTC_INIT_FLAG_CLEAR | RTC_INIT_FLAG_ENABLE);
_rtc_get_time (&time_rtc);
_rtc_time_from_mqx_time (&time_mqx, &time_rtc);
_rtc_time_to_mqx_time (&time_rtc, &time_mqx);
    printf ("MQX: %d s, %d ms\n", time_mqx.SECONDS, time_mqx.MILLISECONDS);
printf ("    (%d d, %d hr, %d m, %d s)\n", time_rtc.days, time_rtc.hours, time_rtc.minutes, time_rtc.seconds);

 In the function for set the clock to the actual time:

 


printf("Tiempo guardado: %d:%d:00", hora,min);
time_rtc.hours=hora;
time_rtc.minutes=min;
time_rtc.seconds=0;
_rtc_set_time(&time_rtc);
_rtc_get_time (&time_rtc); 
printf ("MQX: %d s, %d ms\n", time_mqx.SECONDS, time_mqx.MILLISECONDS);
    printf ("    (%d d, %d hr, %d m, %d s)\n", time_rtc.days, time_rtc.hours, time_rtc.minutes,time_rtc.seconds);
sendCMD(CLR_SCR);
sendCMD(HOME);
    sendString(str2);

 The struct has the configured parameters but it doesn't change.

This last code fragment is in the event part, it is suppossed that this will show the time. Worked for me before including the ADC task.

 


    _rtc_get_time (&time_rtc); 
printf ("MQX: %d s, %d ms\n", time_mqx.SECONDS, time_mqx.MILLISECONDS);
     printf ("    (%d d, %d hr, %d m, %d s)\n", time_rtc.days, time_rtc.hours, time_rtc.minutes, time_rtc.seconds);

 

 The MQX time never changes its value, always is zero for seconds and milliseconds.

 

 it's necesary som kind of trigger or refresh function for the time struct?

Thanks in advance.

 

 

 

Outcomes