RTCC.convertTime

Name

 * RTCC.convertTime

Description
Converts a time value in BCD format in a variable of data type rtccTime into a decimal format. It is used to convert a time value read from the RTC Time Value Register (RTCTIME) by either RTCC.getTime 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
rtccTime RTCC.convertTime(rtccTime * pTm)


 * Parameters:
 * pTm = a pointer to a variable of data type rtccTime (see below)
 * Returns/Output:
 * each of the defined members (hours, min & sec) within the variable identified by the pointer pTm 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 pTm is no longer in the correct format for writing to the RTC Time Value Register (RTCTIME).

Data type definition for rtccTime

typedef union { 	struct { 		unsigned char	rsvd;	// reserved for future use. should be 0 unsigned char	sec;	// BCD codification for seconds, 00-59 unsigned char	min;	// BCD codification for minutes, 00-59 unsigned char	hour;	// BCD codification for hours,  00-24 };				// field access unsigned char		b[4];	// byte access unsigned short		w[2];	// 16 bits access unsigned long		l;	// 32 bits access }rtccTime;