I am successfully able set the time in ds12887 but while reading time it shows wrong time. only second value is coming and overriding hour and minute value. So i cant solve this problem. please take a look in following code.
void DisplayTime() { XBYTE[11]=0x20; hr = XBYTE[14]; writeLcdcmd(0x87); BCD_Conv(hr); WriteLcdData(':'); min = XBYTE[12]; writeLcdcmd(0x8A); BCD_Conv(min); WriteLcdData(':'); sec = XBYTE[00]; writeLcdcmd(0x8D) BCD_Conv(sec); }
but this display only second value and unfortunately hr and min value is also overriding
Next thing: until you can set a time, read it out and display it and see all the fields ticking correctly, you can't just claim that you can correctly set any time.
Try replacing your XDATA[] reads with constants, prove the output routines function properly.
If those work properly, then the values in the XDATA[] array isn't what it's supposed to be and the problem is with how the RTC state is being read into the array (not shown).
Learn how to debug.
View all questions in Keil forum