Functions and formatted printing of time and date for RTC8563

Dependencies:   mbed

You are viewing an older revision! See the latest version

Task Alarm

Table of Contents

    Task Alarm

    Ergänzen und testen Sie den Alarm im Projekt RTC.

    Funktion Alarm:

    void rtc_alarm()
    {
        //pc.printf("Setting up RTC\n");
    		// Formatierung 
    		// 2015/01/24 
    		// 17:02:00 MON
    
        week_val = 0x05; // SAT
        rtc_write(CONTROL1, 0x20); //stop
        rtc_write(CONTROL2, 0x02); // alarm AF alarm flag bit
        rtc_write(DAY_ALARM, (0x80) );
        rtc_write(HOUR_ALARM, (0x97));
        rtc_write(MINUTE_ALARM, (0x02));
        rtc_write(WEEKDAY_ALARM, (0x80));
        rtc_write(CONTROL1, 0x00); //start
    }
    

    Ausgabe in main():

    	//Alarm-Zeit Ausgabe
    	pc.printf("ALARM RTC8563 CLOCK\n" );
        pc.printf("%x%x:%x%x %s\n", 
                    ((hour_a >> 4) & 0x03), (hour_a & 0x0F), 
                    (minute_a >> 4 & 0x03), (minute_a & 0x0F), 
                    week_chr[week_a & 0x07]);
    

    All wikipages