Pic 18F452 / push button
You must use below circuit. 
Define RB0 as input (TRISB = 1).
Enable RB0 interrupt (INTCON = 0b10010000).
Put your code on interrupt subroutine.




Here's a sample code writing in mikroC for PIC:

void interrupt(void)
{
  if (INTCON.INTF)
  {
    // your code
    INTCON.INTF = 0;
  }
}

void main()
{
  TRISB = 0b00000001;
  INTCON = 0b10010000; 
  while (1) ;
}