You are on page 1of 4

/* pins_arduino.

c - pin definitions for the Arduino board Part of Arduino / Wiring Lite Copyright (c) 2005 David A. Mellis This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $ */ #ifndef _AVR_IO_H_ #include <avr/io.h> #endif //#include "wiring_private.h" #ifndef Wiring_h #include "wiring.h" #endif #ifndef Pins_Arduino_h #include "pins_arduino.h" #endif #define #define #define #define PA PB PC PD 1 2 3 4

// these arrays map port names (e.g. port B) to the // appropriate addresses for various functions (e.g. reading // and writing) const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, &DDRA, &DDRB, &DDRC, &DDRD, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT,

&PORTA, &PORTB, &PORTC, &PORTD, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PORT, &PINA, &PINB, &PINC, &PIND, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { PA, //* 0 PA7 analog PA, //* 1 PA6 PA, //* 2 PA5 PA, //* 3 PA4 PA, //* 4 PA3 PA, //* 5 PA2 PA, //* 6 PA1 PA, //* 7 PA0 PB, PB, PB, PB, PB, PB, PB, PB, PC, PC, PC, PC, PC, PC, PC, PC, PD, PD, PD, PD, PD, PD, PD, PD, //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* //* 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 PD0 PD1 PD2 PD3 PD4 PD5 PD6 PD7

LED LED

these arnt brought out but are needed for access to LED

}; const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { _BV(7), /* 7, port A */ _BV(6), _BV(5), _BV(4), _BV(3), _BV(2), _BV(1), _BV(0), _BV(0), /* 8, port B */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7), _BV(0), /* 16, port C */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7), _BV(0), /* 24, port D */ _BV(1), _BV(2), _BV(3), _BV(4), _BV(5), _BV(6), _BV(7), }; const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { NOT_ON_TIMER, //* 0 - PA7 NOT_ON_TIMER, //* 1 - PA6 NOT_ON_TIMER, //* 2 - PA5 NOT_ON_TIMER, //* 3 - PA4 NOT_ON_TIMER, //* 4 - PA3 NOT_ON_TIMER, //* 5 - PA2 NOT_ON_TIMER, //* 6 - PA1 NOT_ON_TIMER, //* 7 - PA0 NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, //* //* //* 8 - PB0 9 - PB1 10 - PB2

TIMER0A, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, TIMER1B, TIMER1A, NOT_ON_TIMER, TIMER2,

//* //* //* //* //* //* //* //* //* //* //* //*

11 12 13 14 15

PB3 --- TIMER OC0 PB4 PB5 PB6 PB7

16 - PC0 17 - PC1 18 19 20 21 22 //* PD2 PD3 PD4 PD5 PD6 23 - PD7

//* these arnt brought out but are needed for access to LED NOT_ON_TIMER, //* 24 - PD0 NOT_ON_TIMER, //* 25 - PD1 NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, NOT_ON_TIMER, }; //* //* //* //* //* //* 26 27 28 29 30 31 PC2 PC3 PC4 PC5 PC6 PC7

You might also like