We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: him sha
Last Updated: 2014-08-08
Package Version: 1.0.0.0
Category: Communication
Downloaded: 1515 times
Not followed.
License: MIT license
Hi guys,
Below is the STM32F1xx series code example for RTC date/time write and read operation.
Do you want to subscribe in order to receive notifications regarding "STM32F1 series RTC" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "STM32F1 series RTC" changes.
Do you want to report abuse regarding "STM32F1 series RTC".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1402545729_stm32f1_series_r_mikroc_arm.mpkg [59.46KB] | mikroC PRO for ARM |
|
//Main source file contain below functions
#include "Main.h"
void rtc_second_interrupt() iv IVT_INT_RTC_WKUP ics ICS_AUTO {
SECF_bit = 0;
redrawtime = 1; // time has changed,
}
void main(void){
//Initialize STM32F10x internal RTC
vRTC_Init();
//Set date and time
vRTC_SetDate(2,4,14);//(Day, Month, Year)
vRTC_SetTime(12,11,0);//(Hour, Minute, Second)
while (1){
//Read Date and Time
ucDay= ucRTC_GetDay();
ucMonth= ucRTC_GetMonth();
uiYear= uiRTC_GetYear();
ucHour=ucRTC_GetHour();
ucMinute=ucRTC_GetMinute();
ucSecond=ucRTC_GetSecond();
//Further display function
}
}
/*******************************************************************************
* Function Name : Get RTC Counter Value
* Description : To Read RTC_CNTL value from RTC
* Input : None
* Output : Hour, Minute, Second
* Return : Time Values read from RTC
* Written By : Himanshu
* Date : April 1, 2014
*********************************************************************************/
unsigned int RTC_Counter_Value(void){
if (redrawtime == 1){
uiRTC_Counter_Value = RTC_CNTL;
redrawtime = 0; // new time has rewritten on TFT
}
return (uiRTC_Counter_Value);
}