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.
main.cpp
00001 //Based on http://mbed.org/users/jf1vrr/programs/RTC8564NB_Clock/lqbcpu 00002 00003 #include "mbed.h" 00004 #include "RTC8564.h" 00005 00006 Serial pc(USBTX, USBRX); 00007 00008 char year, month, day, week; 00009 char hour, minute, sec; 00010 00011 char week_chr[7][4] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; 00012 00013 00014 int main() { 00015 //2012.06.20 00:30:00 Wed 00016 rtc_setdaytime("12", "06", "20", "00", "30", "00", "3"); 00017 00018 while(1) { 00019 year = rtc_read(YEARS); 00020 month = rtc_read(MONTHS); 00021 day = rtc_read(DAYS); 00022 week = rtc_read(WEEKDAYS); 00023 hour = rtc_read(HOURS); 00024 minute = rtc_read(MINUTES); 00025 sec = rtc_read(SECONDS); 00026 pc.printf("20%c%c/%c%c/%c%c %s\n", 00027 ((year >> 4) & 0x03) + 0x30, (year & 0x0F) + 0x30, 00028 ((month >> 4) & 0x01) + 0x30, (month & 0x0F) + 0x30, 00029 ((day >> 4) & 0x03)+ 0x30, (day & 0x0F) + 0x30, 00030 week_chr[week & 0x07]); 00031 pc.printf("%c%c:%c%c:%c%c\n", 00032 ((hour >> 4) & 0x03) + 0x30, (hour & 0x0F) + 0x30, 00033 (minute >> 4) + 0x30, (minute & 0x0F) + 0x30, 00034 (sec >> 4) + 0x30, (sec & 0x0F) + 0x30 ); 00035 00036 wait(0.1); 00037 } 00038 }
Generated on Fri Jul 15 2022 21:20:48 by
1.7.2