Have you looked at the documentation for the Uno and the Mega 2560 pins? It would explain a lot of things.