How to change pin mapping in Arduino Mega?

I'm working on an "arduino Mega compatible" board (ATmega1280), and I want to access portF as general I/O. This way I can use standard pinMode() , digitalWrite() and digitalRead() functions to operate them. But portF is not assigned with pin numbers. Can anyone give me a hint how to do this?


Don't know anything about the Mega, but this thread may help:

From the above link, here is the useful chart (linked below) that shows you can use analog input pins A0-A15 in digital mode by referencing them as pins 54-69. So therefore Port F (bits 0-7) can be referenced as A0-A7 (for analog inputs) or digital pins 54-61 (as digital I/O).


Thanks for the links. Does it mean that a port which is not assigned with any number cannot be access from arduino environment? For example how to use Port J as general I/O? There is no pin mapping for PJ2~PJ7.


There's a way to do what's called "Direct Port manipulation".

I've seen it done, but I've no idea how ;D.

There is no pin mapping for PJ2~PJ7.

Actually there are 16 pins not mapped for the Arduino Mega board. Not only are they not mapped, there is no wiring traces from the processor chip to any connector. The Seeeduino mega board does wire these 16 'extra' pins to an additional connector, but because the Arduino core software does not map these pins one has to use direct port access commands to mode/read/write to these pins. These 'unreachable' pins on the Arduino Mega board are:


Direct port commands are explaned here:


Thank you all for the help! Now I can access any port on 1280, just as using assembler from atmel... ;)