Re-wiring the serial port pins

If you use digital pins 0 and 1 as general I/O, you can’t use serial comms anymore. You can use the SoftwareSerial library to define alternate pins on which to communicate, but from my reading, there are some timing issues. I’ve played around with it, trying to call an instanced Serial object from an interrupt, but things didn’t look happy.

So what would happen if I were to simply reroute the MAX RX/TX pins from digital pins 0 and 1 to other pins, say 12 and 13? Would Serial.begin, Serial.print, etc, still work? Are they tied to digital pins 0 and 1, or would I need to still create a new Serial object instance? If I did need to create a new Serial instance, would the software shove off to the UART, or use processor time to handle it?

I’m just pondering a few things, so the basic reason I ask is “because I can”, not that I have any real need or plans in mind. It just feels a little limiting: you either have robust serial comms on digital pins 0 and 1, and lose those pins as general I/O, or not.

Hope I am making some sort of sense.

So what would happen if I were to simply reroute the MAX RX/TX pins from digital pins 0 and 1 to other pins,

That would be pointless, since the ATmega’s hardware UART is physically tied to those pins on the die.

you either have robust serial comms on digital pins 0 and 1, and lose those pins as general I/O,

That’s how it works.

All the functionality that gets shoehorned into a microcontroller (not just an ATmega - any microcontroller) is a series of comprimises. The idea is not you’ll need 100% of the functionality all the time, but that you (as a design engineer) can learn one microcontroller and use it in many different projects. Good for you, you only learn one complex device; good for Atmel, they sell you chips for every project.

-j

So what would happen if I were to simply reroute the MAX RX/TX pins from digital pins 0 and 1 to other pins,

That would be pointless, since the ATmega’s hardware UART is physically tied to those pins on the die.

Yea, I checked the datasheet just now, I should have done that prior to posting. Oh well, thanks for answering.