Hello everyone!
I have a problem that I have researched enough to know it is an interrupt conflict between the PinChangeInterrupt and SoftwareSerial libraries, and the solution seems to lie in editing the PinChangeInterrupt.h file and the
SoftwareSerial.cpp file.
I am using Mega pin 14 (Port J, PCINT 10) for Tx on the SoftwareSerial (no Rx needed) to control a Sabertooth 2x60 H-bridge, and am using Mega pins 10, 50...53 as pin change interrupts. These are all on port B, if I am not mistaken.
I have added the #define NO_PORTJ_PINCHANGES before the #include for the pin change interrupt library in the sketch as per the instructions in the PinChangeInterrupt.h file:
//-------- define these in your sketch, if applicable ----------------------------------------------------------
//-------- These must go in your sketch ahead of the #include <PinChangeInt.h> statement --
// --- Mega support ---
//#define NO_PORTB_PINCHANGES // to indicate that port b will not be used for pin change interrupts
// #define NO_PORTJ_PINCHANGES // to indicate that port j will not be used for pin change interrupts
// #define NO_PORTK_PINCHANGES // to indicate that port k will not be used for pin change interrupts
Now, as I understand, I need to edit the SoftwareSerial.cpp file to not use port B, and that is where I am stuck. Nothing I've tried works. The relevant code (I believe) from the SoftwareSerial.cpp file:
#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif
#if defined(PCINT1_vect)
ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect));
#endif
#if defined(PCINT2_vect)
ISR(PCINT2_vect, ISR_ALIASOF(PCINT0_vect));
#endif
#if defined(PCINT3_vect)
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect));
#endif
I don't know which lines to comment out, or do I need to add lines, since I don't see PCINT 10 mentioned?
I've stared at this so long now, I'm not even seeing it anymore, LOL
Oh, and the compile-time error message:
libraries/SoftwareSerial/SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_9'
sketch/SunTracker_4.0.000.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status