*Updated answer, the hardware is an Atmega88.
#include <avr/io.h>
#include <avr/interrupt.h>
ISR (PCINT0_vect){
/* This is where you get when an interrupt is happening */
}
int main(void)
{
/*Assumes that you are using PCINT0.
*It is also known as PB0
*/
DDRB &= ~(1<<PB0); /* Set PB0 as input */
PORTB |= (1<<PB0); /* Activate PULL UP resistor */
PCMSK0 |= (1 << PCINT0); /* Enable PCINT0 */
PCICR |= (1 << PCIE0); /* Activate interrupt on enabled PCINT7-0 */
sei (); /* Enables interrupt */
/* cli (); is used to disable interrupts. */
for(;;){
}
return 0;
}
The above example uses PB0 as input and activates a internal pull up resistor. This will have the effect that PINB is 1 until it is connected to ground. When connected to ground PINB will be 0.
PCINT0 is the activated pin, set in PCMSK. And PCICR is set to catch Pin changes on enabled PCINT7 to 0.
You can find all this information in the datasheet, it is a lot of information, but essential if you want to know how to use a AVR. Datasheet
You can find more information about the ISR(), sei (), cli () at nongnu.org there is also a complete list over vectors used by the ISR ().
AVR Freaks have a article that is free to download, it will help you understand how it works, the article is called "Basic interrupts and I/O"
I hope this get you started.