Go Down

Topic: ATTiny 25/45/85/2313 Pin numbers (Read 9 times) previous topic - next topic


Thanks for the replies.

However, I still don't understand why the physical pin numbers of these chips aren't used in the sketch like they are if you are using the 328 on the main Arduino board ?

look at the "cheatsheet" attached in my last reply, in the arduino board the pins are already labeled and traced to the headers so atmega328 physical pin 19 is Digital 13 in the board,  , (try looking at the front of the arduino pcb board and trace physical pin 28 to A5, that's the best way to "understand" the layout)....

p.d.: im a newbie too in this, sorry if i misunderstood something....


Thanks charlie_dream now I understand. We aren't using the actual pin numbers of the chip itself. We're using the pin 'function'. In the case of the ATTiny 45, physical pin 5 is PB0. Therefore we're referencing 0 (zero) like digitalWrite(0, HIGH); zero referring to PB0 of the chip.

Duh on me. I guess I need to read a little better.  LOL



We've updated the cheat sheet that was mentioned earlier in this post to include Arduino-tiny pinouts for the ATTiny2314/4313 as well as ATTiny25/45/85.

If you are interested, it can be downloaded here:


Thanks karl_b. Really useful cheatsheet.

BTW, there's another easy way to check the pin-out and logical pin numbers...

Go to "My Documents/Arduino/hardware/tiny/cores/tiny" and open the file "pins_arduino.c" and one can find nice ASCII text description of the pins, like this in comments...

Code: [Select]

//                   +-\/-+
//      (D 17) PA2  1|    |29  VCC
// RX   (D  0) PD0  2|    |19  PB7 (D  16)
// TX   (D  1) PD1  3|    |18  PB6 (D  15)
//      (D  2) PA1  4|    |17  PB5 (D  14)
//      (D  3) PA0  5|    |16  PB4 (D  13)*
// INT0 (D  4) PD2  6|    |15  PB3 (D  12)*
// INT1 (D  5) PD3  7|    |14  PB2 (D  11)*
//      (D  6) PD4  8|    |13  PB1 (D  10)
//     *(D  7) PD5  9|    |12  PB0 (D  9)
//             GND 10|    |11  PD6 (D  8)
//                   +----+
// * indicates PWM port

// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)

In a browser, due to usage of proportional fonts, it might not look great, but in a text-editor with fixed-width fonts, it's just fine.


Yeah, that's a very nice diagram too. In fact, we used it along with the description in core_pins.h as a reference when we updated the cheat sheet.

PS: D17 isn't directly usable, since it is the RESET pin and needs to be remapped by changing fuses to function as a normal digital port. The same goes for D5 in the ATTinyX5 (but we left it in the diagram, since it is also assigned to analog port A0).

Go Up