unsigned short counter, kp;
char  keypadPort at PORTB;   // Keypad module connections

void interrupt(){            // interrupt
//
  if(INTCON.T0IF){           //   TMR0  
  counter++;                 //  1   counter
      if (counter>14){       //   counter  14 
      PORTD.b4=~PORTD.b4;    //     PORTB
      counter=0;             //   counter
      }
  INTCON.T0IF=0;        //    TMR0
  }
}


void init(){              // init
OPTION_REG = 0x87;      //  TMR0,    66,304ms
INTCON.T0IE=1;          //     TMR0
INTCON.GIE=1;           //   
}


void main() {
  init();
  Keypad_Init();                           
  ANSEL  = 0;                              
  ANSELH = 0;
  trisd=0b00001111;
  portd=0b11000000;
  delay_ms(500);
  portd=0b00000000;
  

  do {
    kp = 0;                             
   
    do{
      //kp = Keypad_Key_Press();
      kp = Keypad_Key_Click();
                    
    }while (!kp);
      
  } while(1);
  }