Page 1 of 1

Arduino Mega Int0 and Int1

Posted: Thu May 04, 2017 8:21 pm
by jgu1
Hi All!

I see on Arduino Mega R3 pinout that Int0 and Int1 is pin PD0 and PD1. These 2 pins are also SCL and SDA, Serial com. These 2 pin are always high and I can not manage to get these two INT0 and INT1 to work in FC7. Is there some configuration for these pin before I can use them as Int pin :?: The rest of INT pin work fine.

Somebody who can help

Br Jorgen

Re: Arduino Mega Int0 and Int1

Posted: Fri May 05, 2017 10:42 am
by Benj
Hi Jorgen,

Please can you post a simple program that demonstrates the issue and we will investigate for you. Thanks.

Re: Arduino Mega Int0 and Int1

Posted: Fri May 05, 2017 11:05 am
by jgu1
Hi Ben!

Yes I send one at the end of the weekend. Not home at the moment. Thank´s for your fast reply.

Br Jorgen.

Re: Arduino Mega Int0 and Int1

Posted: Sun May 07, 2017 9:05 am
by jgu1
Hi Ben!

I made a new testprogram, with this a new behavior.

In simulation it work fine. But in real world by activating:

Int0 = A1 and A2 go high
Int1 = Same
Int2 = A1 A2 A3 go high

Read carefully :roll: :

If I let Int0 and Int1 stay high, and reset output. and let Int0 goes from high to low to high again it work (A1 Goes high), same for Int1 (A2 goes high). And let Int0 Int1 stay high, Int 2 work also perfect.

I have tested with 3 boards and the same result.

Could it be, that it cause that the Int0 and Int1 Digital pin 20 and 21 are for seriel communication? the pin are always high so we have to toggle them from high to low and then int work when high. All other Int. work fine.

Alternatively, of course, I can only use other interrupt.so maybe everything is ok? But then everyone here knows what's wrong if somebody should experience the same thing :wink: But what are they do in Arduino IDE?

A big mouthful, hope I have explained clearly

Bet regard Jorgen

Re: Arduino Mega Int0 and Int1

Posted: Mon May 15, 2017 7:07 pm
by jgu1
Hi Ben!

I dare to ask, have you had time to look at this topic, please.

Br Jorgen

Re: Arduino Mega Int0 and Int1

Posted: Tue May 16, 2017 1:32 pm
by Benj
Hello Jorgen,

Ok so INT0 and INT1 are being pulled high by default so how in your circuit are you pulling the pins low?

You're currently using active high switches, the output is high when you press the switch so it sounds like you need to interrupt to fire when the switch is pressed.

The wiki page here shows the setup for an active high switch.

https://www.flowcode.co.uk/wikiv7/index. ... 2979cfc92e

You will need the pull down resistor to be able to combat the current active high pull up resistor, so switch the 10K for maybe a 1K. The lower the resistance the more current will be permanently flowing but the better your chances at combating the pull up. The other resistor probably wants to be something like 10% of the pull down resistor so maybe 100 Ohms. If 1K doesn't work then you may need to go lower with both resistors or instead change to an active low switch and a falling edge interrupt. With an active low you only need the active pull down resistor as the pull up resistor already is present.

Also note D0 and D1 are used for USB reprogramming on Arduino so if you do add this circuitry it likely won't allow you to program any more which it is attached.

Re: Arduino Mega Int0 and Int1

Posted: Tue May 16, 2017 6:04 pm
by jgu1
Hi Ben!

Thank´s for reply and your explanation. Concerning pin´s need to be high or low, and active hi/lo I know. I just want to know if my theory was correct. These pin compared
with the other pin, they are always high (because they are dedicated for serial comm, I suppose). But if I make them low with a pull down resistor and activated them with a high signal, int work´s pefect :D
I just thought that when these pins were used as int. in the program, they would automatic be like other inputs.

Everything ok Ben. We just have to remember these pin have internal pullup. :wink:

Thank´s

Br Jorgen