Go Down

Topic: <SOLVED> ATmega644 does not catch the interupt (Read 2 times) previous topic - next topic

corprius

haha.., there are numerous variations to it.

Could it have something to do with the fuses? Mine differ from sanguino's fuses.


Nick Gammon


I'm trying to use the attachInterrupt() with the ATmega644 for sensing a rotary encoder.
For some reason the uC doesn't catch the interrupt. This is my code
...
When I take a look at the Sanguino website it states that the ATmega's interrupt pins are pin 2, 10 & 11. According to the site I should use int 2 to attach the interrupt routine to pin 2.


Do you actually have a Sanguino?

dhenry

Code: [Select]
attachInterrupt(2, rotEncoder, CHANGE);  // ISR for rotary encoder on pin 2

INT0 is typically on PD2.

With that corrected, your code works.

corprius



I'm trying to use the attachInterrupt() with the ATmega644 for sensing a rotary encoder.
For some reason the uC doesn't catch the interrupt. This is my code
...
When I take a look at the Sanguino website it states that the ATmega's interrupt pins are pin 2, 10 & 11. According to the site I should use int 2 to attach the interrupt routine to pin 2.


Do you actually have a Sanguino?
Sorry, been away for a few days...

No I do not have the Sanguino, I was only inspired by it. I designed my own controller that can be mounted piggyback onto any 20x4 HD44780 based display. I use it to control my DAC. Here's al link to my creation. http://ce-designs.net/index.php/my-projects/other-builds/ce644-the-es9018-i2c-controller


Code: [Select]
attachInterrupt(2, rotEncoder, CHANGE);  // ISR for rotary encoder on pin 2

INT0 is typically on PD2.

With that corrected, your code works.

So you're saying I should change it to:
Code: [Select]
attachInterrupt(0, rotEncoder, CHANGE);  // ISR for rotary encoder on pin 2???
Already tried that without success.

Nick Gammon

To save me reading all that, can you please state which pin, on the Atmega644 chip, you are attaching the device which is to generate an interrupt?

Go Up