Swim100flyy:
I am running the Mega with the code above, having all of the interrupts waiting for an input. Once it is seen, it serial prints a character out.
The code that you posted prints out all of the counters as fast as it can go through the loop.
Swim100flyy:
The second arduino (diecimila) is doing a HIGH (delay 100) Low (delay 100) loop.
So, put a delay(1000) or delay(2000) or some such thing at the bottom of the loop to let you see what is going on.
Swim100flyy:
I tried:...
Here's my suggestion: Enable internal pullups on all input pins.
Forget the 10K to ground.
Connect the external signal to each input pin (one at a time) through the resistor and tell us what happens.
Make sure the grounds are really connected solidly together through as short a wire as you can arrange.
Regards,
Dave
On the Mega1280:
// Pin numbers for the external interrupt inputs are
// for Arduino Mega boards.
//
// Tested on Mega1280
//
// davekw7x
//
#include <avr/interrupt.h>
volatile byte Acount;
volatile byte Bcount;
volatile byte Ccount;
volatile byte Dcount;
volatile byte Ecount;
volatile byte Fcount;
void setup()
{
Serial.begin(9600);
//
// Set pullup resistors on external interrupt pins
//
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(18, HIGH);
digitalWrite(19, HIGH);
digitalWrite(20, HIGH);
digitalWrite(21, HIGH);
//
// Connect pins to interrupt routines
//
attachInterrupt(0, iTrigger, RISING); // Digital Pin 2
attachInterrupt(1, jTrigger, RISING); // Digital Pin 3
attachInterrupt(2, kTrigger, RISING); // Digital Pin 21
attachInterrupt(3, lTrigger, RISING); // Digital Pin 20
attachInterrupt(4, mTrigger, RISING); // Digital Pin 19
attachInterrupt(5, nTrigger, RISING); // Digital Pin 18
}
void loop()
{
Serial.println("----------------------------");
Serial.print("Interrupt 0: ");
Serial.println(Acount,DEC);
Serial.print("Interrupt 1: ");
Serial.println(Bcount,DEC);
Serial.print("Interrupt 2: ");
Serial.println(Ccount,DEC);
Serial.print("Interrupt 3: ");
Serial.println(Dcount,DEC);
Serial.print("Interrupt 4: ");
Serial.println(Ecount,DEC);
Serial.print("Interrupt 5: ");
Serial.println(Fcount,DEC);
delay(2000);
}
void iTrigger()
{
Acount++;
}
void jTrigger()
{
Bcount++;
}
void kTrigger(
{
Ccount++;
}
void lTrigger()
{
Dcount++;
}
void mTrigger()
{
Ecount++;
}
void nTrigger()
{
Fcount++;
}
On the driving Duemilanove:
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
(Make sure that the grounds are securely connected.)