Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of rtc_class by
main.cpp
00001 #include "mbed.h" 00002 #include "const.h" 00003 #include "RTC8563.h" 00004 #include "string" 00005 #include "Date.h" 00006 #include "DateString.h" 00007 00008 Serial pc(USBTX, USBRX); 00009 //I2C i2c(p28, p27); 00010 00011 uint8_t year, month, day, week; 00012 uint8_t hour, minute, sec; 00013 char week_chr[7][4] = {"MON","TUE","WED","THU","FRI","SAT","SUN"}; 00014 00015 int main() 00016 { 00017 Date rtc; // instanziieren des Objektes rtc 00018 00019 pc.printf("Setting up RTC\n"); 00020 //rtc.rtc_init(); 00021 00022 while(1) { 00023 //printTime(); 00024 pc.printf(" %i %i . %i . %i.", week_chr[rtc.GetWeek()], rtc.GetDay(), rtc.GetMonth(), rtc.GetYear()); 00025 year = rtc.rtc_read(YEARS); // Aufruf der Methode rtc_read der Instanz (Objekt) rtc 00026 month = rtc.rtc_read(MONTHS); 00027 day = rtc.rtc_read(DAYS); 00028 week = rtc.rtc_read(WEEKDAYS); 00029 hour = rtc.rtc_read(HOURS); 00030 minute = rtc.rtc_read(MINUTES); 00031 sec = rtc.rtc_read(SECONDS); 00032 00033 //Datum Ausgabe 00034 pc.printf("20%x%x/%x%x/%x%x %s\n", 00035 ((year >> 4) & 0x03) , (year & 0x0F) , 00036 ((month >> 4) & 0x01), (month & 0x0F) , 00037 ((day >> 4) & 0x03), (day & 0x0F) , 00038 week_chr[week & 0x07]); 00039 00040 //Zeit Ausgabe 00041 pc.printf("%x%x:%x%x:%x%x\n", 00042 ((hour >> 4) & 0x03), (hour & 0x0F), 00043 (minute >> 4), (minute & 0x0F) , 00044 (sec >> 4), (sec & 0x0F) ); 00045 wait(1); 00046 } 00047 }
Generated on Mon Jul 25 2022 14:22:31 by
1.7.2
