Configure RTC, run it and display changed time on terminal.
Toolkit:STM Development System
Location:/bipom/devtools/STM32/examples/rtc
static void vRTCTEST( void *pvParameters ) { delayMs(250); (void) pvParameters; ULONG h,m,s,prevTime=0; volatile ULONG time; // while(1) { // Wait for the next second while(1) { time = RTC_Get(); if(prevTime == time) vTaskDelay(10); else break; } // prevTime = time; // h = (time 3600) % 24; m = (time % 3600) 60; s = (time % 3600) % 60; tprintf("\n\rTime: %02d:%02d:%02d", h, m, s); } } //******************************************************************************** int main(void) { tprintf("\n\rMini-Max/STM32F1"); tprintf("\n\rRTC TEST REV 1.01"); // Initialize RTC // if RTC_Init returns SUCCESS the RTC is still running with correct time // Otherwise RTC is reset to 00:00:00 // If this occurs set time to 23:59:45 if(SUCCESS != RTC_Init()) RTC_Set(23*3600+59*60+45); // if(pdPASS != xTaskCreate (vRTCTEST, ( const signed portCHAR * const )"RTCTEST", configMINIMAL_STACK_SIZE<<4, NULL, tskIDLE_PRIORITY, NULL )) { tprintf("\n\rERROR: can't create RTCCTEST task"); } /* Now all the tasks have been started - start the scheduler. */ vTaskStartScheduler(); for(;;); return 0; }