Interrupt issues after moving from Duemilanove to MEGA 1280

Hi Guys

I've moved my weather warning project from my old Duemilanove (Mega328) to a Mega1280 for the extra code space and RAM as I was running out of space for some new features I was trying to add (mainly logging to SD card)

All working nicely - right up to when I spin the anemometer and it goes haywire! My DHT22 readings go nuts until the anemometer stops moving

Moved the hardware back to the Mega328 board and it behaves correctly. Anemometer is still connected to same pin (Digital 2/Interrupt 0) and DHT22 to Digital 3 on both arduinos

Have I missed something important about the move from Mega328 to Mega1280 in regards to interrupts? Or something else maybe??

I'll have to edit the code a fair bit to post it so be patient

The 1280 is not a standard Arduino. The interrupts pins may be different.

Thanks Paul - so an Arduino Mega is not really an Arduino? Thats handy!

From the official Arduino MEGA page though:

External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

So it seems that they should be the same (Int 0 & 1 at least - which is all I am using) but for whatever reason the anemometer is affecting the DHT22 readings on the MEGA where it works find on the old 328 :frowning:

From the official Arduino MEGA page though:

That's for the 2560, isn't it?

From same page :confused:

Overview

The Arduino Mega is a microcontroller board based on the ATmega1280 (datasheet). It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila.

I have moved some stuff around and got it working but would be nice to know why it wouldn't play ball!

I shifted my 3G serial comms to TX2/RX2 instead of TX1/RX1 and moved the anemometer input to Digital 19 (INT_4) freed up by the move of USARTS and now its working again

I'll have to get a MEGA2560 and try that to see if its different!

Have I missed something important about the move from Mega328 to Mega1280 in regards to interrupts? Or something else maybe??

This is so vague it's hard to know what to do with it. Hardly a programming question if there is no code.

Certainly different chips have different interrupts, as documented in the respective datasheets, if that answers your question.

Int_0 & Int_1 should be the same on the Duemilanove & MEGA boards according to their respective pages but for some reason don't want to play ball in this app - I've got around it now :slight_smile: