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

iotn22.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/iotn22.h - definitions for ATtiny22 */
00027 
00028 #ifndef _AVR_IOTN22_H_
00029 #define _AVR_IOTN22_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_ "iotn22.h"
00039 #else
00040 #  error "Attempt to include more than one <avr/ioXXX.h> file."
00041 #endif 
00042 
00043 #include <avr/sfr_defs.h>
00044 
00045 /* I/O registers */
00046 
00047 /* Input Pins, Port B */
00048 #define PINB    _SFR_IO8(0x16)
00049 
00050 /* Data Direction Register, Port B */
00051 #define DDRB    _SFR_IO8(0x17)
00052 
00053 /* Data Register, Port B */
00054 #define PORTB   _SFR_IO8(0x18)
00055 
00056 /* EEPROM Control Register */
00057 #define EECR    _SFR_IO8(0x1C)
00058 
00059 /* EEPROM Data Register */
00060 #define EEDR    _SFR_IO8(0x1D)
00061 
00062 /* EEPROM Address Register Low */
00063 #define EEAR    _SFR_IO8(0x1E)
00064 #define EEARL   _SFR_IO8(0x1E)
00065 
00066 /* Watchdog Timer Control Register */
00067 #define WDTCR   _SFR_IO8(0x21)
00068 
00069 /* Timer/Counter 0 */
00070 #define TCNT0   _SFR_IO8(0x32)
00071 
00072 /* Timer/Counter 0 Control Register */
00073 #define TCCR0   _SFR_IO8(0x33)
00074 
00075 /* MCU Status Register */
00076 #define MCUSR   _SFR_IO8(0x34)
00077 
00078 /* MCU general Control Register */
00079 #define MCUCR   _SFR_IO8(0x35)
00080 
00081 /* Timer/Counter Interrupt Flag register */
00082 #define TIFR    _SFR_IO8(0x38)
00083 
00084 /* Timer/Counter Interrupt MaSK register */
00085 #define TIMSK   _SFR_IO8(0x39)
00086 
00087 /* General Interrupt Flag register */
00088 #define GIFR    _SFR_IO8(0x3A)
00089 
00090 /* General Interrupt MaSK register */
00091 #define GIMSK   _SFR_IO8(0x3B)
00092 
00093 /* Stack Pointer */
00094 #define SP      _SFR_IO8(0x3D)
00095 #define SPL     _SFR_IO8(0x3D)
00096 
00097 /* Status REGister */
00098 #define SREG    _SFR_IO8(0x3F)
00099 
00100 /* Interrupt vectors */
00101 
00102 #define SIG_INTERRUPT0          _VECTOR(1)
00103 #define SIG_OVERFLOW0           _VECTOR(2)
00104 
00105 #define _VECTORS_SIZE 6
00106 
00107 /*
00108    The Register Bit names are represented by their bit number (0-7).
00109  */
00110 
00111 /* General Interrupt MaSK register */
00112 #define    INT0    6
00113 #define    INTF0   6
00114 
00115 /* General Interrupt Flag Register */
00116 #define    TOIE0   1
00117 #define    TOV0    1
00118 
00119 /* MCU general Control Register */
00120 #define    SE      5
00121 #define    SM      4
00122 #define    ISC01   1
00123 #define    ISC00   0
00124 
00125 /* Timer/Counter 0 Control Register */
00126 #define    CS02    2
00127 #define    CS01    1
00128 #define    CS00    0
00129 
00130 /* Watchdog Timer Control Register */
00131 #define    WDTOE   4
00132 #define    WDE     3
00133 #define    WDP2    2
00134 #define    WDP1    1
00135 #define    WDP0    0
00136 
00137 /* EEPROM Control Register */
00138 #define    EEMWE   2
00139 #define    EEWE    1
00140 #define    EERE    0
00141 
00142 /*
00143    PB2 = SCK/T0
00144    PB1 = MISO/INT0
00145    PB0 = MOSI
00146  */
00147 
00148 /* Data Register, Port B */
00149 #define    PB4     4
00150 #define    PB3     3
00151 #define    PB2     2
00152 #define    PB1     1
00153 #define    PB0     0
00154 
00155 /* Data Direction Register, Port B */
00156 #define    DDB4    4
00157 #define    DDB3    3
00158 #define    DDB2    2
00159 #define    DDB1    1
00160 #define    DDB0    0
00161 
00162 /* Input Pins, Port B */
00163 #define    PINB4   4
00164 #define    PINB3   3
00165 #define    PINB2   2
00166 #define    PINB1   1
00167 #define    PINB0   0
00168 
00169 /* Pointer definition   */
00170 #define    XL     r26
00171 #define    XH     r27
00172 #define    YL     r28
00173 #define    YH     r29
00174 #define    ZL     r30
00175 #define    ZH     r31
00176 
00177 /* Constants */
00178 #define    RAMEND    0xDF
00179 #define    XRAMEND   0xDF
00180 #define    E2END     0x7F
00181 #define    FLASHEND  0x07FF
00182 
00183 #endif /* _AVR_IOTN22_H_ */

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