RTCC.setDate

Name

 * RTCC.setDate

Description
Sets the date of the Real Time Clock and Calendar (RTCC) by writing a value into 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.setDate(unsigned long dt)
 * Parameters:
 * dt = the date to be set in BCD format (see below).
 * Returns/Output;
 * [None]

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.