Background: I'm looking at writing a library to drive an LED matrix panel (one of these:http://www.adafruit.com/product/607) from my newly acquired Arduino Due. My background is C++ programming, not electronics.
I'm planning to experiment with various optimisations of the code for memory and speed, but one constant is that I would like to be able to send the data to the matrix with single memory writes to port registers without having to use masking operations to leave certain bits unaffected. As I need to send 6 bits of data with a clock signal, I figured this could be easy with an 8 bit write to one byte of a port register. The 8th bit/pin could be used as the latch or some other used line.
Looking at the nice pinout diagram that someone has kindly put together (http://forum.arduino.cc/index.php/topic,132130.0.html), I was pretty shocked to discover that my plans weren't going to be as easy as I would have liked. There are only two circumstances where there are whole bytes of port registers that connect to digital pins (Port A byte 1 and Port D byte 0). All other bytes have "holes" in them, for example Port C byte 0 has no connection for bit 0, but has bits 1-7;
While two complete bytes is enough (I actually only need to use 13 pins to control the display, plus ground connections), the pins of the available two are spread out in a way that would make it a little awkward for me to make a stripboard shield as I intended due to the pins on the Arduino boards not being evenly spaced (why is that?) and I'm guessing that since most of the digital pins in Port A byte 1 are used for communication pins (including RX0 and TX0) I would lose my ability to print to the debug log. As a result, I've ruled out using those port registers.
That leaves me with bytes 0 and 1 of Port C. There are just enough pins available with those bytes and they are grouped nicely on the double connector at the bottom of the board (Digital pins 33-40 and 48-51), however some bits in those bytes are not mapped to Arduino IO pins.
Would it be bad if I were to write to bits of a port register that do not have Arduino IO pins assigned to them? Would the answer depend on whether I had set those bits to be inputs or outputs using the Output Write Enable Registers? I'm assuming that these bits are used for IO pins on the SAM3X8E chip but just not made available to the Arduino boards.