Master Slave Clocks with PIC16F887

Status
Not open for further replies.
Ian is your second name Job ... as in patience of...
 
Last edited:
there should sensor i.e. ADC to detect power failure and store in Memory.

I think i should be stored in EEPROM or internal register of DS1307.
 
Hello sir,
I have changed some code!
actually i am once writing the time in micro. after that i am removing/re programming the micro by deleting the write function.
so, it run internally the ds1307 chip...
it is working is it fine procedure to run ds1307??
 
Hello,
The Clock is running internaly i have set the time one and removed the write function for making update from outter switch!
i have place the up and down switch with pull ups at RD4-5 . but it is not responding here is if code parrts

C:
if(RD4==0|| RD5==0){
//Time[] = {0x05, 0x30 ,0x08, 0x22 , 0x10, 0x4, 0x15};

if(RD4==0) // UP MIN HOUR
{
up_min= up_min+1;
up_hour=up_hour+1;
Time[1]=up_min;
Time[2]=up_hour;
WriteClock(&Time[0]);
}
if(RD5==0) // UP MIN HOUR
{
up_min= up_min-1;
up_hour=up_hour-1;
Time[1]=up_min;
WriteClock(&Time[0]);
Time[2]=up_hour;

}
}
 
Hi R... I have been in Scotland these past few days.... Please give me a while to catch up!!

I always use the DS1307.. Can't comment about the other one...
 
hello,
I don't know how to write, need guidance.

C:
  if(RD5==1){
unsigned char a=0;
a=a+1;
}
if(RD6==1){
unsigned char a=0;
a=a-1;
}
WriteClock(&Time[0]);
  }
  }  
unsigned char Time[] = {0x11, 0x11 ,0x11, 0x00 , 0x10, 0x4, 0x15};
 
The function I wrote was this
C:
void WriteClock(char *array)       // Not used
   {
   char x;
   int tmp;
   for(x=0;x<7;x++)
     {
     tmp = array[x] / 10;
     tmp << = 4;
     tmp += array[x] % 16;
     WriteRTC(x,tmp);
     } 
   }

This function takes care of writing to the RTC... The array is pointing to the Time[] array.. Whatever is in that array will be written to the RTC... The function also takes care of the BIN / BCD conversion, so you don't need to!!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…