Go Down

Topic: Interrupt 2 did't work on ATMEGA644 (Read 535 times) previous topic - next topic

catchup

is there anybody make Interrupt 2 working on ATMEGA644?  my following code can't work, I am using  sanguino V1.0
Code: [Select]

#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++;
}

catchup

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy