#include <16f877.h>	
			//pic a utilizar 
#include <ds1307.c>			
#fuses XT,NOWDT,NOPROTECT,PUT,NOLVP,NOBROWNOUT				//ordenes para el programador 
#use delay (clock=4000000)			//Fosc=4Mhz
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, FORCE_SW)
#byte trisB=0x86
#byte portB=0x06
int min,hr,sec,day,mth,year,dow;



///funcion interrupcion

#int_timer0

void TIMER0_isr(void)    //function interrupcin TMR0
{
	
bit_set(portb,7);       //enciendo led
delay_ms (1000);         // retardo
bit_clear(portb,7);     //apagp led 
set_TIMER0(0xF1);      //inicializa el timer
    
}  


void main (void)

{
    ///configuro tmr0

   setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_4);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(GLOBAL);
 
// configuro RTC

   ds1307_init(DS1307_ALL_DISABLED);
   ds1307_init(DS1307_OUT_ENABLED | DS1307_OUT_1_HZ);   
   ds1307_set_date_time(day,mth,year,dow,hr,min,sec);
   ds1307_set_date_time(28,01,10,4,16,20,0);  
  
 //configuro B7 como salida el resto entrada
   trisB=0x7F;  
   bit_clear(portb,7);  ///apago b7
   set_TIMER0(0xF1);  ///cargo conador -inicializo tmr0 

do
{
}
while(true);
}	
   