Instructables

Step 6: Pin outs

The pin outs are always like the following:

Digital pins:

Digital pin 1: Port A, Bit 0 = PA0
Digital pin 2: Port A, Bit 1 = PA1
...
Digital pin 8: Port A, Bit 7 = PA7
Digital pin 9: Port B, Bit 0 = PB0
Digital pin 10: Port B, Bit 1 = PB1
etc. etc. etc.

Analog pins:

The analog pins are defined like the above, but the ADC pin with the first register (after the alphabet; Port A is before Port B etc.) what has ADC and the first bit (bit 0) is analog pin 0, the ADC pin with the first register what has ADC and the second bit of that register is analog pin 1.
etc. etc.

PWM pins:

PWM pins have the same pin numbers as normal digital pins. To see witch digital pins are PWM enabled, look at the pin out in the datasheet. At some pins, there will stand "OC#@" There the # is a number and the @ is a letter. The @ is not always present. So on every pin there is stand OC + a number + a letter (not always) has hardware PWM.

Serial pins:

Serial pins are defined as RXD and TXD. Some times there are multiply hardware Serial lines. If this is present, TXD and RXD are Serial, TXD1 and RXD1 are Serial1 etc. etc.

Other pins:

To see that pins have I,,2,,C, SPI etc. look at the datasheet and search for the corresponding pins (I,,2,,C: SDA and SCL etc.)

Interrupts:

The interrupt pins are labeled with INT#, there # is the number of the interrupt.



If anything is unclear, post a comment.
 
Remove these adsRemove these ads by Signing Up
themroc3 years ago
It would be fine if you´d said, that the image is an ATtiny2313. To have a better access to this example try to have the pinmapping in a table.

A great job for a 14 Year old boy!

themroc
Pin mappings are on the mfr site for the chips, no reason for him to duplicate work for an indestructible with such a wide range of options.
sarveshk3 years ago
Another thing, I also tried to flash ATmega32. I chose Penguino Board from the list, as it uses ATmega32 mcu. But the pin mapping of this board is totally messed up. You can find it's pin mapping at http://wiki.icy.com.au/Documentation/PenguinoAVR/Arduino%20Compatibility

I wish to add another board for ATmega32 with std pin mapping as shown in this instructable. How can do that? Do I just have to add another board profile in "boards.txt" or do I also need to add a pin mapping file in the core folder?
02JanDal (author)  sarveshk3 years ago
I would try to use the available pin mappings. Adding new ones is not just to edit the boards.txt file, you also have to create a set of core files (there you could perhaps use the ones for penguino) and you also have to create the new files for pinmapping.

That would be a lot of work, and I don't feel like explaining it.

Jan
sarveshk3 years ago
Please elaborate the pin outs. I am confused. Please make an PDF if possible for convinience.
02JanDal (author)  sarveshk3 years ago
Some day perhaps, then I have time, much time, but that is a very much work, but I'm working on pinout tables for some normal MCUs, like ATtiny2313 or the ATmegaxx8 family
Nice! Keep it up buddy!

Well, I am not able to compile servo program for Atmega16. Do you know how to solve it? It gives me the following errors

..\arduino-0022\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':

..\arduino-0022\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope

..\arduino-0022\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope
02JanDal (author)  sarveshk3 years ago
That is because different MCUs use different register names. The servo library from the Arduino IDE does only work for some MCUs, but for most, it generates errors.

I would recommend a google search. I'm sure you will find something.