| Motore di ricerca datesheet componenti elettronici |
|
AN1780 Scheda tecnica(PDF) 6 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1780 Scheda tecnica(HTML) 6 Page - STMicroelectronics |
|
6 / 9 page ![]() 6/9 STR71X REAL TIME CLOCK APPLICATION EXAMPLE Figure 2. C Code Flow: Here is a section of code taken from main.c which performs the steps shown above in Figure 2 above: #include "71x_lib.h" #include "lcd.h" #include <stdio.h> #include <time.h> #include <stdlib.h> #define RTC_PRESC 0x8000 Adjust current Date and Time using HyperTerminal and UART0 Use localtime function in order to convert the current date and time to seconds since Unix Epoch Substract this number 0x3FF36300 from the result in order to have reference date first January 2004 Update the RTC device counter Use a prescaler value of 0x8000 in order to have the RTC counter registers incremented every one second Add this number 0x3FF36300 to the counter register value in order to have a start date = 01/01/70 Use mktime function to Convert the calendar time pointed to by timer into a broken-down time Read the RTC counter register value main Display time and date Configure the RTC Alarm RTC IRQHandler Clear AIR and GIR Bits Configure an alarm after 5 seconds Display an alarm message |
|
|
Link URL |
| Lei ha avuto il aiuto da alldatasheet? [ DONATE ] |
Di alldatasheet | Richest di pubblicita | contatti | Privacy Policy | Collegamento alla scheda tecnica | scambio Link | Ricerca produttore 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 |