RTCC.setAlarmTimeDate

Name

 * RTCC.setAlarmTimeDate

Description
Sets the alarm time and alarm date of the Real Time Clock and Calendar (RTCC) by writing values into the Alarm Time Value Register (ALRMTIME) and the Alarm Date Register (ALRMDATE).

Note: that the behaviour of the RTCC Alarm is dependent not only on the values in the Alarm Time Value Register (ALRMTIME) and in the Alarm Date Value Register (ALRMDATE) but also the values in the RTC Alarm Control Register (RTCALRM) which are determined by other settings including the various RTCC.AlarmRepeat~ functions.

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.setAlarmTimeDate(unsigned long alTime, unsigned long alDate)
 * Parameters:
 * alTime = the alarm time to be set in 24 hour clock and BCD format (see below).
 * alDate = the alarm date to be set in BCD format (see below).
 * Returns/Output;
 * [None]

The format for the data in alTime 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 an alarm time of 2:35:25 pm is to be set then AlTime = 0x14352500

The format for the data in alDate is 0x00MMDD0W, where :-
 * 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 an alarm date of Saturday 31 December is to be set then alDate = 0x00123100.

Unlike the RTCDATE Register the ALRMDATE Register does not have a location implemented for Year and if a value is inserted in the same position as that for Year for the RTCDATE Register (the first 00 in the number format given above) it will be ignored by the ALRMDATE Register, i.e. alDate = 0x00123100 and alDate = 0x12123100 will both result in the same alarm date of Saturday 31 December being set.

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.