void UpdateTime(void)
{
int hours,minutes,aorp; //aorp = Am or Pm
int month,date,year;
minutes = bcd2dec(RTCRegRead(0x01),3);
hours = bcd2dec(RTCRegRead(0x02),1);
aorp = bcd2dec(RTCRegRead(0x05),0);
aorp = (aorp >> 5) & 0x01;
if(aorp == 0)
aorp ='A';
else
aorp ='P';
month = bcd2dec(RTCRegRead(0x05), 2);
day = bcd2dec(RTCRegRead(0x04), 0);
year = bcd2dec(RTCRegRead(0x06), 0);
sprintf(time,"Time: %i:%i %cM ",hours,minutes,aorp)
sprintf(comDate,"Date: %i/%i/%i ",month,day,year)
}