RTCC.setTimeDate

Name

 * RTCC.setTimeDate

Description
Sets the time and date of the Real Time Clock and Calendar (RTCC) by writing a values into the RTC Time Value Register (RTCTIME) and the RTC Date Value Register (RTCDATE).

Only works for 32-bit Pinguinos with a 32,768 kHz quartz crystal which allows the use of the built-in RTCC functionality of the PIC32, such as the Olimex PIC32 Pinguino OTG.

Syntax
void RTCC.setTimeDate(unsigned long tm, unsigned long dt)
 * Parameters:
 * tm = the time to be set in 24 hour clock and BCD format (see below).
 * dt = the date to be set in BCD format (see below).
 * Returns/Output;
 * [None]

The format for the data in tm is 0xhhmmss00 using a 24 hour clock, where :-
 * hh is the hour in 24 hour format, i.e. 00 - 24,
 * mm is the minutes, i.e. 00 - 59,
 * ss is the seconds, i.e. 00 - 59,

i.e. if a time of 2:35:25 pm is to be set then tm = 0x14352500

The format for the data in dt is 0xYYMMDD0W, where :-
 * YY is the last two digits of the year, i.e. 00 - 99,
 * MM is the month, i.e. 01 - 12,
 * DD is day of the month, i.e. 01 - 28/29/30/31 depending on the length of the month,
 * W is the day of the week, e.g. 0 - 6 where Saturday = 0 and Friday = 6 (see Note below)

i.e. if a date of Saturday 31 December 2011 is to be set then dt = 0x11123100

Note: The RTCC has no calendar look-up, and takes the day of the week solely from the value input. To a certain extent the start of the week (day 0) is arbitrary and the setting of 0 = Saturday given above is based on the RTCC example included in the Pinguino IDE whereas in Table 29-2: Day of Week Schedule in the Microchip PIC32 Family Reference Manual, Section 29. Real-Time Clock and Calendar (RTCC) (see below) Sunday is taken to be day 0.