Port Registers for the Mega 328

This is the webpage for the port information on the 168 and there are links to the 328, but there is no information there. Can anyone tell me the reserved port names and pin designations for the Mega 328?

They should be exactly the same as it says on the page you referenced.


But the 328 has 53 digital pins and the 168 only has 13 digital pins, what are the port Registers for the rest of the 40 pins?

But the 328 has 53 digital pins

Oh no it doesn't, you're thinking of the ATmega2560 family. The 168 and 328 are exactly the same pinout wise.


Your nomenclature is slightly twisted which lead to the confusion. The early Arduino Duemilanove was initially shipped with an Atmel ATmega168 processor. Later versions of the Duemilanove were shipped with the Atmel ATmega328 processor as is the Uno. The early Arduino Mega was shipped with the Atmel ATmega1280 processor. The current version is called the Mega2560 and it ships with the Atmel ATmega2560 processor.

Since there has never been an Arduino Mega 328 board I had no idea that you were referring to an Arduino Mega board and I assumed you were referring to an Atmel Mega328.

Now to answer your question or more specifically to tell you how to get the answer to your question. You will have to look at the schematic and work your way from the Arduino pin numbers that are scattered around the diagram back to the chip itself and then look for the Atmel pin names. For example on the Arduino Mega2560 diagram you will find a block labeled ADCL near the lower right corner of the processor. These seem to be the A0 - A7 pins in Arduino terminology and they connect to the PF0 - PF7 pins in Atmel terminology. You would access them as PORTF, PINF and DDRF. Similarly A8 - A15 go to PK0 - PK7 and they would be accessed with PORTK, PINK and DDRK. The preceding information is not guaranteed, some corroboration from others would be appreciated. Note that I picked the easy ones, some of the ports appear to be really scrambled with respect to the Arduino nomenclature.


I found this link helpful ..

From this forum entry

I am so embarrassed! Yes, it is the 2560 I was speaking about. I just gonna go sit in the corner now and look at schematics. Thanks floresta & marker.