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

iotn11.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/iotn11.h - definitions for ATtiny10/11 */
00027 
00028 #ifndef _AVR_IOTN11_H_
00029 #define _AVR_IOTN11_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_ "iotn11.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..0x20 reserved */
00068 
00069 /* Watchdog Timer Control Register */
00070 #define WDTCR   _SFR_IO8(0x21)
00071 
00072 /* 0x22..0x31 reserved */
00073 
00074 /* Timer/Counter0 (8-bit) */
00075 #define TCNT0   _SFR_IO8(0x32)
00076 
00077 /* Timer/Counter0 Control Register */
00078 #define TCCR0   _SFR_IO8(0x33)
00079 
00080 /* MCU general Status Register */
00081 #define MCUSR   _SFR_IO8(0x34)
00082 
00083 /* MCU general Control Register */
00084 #define MCUCR   _SFR_IO8(0x35)
00085 
00086 /* 0x36..0x37 reserved */
00087 
00088 /* Timer/Counter Interrupt Flag Register */
00089 #define TIFR    _SFR_IO8(0x38)
00090 
00091 /* Timer/Counter Interrupt MaSK Register */
00092 #define TIMSK   _SFR_IO8(0x39)
00093 
00094 /* General Interrupt Flag Register */
00095 #define GIFR    _SFR_IO8(0x3A)
00096 
00097 /* General Interrupt MaSK register */
00098 #define GIMSK   _SFR_IO8(0x3B)
00099 
00100 /* 0x3C..0x3E reserved */
00101 
00102 /* Status REGister */
00103 #define SREG    _SFR_IO8(0x3F)
00104 
00105 
00106 /* Interrupt vectors */
00107 
00108 #define SIG_INTERRUPT0          _VECTOR(1)
00109 #define SIG_PIN                 _VECTOR(2)
00110 #define SIG_OVERFLOW0           _VECTOR(3)
00111 #define SIG_COMPARATOR          _VECTOR(4)
00112 
00113 #define _VECTORS_SIZE 10
00114 
00115 /* Bit numbers */
00116 
00117 /* GIMSK */
00118 #define INT0    6
00119 #define PCIE    5
00120 
00121 /* GIFR */
00122 #define INTF0   6
00123 #define PCIF    5
00124 
00125 /* TIMSK */
00126 #define TOIE0   1
00127 
00128 /* TIFR */
00129 #define TOV0    1
00130 
00131 /* MCUCR */
00132 #define SE      5
00133 #define SM      4
00134 #define ISC01   1
00135 #define ISC00   0
00136 
00137 /* TCCR0 */
00138 #define CS02    2
00139 #define CS01    1
00140 #define CS00    0
00141 
00142 /* WDTCR */
00143 #define WDTOE   4
00144 #define WDE     3
00145 #define WDP2    2
00146 #define WDP1    1
00147 #define WDP0    0
00148 
00149 /*
00150    PB5 = RESET#
00151    PB4 = XTAL2
00152    PB3 = XTAL1
00153    PB2 = T0
00154    PB1 = INT0 / AIN1
00155    PB0 = AIN0
00156  */
00157 
00158 /* PORTB */
00159 #define PB4     4
00160 #define PB3     3
00161 #define PB2     2
00162 #define PB1     1
00163 #define PB0     0
00164 
00165 /* DDRB */
00166 #define DDB4    4
00167 #define DDB3    3
00168 #define DDB2    2
00169 #define DDB1    1
00170 #define DDB0    0
00171 
00172 /* PINB */
00173 #define PINB5   5
00174 #define PINB4   4
00175 #define PINB3   3
00176 #define PINB2   2
00177 #define PINB1   1
00178 #define PINB0   0
00179 
00180 /* ACSR */
00181 #define ACD     7
00182 #define ACO     5
00183 #define ACI     4
00184 #define ACIE    3
00185 #define ACIS1   1
00186 #define ACIS0   0
00187 
00188 #define ZL r30
00189 #define ZH r31
00190 
00191 /* Last memory addresses */
00192 #define RAMEND          0x1F
00193 #define XRAMEND         0x0
00194 #define E2END           0x0
00195 #define FLASHEND        0x3FF
00196 
00197 #endif /* _AVR_IOTN11_H_ */

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