#include "prueba.h"
#include <12F629.h>



#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOCPD                    //No EE protection
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES PUT                      //Power Up Timer
#FUSES BROWNOUT                 //Reset when brownout detected//#FUSES BORSEN                   //See Datasheet
#use fast_io (A)
#use delay(clock=4000000)

#define GP0 PIN_A0
#define GP1 PIN_A1
#define GP2 PIN_A2
#define GP3 PIN_A3
#define GP4 PIN_A4
#define GP5 PIN_A5


#byte porta = 0x05
#byte trisa = 0x85
#bit tim0  = porta.4
#bit tim1  = porta.5
#bit led  = porta.2
#int_RTCC
void RTCC_isr() 
{
output_high (pin_a0);
delay_us (100);
output_low (pin_a0);
}

#int_TIMER1
void TIMER1_isr()
{
output_high (pin_a1);
delay_us (100);
output_low (pin_a1);
}


void main()
{

   port_a_pullups(false);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_comparator(NC_NC);
   enable_interrupts(INT_RTCC);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(GLOBAL);
set_tris_a (0b00111000);
   output_low (pin_a0);
   output_low (pin_a1);
   output_low (pin_a2); 
   enable_interrupts(INT_TIMER1);
   enable_interrupts(INT_TIMER0);
   enable_interrupts(INT_RA);
   enable_interrupts(GLOBAL);

   while (true)
   {   
         if (tim0)
         {
         led=~led;
         delay_ms (100);
         set_timer0(97);
         }
    else if (tim1)
      
         {
         set_timer1(235);        
         }

   } 
}


 