interrupt code error

I am trying to get the following sketch to work but i am getting the following code error, can anyone assist?
"'GICR' was not declared in this scope"

// Definition of interrupt names
#include < avr/io.h >
// ISR interrupt service routine
#include < avr/interrupt.h >

// LED connected to digital pin 13
int ledPin = 13;
// This is the INT0 Pin of the ATMega8
int sensePin = 2;
// We need to declare the data exchange
// variable to be volatile - the value is
// read from memory.
volatile int value = 0;

// Install the interrupt routine.
ISR(INT0_vect) {
// check the value again - since it takes some time to
// activate the interrupt routine, we get a clear signal.
value = digitalRead(sensePin);
}

void setup() {
Serial.begin(9600);
Serial.println("Initializing ihandler");
// sets the digital pin as output
pinMode(ledPin, OUTPUT);
// read from the sense pin
pinMode(sensePin, INPUT);
Serial.println("Processing initialization");
// Global Enable INT0 interrupt
GICR |= ( 1 << INT0);
// Signal change triggers interrupt
MCUCR |= ( 1 << ISC00);
MCUCR |= ( 0 << ISC01);
Serial.println("Finished initialization");
}

void loop() {
if (value) {
Serial.println("Value high!");
digitalWrite(ledPin, HIGH);
} else {
Serial.println("Value low!");
digitalWrite(ledPin, LOW);
}
delay(100);
}

Which Arduino board are you using ?

I am using UNO R3

I meant to ask where you got the code from.
The #include < avr/interrupt.h >makes me think that it was not intended to run in the normal Arduino environment.

The code you have copied was written for something like AVR Studio and not for the Arduino. Look at interrupts in the playground.

Mark

As the others have said - if you're using the Arduino runtime libraries then you need to replace this code in setup with the Arduino equivalent:

  GICR |= ( 1 << INT0);
  MCUCR |= ( 1 << ISC00);
  MCUCR |= ( 0 << ISC01);

That ATMega328 doesn't have a GICR register. Are you sure your code isn't designed for some other variant?

Thanks for your support. I got the code from here:

http://gonium.net/md/2006/12/20/handling-external-interrupts-with-arduino/

It was written for audrino according to the author.
"For my DCF77 clock project, I need an understanding of handling interrupts with the ATMega8 chip – here’s my sketch.

The ATMega8 provides two pins (2 and 3) which can trigger software interrupts when the attached digital signal changes. You can use this to be “notified” when the external signal changes. Therefore, you do not need to poll the pin periodically – the interrupt routine will be invoked automatically when the specified signal change happens."

I will have a look at the interrupts in detail but i am a rookie and am struggling to get my head around it.

thanks.

Yeah, they're different registers on the 328. Try EICRA instead of MCUCR, and EIMSK instead of GICR.

Thank you for your help that worked great! XD

Thanks to all the input from the forum, such a great help for a rookie like myself.