Electronic Components Datasheet Search |
|
AN1780 Datasheet(PDF) 3 Page - STMicroelectronics |
|
AN1780 Datasheet(HTML) 3 Page - STMicroelectronics |
3 / 9 page 3/9 STR71X REAL TIME CLOCK APPLICATION EXAMPLE 4 CONFIGURATION MODE To write in the RTC_PRL, RTC_CNT, RTC_ALR registers, the peripheral must enter Config- uration mode. This is done by setting the CNF bit in the RTC_CRL register. In addition, writing to any RTC register is only enabled if the previous write operation is fin- ished. To enable the software to detect this situation, the RTOFF status bit is provided in the RTC_CR register to indicate that an update of the registers is in progress. A new value can be written to the RTC counters only when the RTOFF status bit value is ’1’. Configuration Procedure: 1. Poll RTOFF, wait until its value goes to ‘1’ 2. Set CNF bit to enter configuration mode 2. Write to one or more RTC registers 3 Clear CNF bit to exit configuration mode The write operation only executes when the CNF bit is cleared and it takes at least two Clock32 cycles to complete. 5 32-BIT COUNTER TIME CONVERSION This application note explains how to convert the 32-bit time value into a date and time value that can be put in the form of MM/DD/YYYY, HH:MM:SS. Many functions provided by the ARM compiler used to convert from a date and time to seconds are also described. These functions are modified in order to explore the STR71x RTC to deliver time and date. 5.1 C LIBRARY FUNCTIONS USED 5.1.1 RTC prescaler Initialisation: Before start-up we must adjust the STR71x RTC prescaler register value in order to have the RTC counter registers incremented every second, this can be configured by using a prescaler value of 0x8000 (32768) to slow down the RTC clock from 32768 Hz to 1 Hz. 5.1.2 Origin Date Adjust Since the date used in this application note is the same used with the UNIX operating system, the reference date January 1, 1970, often referred to as Unix Epoch, we must add this number 0x3FF36300 to the value obtained from the STR71x RTC Counter register with intent to have a start date = 01/01/2004. |
Similar Part No. - AN1780 |
|
Similar Description - AN1780 |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.COM |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Datasheet Upload | Contact us | Privacy Policy | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
Family Site : ic2ic.com |
icmetro.com |