I've been doing research for the last few hours trying to determine the mapping of physical pins to memory-mapped I/O registers for the Arduino Mega board (which is an ATmega 2560 R3).
- My code is on GitHub in a pull request, but hasn't been merged yet because I'm not finished yet.
- This is the upstream example I'm working from, which was written for an ATmega 32A.
- Here is Arduino's 2560 pin mapping which doesn't tell which registers are mapped to which pins.
- Here is
avr/iomxx0_1.hwhich defines the ports with simple numbers that I can't make heads or tails of.
- Here is a collection of links relevant to my research.
- I broke down and cross-referenced all of the uses of memory-mapped I/O registers in the upstream example.
Some of the registers used include
TCNT1. I can't figure out which pins these are and/or what they do.
Here is a diagram provided by the upstream example:
Unfortunately, I'm not very good at reading these diagrams so I'm doing my best.
How can I determine the mapping of these registers to physical ports on both the ATmega 32A, which is the board the example was originally written for, and the ATmega 2560 R3, which is the board I'm currently working with?