Still confused about pin names/numbers.

Folks, sorry to bang on about it, but I have looked at this link:

http://arduino.cc/en/Hacking/PinMapping?from=Main.PinMapping

Fantastic in some says, but not in others.

I am wanting a "map" of what that is, but also with the "numbers" of the pins.

I have an UNO - equiv' Looking at the board with the USB port to the left, pin ZERO is TOP RIGHT. Then going left, they count up. When you get all the way, they continue BOTTOM RIGHT and move another 6 pins to the left.

Alas, I have goofed a few times when prototyping and lost serious amounts of hair because I was looking at the wrong pin.

Is there another "overlay"/picture/something which also shows these numbers and their relationship to the board?

This shows the pins on the chip, and their equivalents on the Uno board. http://arduino.cc/en/Hacking/PinMapping168

There is no correlation between the location of the pin on the actual chip,and their location on the board itself.

ALWAYS refer to the pin number as listed on the board, NOT on a diagram of the chip itself.

Since you have an arduino board you are not wiring to the chip's pins but to the header pins on the board. For example if you have a pushbutton connected to Arduino pin labeled by the screening on the board as DIGITAL 7 and an LED to indicate that a function is paused connected to the DIGITAL 6

#define pauseButton 7
#define paused 6
...
pinMode(pauseButton, INPUT);
pinMode(paused, OUTPUT); 
...
while ( digitalRead(pauseButton) ) { digitalWrite(paused);}

Gory details: The header file pins_arduino.h is included by the IDE from the variants library corresponding to the "Tools/Board" selection. The arrays digital_pin_to_port_PGM and digital_pin_to_bit_mask_PGM are defined there and are indexed by the "arduino pin number" to determine the hardware port and bit_mask by the Arduino library functions pinMode(), digitalWrite() and digitalRead().

SS, MOSI, MISO, SCK,SDA, SCL, A0... are also established in pins_arduino.h

That Arduino pin mapping page is typical of the Arduino documentation

Below is the pin mapping for the Atmega8, the original chip used in early Arduinos. The pin mapping for the Atmega168 and the 328 is roughly the same.

Well is it the same or not? And if not say how it’s different or have more diagrams.

The relationship between logical pin numbers and actual pin numbers is always a problem and I think all systems have it. There’s little to do but just learn what pin is what and maybe make some sticky labels for the chip.

As dgerman said though if you are using a board it doesn’t matter that much until you start doing direct port manipulation at which time you at least need to know the relationship between ports and pins.


Rob