Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

iotn12.h

00001 /* Copyright (c) 2002, Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright
00010      notice, this list of conditions and the following disclaimer in
00011      the documentation and/or other materials provided with the
00012      distribution.
00013 
00014   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00015   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00018   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00019   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00020   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00021   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00022   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00023   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024   POSSIBILITY OF SUCH DAMAGE. */
00025 
00026 /* avr/iotn12.h - definitions for ATtiny12 */
00027 
00028 #ifndef _AVR_IOTN12_H_
00029 #define _AVR_IOTN12_H_ 1
00030 
00031 /* This file should only be included from <avr/io.h>, never directly. */
00032 
00033 #ifndef _AVR_IO_H_
00034 #  error "Include <avr/io.h> instead of this file."
00035 #endif
00036 
00037 #ifndef _AVR_IOXXX_H_
00038 #  define _AVR_IOXXX_H_ "iotn12.h"
00039 #else
00040 #  error "Attempt to include more than one <avr/ioXXX.h> file."
00041 #endif 
00042 
00043 #ifndef __ASSEMBLER__
00044 #  warning "MCU not supported by the C compiler"
00045 #endif
00046 
00047 #include <avr/sfr_defs.h>
00048 
00049 /* I/O registers */
00050 
00051 /* 0x00..0x07 reserved */
00052 
00053 /* Analog Comparator Control and Status Register */
00054 #define ACSR    _SFR_IO8(0x08)
00055 
00056 /* 0x09..0x15 reserved */
00057 
00058 /* Input Pins, Port B */
00059 #define PINB    _SFR_IO8(0x16)
00060 
00061 /* Data Direction Register, Port B */
00062 #define DDRB    _SFR_IO8(0x17)
00063 
00064 /* Data Register, Port B */
00065 #define PORTB   _SFR_IO8(0x18)
00066 
00067 /* 0x19..0x1B reserved */
00068 
00069 /* EEPROM Control Register */
00070 #define EECR    _SFR_IO8(0x1C)
00071 
00072 /* EEPROM Data Register */
00073 #define EEDR    _SFR_IO8(0x1D)
00074 
00075 /* EEPROM Address Register */
00076 #define EEAR    _SFR_IO8(0x1E)
00077 #define EEARL   _SFR_IO8(0x1E)
00078 
00079 /* 0x1F..0x20 reserved */
00080 
00081 /* Watchdog Timer Control Register */
00082 #define WDTCR   _SFR_IO8(0x21)
00083 
00084 /* 0x22..0x30 reserved */
00085 
00086 /* Oscillator Calibration Register */
00087 #define OSCCAL  _SFR_IO8(0x31)
00088 
00089 /* Timer/Counter0 (8-bit) */
00090 #define TCNT0   _SFR_IO8(0x32)
00091 
00092 /* Timer/Counter0 Control Register */
00093 #define TCCR0   _SFR_IO8(0x33)
00094 
00095 /* MCU general Status Register */
00096 #define MCUSR   _SFR_IO8(0x34)
00097 
00098 /* MCU general Control Register */
00099 #define MCUCR   _SFR_IO8(0x35)
00100 
00101 /* 0x36..0x37 reserved */
00102 
00103 /* Timer/Counter Interrupt Flag Register */
00104 #define TIFR    _SFR_IO8(0x38)
00105 
00106 /* Timer/Counter Interrupt MaSK Register */
00107 #define TIMSK   _SFR_IO8(0x39)
00108 
00109 /* General Interrupt Flag Register */
00110 #define GIFR    _SFR_IO8(0x3A)
00111 
00112 /* General Interrupt MaSK register */
00113 #define GIMSK   _SFR_IO8(0x3B)
00114 
00115 /* 0x3C..0x3E reserved */
00116 
00117 /* Status REGister */
00118 #define SREG    _SFR_IO8(0x3F)
00119 
00120 /* Interrupt vectors */
00121 
00122 #define SIG_INTERRUPT0          _VECTOR(1)
00123 #define SIG_PIN                 _VECTOR(2)
00124 #define SIG_OVERFLOW0           _VECTOR(3)
00125 #define SIG_EEPROM_READY        _VECTOR(4)
00126 #define SIG_COMPARATOR          _VECTOR(5)
00127 
00128 #define _VECTORS_SIZE 12
00129 
00130 /* Bit numbers */
00131 
00132 /* GIMSK */
00133 #define INT0    6
00134 #define PCIE    5
00135 
00136 /* GIFR */
00137 #define INTF0   6
00138 #define PCIF    5
00139 
00140 /* TIMSK */
00141 #define TOIE0   1
00142 
00143 /* TIFR */
00144 #define TOV0    1
00145 
00146 /* MCUCR */
00147 #define PUD     6
00148 #define SE      5
00149 #define SM      4
00150 #define ISC01   1
00151 #define ISC00   0
00152 
00153 /* TCCR0 */
00154 #define CS02    2
00155 #define CS01    1
00156 #define CS00    0
00157 
00158 /* WDTCR */
00159 #define WDTOE   4
00160 #define WDE     3
00161 #define WDP2    2
00162 #define WDP1    1
00163 #define WDP0    0
00164 
00165 /* EECR */
00166 #define EERIE   3
00167 #define EEMWE   2
00168 #define EEWE    1
00169 #define EERE    0
00170 
00171 /*
00172    PB5 = RESET#
00173    PB4 = XTAL2
00174    PB3 = XTAL1
00175    PB2 = T0 / SCK
00176    PB1 = INT0 / AIN1 / MISO
00177    PB0 = AIN0 / MOSI
00178  */
00179 
00180 /* PORTB */
00181 #define PB4     4
00182 #define PB3     3
00183 #define PB2     2
00184 #define PB1     1
00185 #define PB0     0
00186 
00187 /* DDRB */
00188 #define DDB5    5
00189 #define DDB4    4
00190 #define DDB3    3
00191 #define DDB2    2
00192 #define DDB1    1
00193 #define DDB0    0
00194 
00195 /* PINB */
00196 #define PINB5   5
00197 #define PINB4   4
00198 #define PINB3   3
00199 #define PINB2   2
00200 #define PINB1   1
00201 #define PINB0   0
00202 
00203 /* ACSR */
00204 #define ACD     7
00205 #define AINBG   6
00206 #define ACO     5
00207 #define ACI     4
00208 #define ACIE    3
00209 #define ACIS1   1
00210 #define ACIS0   0
00211 
00212 #define ZL r30
00213 #define ZH r31
00214 
00215 /* Last memory addresses */
00216 #define RAMEND          0x1F
00217 #define XRAMEND         0x0
00218 #define E2END           0x3F
00219 #define FLASHEND        0x3FF
00220 
00221 #endif /* _AVR_IOTN12_H_ */

Generated on Thu Jan 30 22:30:49 2003 for EduNet by doxygen1.2.18