I can use another PIN for INT ?


I use a ATMega324PB Controller : https://camo.githubusercontent.com/c188b2928bbbe2f7cbd9b7d6733c6af72b6b6292c56082cf3ff68979a20a171a/68747470733a2f2f692e696d6775722e636f6d2f5454664f6b79462e6a7067

I need to use 2 spi with INT pin (for CAN module MCP2515 and an other)

But if I do this, I can't use RXD1 and TXD1 because it's INT0 and INT1. But I use all other serial PIN. So... My question is I can use an other pin for INT1 and INT0 ?

Code :

      static const byte MCP251x_CS   = 10;                        // CS input of MCP2515
      static const byte MCP251x_INT  =  3;                        // INT output of MCP2515
      ACAN2515    can   (MCP251x_CS, SPI1, MCP251x_INT);          // ACAN2515 Driver object

Thanks !

On the ATmega324P, all pins can be used as PCINT (pin change) interrupt sources. Data sheet is here.

INT0 and INT1 cannot be reassigned.

So, I can use an other pin and declare it as INT

And use INT0 and INT1 as RX TX PIN ?

So, I can use an other pin and declare it as INT

And use INT0 and INT1 as RX TX PIN ?

No, you cannot. The INTx pins are fixed.

Hmm, according to jremington, all pin can be used as PCINT, If I use the MCP2515 Library, i can set the INT pin ?

      static const byte MCP251x_CS   = 10;                        // CS input of MCP2517 
      static const byte MCP251x_INT  =  3;                        // INT output of MCP2517
      ACAN2517    can   (MCP251x_CS, SPI1, MCP251x_INT);          // ACAN2517 Driver object

And for the ATMEGA324PB :

I have INT 0 = RXD1 PIN and INT1 = TX1 PIN...

I don't understand If you say No for use pin as Serial or If you say no for use PCINT for Interrupt pin

A pin change interrupt (PCINT) is handled differently than INT0 or INT1.

Look on the web for "arduino pin change interrupt library" and check whether the ATmega324 is supported (I doubt it is). If not, you will have to write your own interrupt handler, but you could use one of the existing libraries or tutorials as a guide.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.