SAM7 sample code for Buttons..

Dear Friends,

I am doing some sample projects with sam7-ex256 board and I would like to know if anyone can help me out with sample code for the buttons(how to write interrupt handler for buttons).I would like to do following things.

main(){

int i=10;

while(1){

//increment the value of i

//when the is button pressed or joystick is pressed

//print the value of i on lcd

//come out of the loop

//if button is not pressed keep incrementing the value of i

}

}

I have sample code for displaying the value of i , but i dont know how to write code for buttons…

Please help me out in this regard…If anyone needs sample code for LCD program you can mail me…