cancel
Showing results for 
Search instead for 
Did you mean: 

RTC on STM32 ?

antonius
Senior
Posted on December 27, 2013 at 06:07

Guys,

Does anyone know on how to initialize RTC on STM32 and display the content of the register to LCD ?

Any links or reference will be appreciated,

Thank you

#think!
10 REPLIES 10
Andrew Neil
Evangelist
Posted on December 27, 2013 at 11:09

''Does anyone know on how to initialize RTC on STM32''

 

Which STM32?

Have you studied its Documentation?

Have you looked at the examples included in the Standard Peripheral Library?

eg,

STM32F37x_StdPeriph_Examples\RTC

''display the content of the register to LCD''

What LCD?

In what form do you want to display it?

The fact that it happens to be a value from the RTC is irrelevant to the LCD...
antonius
Senior
Posted on December 27, 2013 at 17:04

STM32F107 and LCD 20x4.....

Andrew Neil
Evangelist
Posted on December 27, 2013 at 19:54

Well that answers, ''which STM32?''  and is a partial answer to, ''What LCD?''

So what about the other questions:

Have you studied its 

Documentation

?

Have you looked at the examples included in the Standard Peripheral Library?

In what form do you want to display it?

And it remains that the fact that it happens to be a value from the RTC is irrelevant to the LCD...

''Does anyone know on how to initialize RTC on STM32''

 

Which STM32?

Have you studied its Documentation?

Have you looked at the examples included in the Standard Peripheral Library?

eg,

STM32F37x_StdPeriph_Examples\RTC

''display the content of the register to LCD''

What LCD?

In what form do you want to display it?

The fact that it happens to be a value from the RTC is irrelevant to the LCD...

''Does anyone know on how to initialize RTC on STM32''

 

Which STM32?

Have you studied its Documentation?

Have you looked at the examples included in the Standard Peripheral Library?

eg,

STM32F37x_StdPeriph_Examples\RTC

''display the content of the register to LCD''

What LCD?

In what form do you want to display it?

The fact that it happens to be a value from the RTC is irrelevant to the LCD...
ilmars
Associate II
Posted on December 27, 2013 at 19:55

STM32F107 and LCD 20x4.....

 

Have you studied its Documentation?

antonius
Senior
Posted on January 05, 2014 at 00:06

I can display some strings already in LCD and display RTC on USART,

My question is, how to use a variable on USART and display it on LCD ?

code :

printf(''Time: %d-%d-%d   %02d:%02d:%02d \r\n'', time.tm_year, \

                   time.tm_mon+1, time.tm_mday,\

                   time.tm_hour, time.tm_min, time.tm_sec);

         sprintf(year,''%02d'',time.tm_year);

    lcd_string(time.tm_year);

another reference that I can consider :

http://www.st.com/st-web-ui/static/active/jp/resource/technical/document/application_note/DM00025071.pdf

Andrew Neil
Evangelist
Posted on January 07, 2014 at 00:54

The golden rule of software development is: Divide and Conquer - ie, break the problem down until you reach smaller problems which are easily solved.

In this case, you have two independent ''problems'':

1. Converting data - of whatever form, from whatever source - into a string format;

2. Outputting an arbitrary string - irrespective of its content or source - to your chosen peripherals (UART, LCD, whatever,...)
Andrew Neil
Evangelist
Posted on January 07, 2014 at 23:39

Another thread on the same topic: 

 http://goo.gl/w27Y72

antonius
Senior
Posted on January 08, 2014 at 06:30

The link is pointing to this thread ....is it the right one ?

antonius
Senior
Posted on January 08, 2014 at 07:29

How do you reckon if I do like this ?

void RTC_GetTime( u8* THH, u8* TMM, u8* TSS )

{

 uint32_t Tmp;

 /* Load the Counter value */

 Tmp = RTC_GetCounter();

 /* Compute hours */

 *THH = ( Tmp / 3600 ) % 24;

 /* Compute minutes */

 *TMM = ( Tmp / 60 ) % 60;

 /* Compute seconds */

 *TSS = Tmp % 60;

}