Pages: [1]   Go Down
Author Topic: Interrupt 2 did't work on ATMEGA644  (Read 464 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 is there anybody make Interrupt 2 working on ATMEGA644?  my following code can't work, I am using  sanguino V1.0
Code:
#include <avr/sleep.h>
#include <avr/power.h>

int counter=0;
static volatile int interrupt_0=0;
static volatile int interrupt_1=0;
static volatile int interrupt_2=0;

/***************************************************/
void pin0Interrupt(void)
{
  interrupt_0=1;
}

void pin1Interrupt(void)
{
  interrupt_1=1;
}

void pin2Interrupt(void)
{
  interrupt_2=1;
}

void setup()
{
  Serial.begin(9600);
  //pinMode(2, INPUT);
   
  attachInterrupt(0, pin0Interrupt, CHANGE); 
  attachInterrupt(1, pin1Interrupt, CHANGE);
  attachInterrupt(2, pin2Interrupt, CHANGE);

   
  Serial.println("Waiting for Interrupt 0,1,2");
}

void loop()
{
  delay(1000);
  /*
  if ((counter %5 )==0)
  {
    Serial.print(digitalRead(0));
    Serial.print(",");
    Serial.print(digitalRead(1));
    Serial.print(",");
    Serial.println(digitalRead(2));
  }
  */
  if (interrupt_0)
  {
    interrupt_0=0;
     Serial.println("interrupt_0...");
  }
   if (interrupt_1)
  {
    interrupt_1=0;
     Serial.println("interrupt_1...");
  }
   if (interrupt_2)
  {
    interrupt_2=0;
     Serial.println("interrupt_2...");
  }
  counter++;
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I finally found there already got solution. It worked after changing  WInterrupts.c  &   wiring_private.h

Issue 879:   detachInterrupt() support missing for INT2, INT2 missing for ATmega644

http://code.google.com/p/arduino/issues/detail?id=879
Logged

Pages: [1]   Go Up
Jump to: