#include <12F629.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOCPD                    //No EE protection
#FUSES PROTECT                  //Code protected from reads
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BANDGAP_HIGH          
#use delay(clock=4000000)

int i=0;
int j=0;

void main()
{

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC);
   setup_vref(FALSE);
   

while(1)
   {
   if((input(PIN_A2))&& i==0)//ha kapcs fel és nem futott le
   {
      i++;
      for (j=1;j<=20;++j)//20x 1mp (2x500ms)
      {
         Output_high(PIN_a1);
         delay_ms(500);
         Output_low(PIN_a1);
         delay_ms(500);
      }//end for
   }//end if
   
   }//end while
   
}//end main
