Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/14/09 09:13
Read: times


 
#162396 - Not enough details to help
Responding to: ???'s previous message
Sandeep said:
How to Initialize this device after system start?


This is what you could do to initialize the chip

// Register addresses of the HT1380 RTC
enum  {RTC_Secs=0, RTC_Mins, RTC_Hours, RTC_Date, RTC_Month, RTC_Day, RTC_Year, RTC_WriteProtect};

// Initialize the rtc if it is not running
void  RTC_Init()
{
byte  tmp;
  
  tmp = RTC_Read(RTC_Secs);             // read seconds register to get the CH bit
  if (0x80 & tmp)                       // if CH bit is set, set defaults and clear it
  {
    RTC_Protect(0);                     // protect off
    RTC_Write(RTC_Secs,tmp & 0x7f);     // clear the CH bit here
    RTC_Write(RTC_Mins,0);
    RTC_Write(RTC_Hours,0x12);          // 24 hour format
    RTC_Write(RTC_Date, 1);             // write date
    RTC_Write(RTC_Month, 1);
    RTC_Write(RTC_Year, 0x06);          // write out the year (2006)
    RTC_Protect(1);                     // protect on
  }
}
 



List of 4 messages in thread
TopicAuthorDate
HT1380 > RTC            01/01/70 00:00      
   Not enough details to help            01/01/70 00:00      
      More Details !!            01/01/70 00:00      
         Call RTC_Init            01/01/70 00:00      

Back to Subject List