RTCC.convertDate

Name

 * RTCC.convertDate

Description
Converts a date value in BCD format in a variable of data type rtccDate into a decimal format. It is used to convert a date value read from the RTC Date Value Register (RTCDATE) by either RTCC.getDate or RTCC.getTimeDate into a format that is more useful for further processing.

It is intended for use with 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
rtccDate RTCC.convertDate(rtccDate * pDt)


 * Parameters:
 * pDt = a pointer to a variable of data type rtccDate (see below)
 * Returns/Output:
 * each of the defined members (wday, mday, mon and year) within the variable identified by the pointer pDt is converted separately from BCD to decimal format, so a BCD value of 10, which would be taken as a decimal value of 16 without conversion is converted to the correct decimal value of 10.

Note: After undergoing this conversion the data within the variable identified by pDt is no longer in the correct format for writing to the RTC Date Value Register (RTCDATE).

Data type definition for rtccDate

typedef union { 	struct { 		unsigned char	wday;	// BCD codification for day of the week, 00-06 unsigned char	mday;	// BCD codification for day of the month, 01-31 unsigned char	mon;	// BCD codification for month, 01-12 unsigned char	year;	// BCD codification for years, 00-99 };				// field access unsigned char		b[4];	// byte access unsigned short		w[2];	// 16 bits access unsigned long		l;	// 32 bits access }rtccDate;