I am trying to get the Pin Change Interrupts from the EnableInterrupt library to work on a 1284P. I am using Mighty1284 and Bobuino pinout. Its running at 8Mhz, 3.3V.
I can see the program is responding to the Interrupt when the pin (A7/40) in this case as the serial printout to the console is interrupted and the 1284P displays the 'Reset' message.
So the 1284P is resetting rather than calling the interrupt service rountine, any ideas why ?
The code is the Simple example from the library.
// EnableInterrupt Simple example sketch. Demonstrates operation on a single pin of your choice.
// See https://github.com/GreyGnome/EnableInterrupt and the README.md for more information.
#include <EnableInterrupt.h>
#define MIGHTY1284
#define ARDUINOPIN A7 //1284P pin 40
/*// Modify this at your leisure. Refer to https://github.com/GreyGnome/EnableInterrupt/wiki/Usage#Summary
#if defined __AVR_ATmega640__ || defined __AVR_ATmega2560__ || defined __AVR_ATmega1280__ || \
defined __AVR_ATmega1281__ || defined __AVR_ATmega2561__
#define ARDUINOPIN 6
#else
// Pin 7 is useful on Arduino Uno, Leonardo, Mighty1284, ATtiny84...
#define ARDUINOPIN 7
#endif
*/
volatile uint16_t interruptCount=0; // The count will go back to 0 after hitting 65535.
void interruptFunction()
{
interruptCount++;
}
void setup() {
Serial.begin(38400);
Serial.print("Reset"); // so that reset is obvious on serial console
#ifdef MIGHTY1284
DDRA=0x0; DDRB=0x0; DDRC=0x0; DDRD=0x0; // set all pins as inputs
PORTA=0xFF; PORTB=0xFF; PORTC=0xFF; PORTD=0xFF; // turn on all pullup resistors.
#else
pinMode(ARDUINOPIN, INPUT_PULLUP); // See http://arduino.cc/en/Tutorial/DigitalPins
#endif
enableInterrupt(ARDUINOPIN, interruptFunction, CHANGE);
}
// In the loop we just display interruptCount. The value is updated by the interrupt routine.
void loop() {
Serial.println("---------------------------------------");
delay(1000);
Serial.print("Pin was interrupted: ");
Serial.print(interruptCount);
Serial.println(" times so far.");
}