AVR Cheat Sheet

ATmega328 Timers

Setting PWM Frequencies All frequencies are in Hz and assume a 16.00MHz clock. The 3 LSBs in TCCRxB control the timer pre-scalers. Arduino pins 5 & 6 are controlled by Timer 0.

Setting     Divisor     Frequency
0x01        1           62500
0x02        8           7812.5
0x03        64          976.5625
0x04        256         244.140625
0x05        1024        61.03515625

TCCR0B = TCCR0B & 0b11111000 | <setting>;

Arduino pins 9 & 10 are controlled by Timer 1.

Setting     Divisor     Frequency
0x01        1           31250
0x02        8           3906.25
0x03        64          488.28125
0x04        256         122.0703125
0x05        1024        30.517578125

TCCR1B = TCCR1B & 0b11111000 | <setting>;

Arduino pins 11 & 3 are controlled by Timer 2.

Setting     Divisor     Frequency
0x01        1           31250
0x02        8           3906.25
0x03        32          976.5625
0x04        64          488.28125
0x05        128         244.140625
0x06        256         122.0703125
0x07        1024        30.517578125

TCCR2B = TCCR2B & 0b11111000 | <setting>;

Links

AVR Delay Loop Calculator

AVR Fuse Calculator

AVR ISP Pinout

6pin ISP, from top
       _______
MISO --| 1 2 |-- VCC
SCK ---| 3 4 |-- MOSI
RESET -| 5 6 |-- GND
       -------

10pin ISP, from top
      _______
MOSI--| 1 2 |-- +5V
N/C---| 3 4 |-- GND
RESET-| 5 6 |-- GND
SCK---| 7 8 |-- GND
MISO--| 910 |-- GND
      -------

The red striped wire on grey ribbon cable is always pin 1. Pin 1 is often marked on the board with a "1" or an arrow.

FTDI Cable Pinout

1: GND/BLACK
2: CTS/BROWN
3: VCC/RED
4: TXD/ORANGE
5: RXD/YELLOW
6: RTS/GREEN

AVR DIP Package Pinouts

List of microcontrollers in PDIP packages

ATtiny25/25V/45/45V/85/85V
ATtiny25/25V/45/45V/85/85V Datasheet

            ______
~RESET/PB5 -|º   |- VCC
       PB3 -|    |- PB2/SCK
       PB4 -|    |- PB1/MISO
       GND -|    |- PB0/MOSI
            ------

ATtiny24/24A/44/44A/84/84A
ATtiny24/44/84 Datasheet
ATtiny24A/44A/84A Datasheet

            ______
       VCC -|º   |- GND
       PB0 -|    |- PA0
       PB1 -|    |- PA1
~RESET/PB3 -|    |- PA2
       PB2 -|    |- PA3
       PA7 -|    |- PA4/SCK
  MOSI/PA6 -|    |- PA5/MISO
            ------

ATtiny2313/2313V/2313A/4313
ATtiny2313/2313V Datasheet
ATtiny2313A/4313 Datasheet

            ______
~RESET/PA2 -|º   |- VCC
   RXD/PD0 -|    |- PB7/SCK
   TXD/PD1 -|    |- PB6/MISO
       PA1 -|    |- PB5/MOSI
       PA0 -|    |- PB4
       PD2 -|    |- PB3
       PD3 -|    |- PB2
       PD4 -|    |- PB1
       PD5 -|    |- PB0
       GND -|    |- PD6
            ------

ATtiny261/461/861
ATtiny261A/461A/861A Datasheet

            ______
  MOSI/PB0 -|º   |- PA0
  MISO/PB1 -|    |- PA1
   SCK/PB2 -|    |- PA2
       PB3 -|    |- PA3
       VCC -|    |- AGND
       GND -|    |- AVCC
       PB4 -|    |- PA4
       PB5 -|    |- PA5
       PB6 -|    |- PA6
~RESET/PB7 -|    |- PA7
            ------