Path: home => avr main => how-to => AVR type selection    (Diese Seite in Deutsch: Flag DE) Logo
How-To logo

How-to select an optimal AVR type for my hardware needs


Arduino-owners and -users do not need to read this. The answer to the question is always and in any case ATmega328 for them. So you Arduino-addicted people: stop reading, otherwise you might run into trouble, as you will learn some things that you might have thought that those are not possible with your Arduino.

The others, that want use their own brain instead, have a problem here: Do I have to download hundreds of device handbooks and read through thousands of pages to just find out, which of the several hundred AVR types fit my needs best? No. There is a simpler tool that allows to find that out. It is the AVR simulator avr_sim, available here as Windows- or Linux-executable or as Lazarus source code, to be compiled on your own.

1 Starting the device-selector

Starting avr_sim After starting avr_sim you'll see this window (or a similar screen). The menu is small, only two entries. And of course, the first entry "Project" is the one you'll need. If you click the entry "New" as sub-menu of "New" the following window opens:

The device-selector in the Project-New entry The marked button starts the device-selector. And this looks like this:

The device-selector-window This window has lots of entry fields:

2 Selecting clock options

Clock options to select from If we assume we want to build a clock. In that case we need an external crystal or an external crystal oscillator, because the internal RC oscillator is inaccurate for that purpose. In that case we click into the "Required hardware properties" window ande here onto the needed "Clock options": either we select "External oscillator" or "External crystal". This removes all types of AVRs from the list that do not have an "XTAL1" or, in case of an external crystal, do not have an "XTAL2" pin as well. "Show failed" and the button "Remove package messages" shows all these removed types:

Inapropriate types Below the criterion list the window shows all those AVR types that do not have both XTAL pins.

This is a suitable example how fast and simple the device-selector has found this out, without the need to consult more than hundreds of device handbooks. XTAL-pins assigned In all types that we can select by clicking the list in the middle now have the pins XTAL1 and XTAL2 assigned to this function, all other potential assignments do not appear any more.

3 Assigning I/O-pins

Three different options allow to assign I/O-pins and their in- and outputs:
  1. 8-bit-I/O: This assigns one or more complete I/O-ports to be I/O. All other potential assignments do not appear any more.
  2. 4-bit-I/O: This assigns one or more 4-bit-nibbles as I/O, which can be either in the lower or in the upper half of a port.
  3. 1-bit-I/O: This assigns one or more single pins to be I/O.
This assignment is not so trivial as it looks like, especially if single pins in a port are already assigned to another function, which cannot be moved to another pin location.

Original pins 8-bit-port assigned 4-bit-port assigned 4-bit-port assigned to the lower nibble 1-bit-port assigned These pictures show the potential original pin assignments on the left and one single I/O pin, the two different assignments of a 4-bit-port and an 8-bit-port.

The two different assignments of the 4.bit-port were achieved by setting the ISP pins Mosi, Miso and Sck as exclusive. This forces the selector to place the 4-bit-port to the lower nibble in port A.

4 Assigning external interrupts

Selecting external interrupts Assigned external interrupts Two types of external interrupts are possible: Ints and Pcints. Both can be assigned, but both are different. Ints are fixed to certain pins, while Pcints can be moved.

Assigning Pcints, if more than one Pcint channel is available, selects pins in all available channels until the number of needed Pcints is assigned (if those are not already blocked by other assigned functions).

5 Other functions

There are more functions that can be applied:

6 Combinations of all

Kombinierte Auswahl Of course, all named requirements can be selected in parallel, and are assigned by the selection algorithm. Here, the following combination has been selected:
  1. one external Int,
  2. exclusive ISP pins,
  3. an external crystal as clock,
  4. one 8-bit-port, one 4-bit-port and numerous single I/O pins,
  5. a few AD-converter pins,
  6. one analog comparer,
  7. an 8-bit-Timer/Counter with output on A,
  8. a UART with RX and TX.
Those who can do all that faster with a paper and a pencil can contact me.



Much success by selecting your personal optimal AVR type. With the opportunity to copy all those windows to the clipboard or to copy the whole window as screenshot, you can document the selection process and you can use these information later on.

To the top of that page, to the Q+A page

©2021 by http://www.avr-asm-tutorial.net