Show Menu
Cheatography

Arduino Uno to avr-gcc Migration Cheat Sheet by

Digital I/O Mapping

D0 (Rx)
PD0
D1 (Tx)
PD1
D2
PD2 (INT0)
D3 (PWM)
PD3 (INT1)
D4
PD4 (XCK/T0)
D5 (PWM)
PD5 (T1)
D6 (PWM)
PD6 (AIN0)
D7
PD7 (AIN2)
D8
PB0 (ICP1)
D9 (PWM)
PB1 (OC1A)
D10 (PWM)
PB2 (SS/OC1B)
D11 (PWM)
PB3 (MOSI/OC2)
D12
PB4 (MISO)
D13
PB5 (SCK)
Arduino UNO and ATmega328P microc­ont­roller digital pin mapping.

Analog I/O Mapping

A0
PC0 (ADC0)
A1
PC1 (ADC1)
A2
PC2 (ADC2)
A3
PC3 (ADC3)
A4
PC4 (ADC4/SDA)
A5
PC5 (ADC5/SCL)
Arduino UNO and ATmega328P microc­ont­roller analog pin mapping.
 

Altern­ative PIN Functions

PB0
PCINT0­/CL­KO/ICP1
PB1
OC1A/P­CINT1
PB2
~SS/OC­1B/­PCINT2
PB3
(**) MOSI/O­C2A­/PCINT3
PB4
(**) MISO/P­CINT4
PB5
(**) SCK/PCINT5
PB6
(*) PCINT6­/XT­AL1­/TOSC1
PB7
(*) PCINT7­/XT­AL2­/TOSC2
PC0
ADC0/P­CINT8
PC1
ADC1/P­CINT9
PC2
ADC2/P­CINT10
PC3
ADC3/P­CINT11
PC4
ADC4/S­DA/­PCINT12
PC5
ADC5/S­CL/­PCINT13
PC6
(*) PCINT1­4/~­RESET
PD0
PCINT1­6/RXD
PD1
PCINT1­7/TXD
PD2
PCINT1­8/INT0
PD3
PCINT1­9/O­C2B­/INT1
PD4
PCINT2­0/X­CK/T0
PD5
PCINT6­/XT­AL1­/TOSC1
PD6
PCINT2­2/O­C0A­/AIN0
PD7
PCINT2­3/AIN1
(*) Already reserved on Arduino UNO for crystal (16MHz) and RESET.
(**) Shared with progra­mmer's connector (see AVR910).
 

Arduino UNO Q/A

What's the crystal frequency?
16MHz
What's the default serial baud rate?
9600 baud

I/O Addressing

PINB (0x03)
PINB0|­PIN­B1|­PIN­B2|­PIN­B3|­PIN­B4|­PIN­B5|­PIN­B6|­PINB7
DDRB (0x04)
DDB0|D­DB1­|DD­B2|­DDB­3|D­DB0­|DD­B4|­DDB­5|D­DB6­|DDB7
PORTB (0x05)
PORTB0­|PO­RTB­1|P­ORT­B2|­POR­TB3­|PO­RTB­4|P­ORT­B5|­POR­TB6­|PORTB7
PINC (0x06)
PINC0|­PIN­C1|­PIN­C2|­PIN­C3|­PIN­C4|­PIN­C5|­PINC6
DDRC (0x07)
DDC0|D­DC1­|DD­C2|­DDC­3|D­DC4­|DD­C5|DDC6
PORTC (0x08)
PORTC0­|PO­RTC­1|P­ORT­C2|­POR­TC3­|PO­RTC­4|P­ORT­C5|­PORTC6
PIND (0x09)
PIND0|­PIN­D1|­PIN­D2|­PIN­D3|­PIN­D4|­PIN­D5|­PIN­D6|­PIND7
DDRD (0x0A)
DDD0|D­DD1­|DD­D2|­DDD­3|D­DD4­|DD­D5|­DDD­6|DDD7
PORTD (0x0B)
PORTD0­|PO­RTD­1|P­ORT­D2|­POR­TD3­|PO­RTD­4|P­ORT­D5|­POR­TD6­|PORTD7

Generic GPIO

GPIOR0 (0x1E)
GPIOR0­0|G­PIO­R01­|GP­IOR­02|­GPI­OR0­3|G­PIO­R04­|GP­IOR­05|­GPI­OR0­6|G­PIOR07
GPIOR1 (0x2A)
GPIOR1­0|G­PIO­R11­|GP­IOR­12|­GPI­OR1­3|G­PIO­R14­|GP­IOR­15|­GPI­OR1­6|G­PIOR17
GPIOR2 (0x2B)
GPIOR2­0|G­PIO­R21­|GP­IOR­22|­GPI­OR2­3|G­PIO­R24­|GP­IOR­25|­GPI­OR2­6|G­PIOR27
           

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          ArduinoNetworks - Arduino Cheat Sheet
          arduino Cheat Sheet
          Programación en Arduino Cheat Sheet