Hi, I was looking for making the due RTC work too, so I tried to do it with some register manipulation but the IDE tells me that the registers are not declared... Since I'm not very good, If someone could take a look at my code I could be nice.
void setup()
{
Serial.begin(9600);
if(RTC_WPMR==B01010010010101000100001100000001) bitSet(RTC_WPMR,0);// dissable Write protection
bitSet(RTC_CR,0); // request time and date update
while(bitRead(RTC_SR,0)!=1) //wait for acknowledge for update
{}
bitSet(RTC_SCCR,0);
RTC_MR=0; //Set hour mode to 24h
RTC_TIMR=B00000000001000110011000000110000;// set time: 23:30:30
bitClear(RTC_CR,0);//exit programing mode
delay(5000);
}
void loop()
{
rtcToTime(RTC_TIMR);
delay(10000);
}
void rtcToTime(int rtcTime)
{
int h=rtcTime>>16;
int m=(rtcTime>>8)&B000000000000000001111111;
int s=rtcTime&B00000000000000000000000001111111;
Serial.print(h);Serial.print(':');Serial.print(m);Serial.print(':');Serial.println(s);
}
Thanks