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

iom8.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/iom8.h - definitions for ATmega8 */
00027 
00028 #ifndef _AVR_IOM8_H_
00029 #define _AVR_IOM8_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_ "iom8.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 /* TWI stands for "Two Wire Interface" or "TWI Was I2C(tm)" */
00048 #define TWBR    _SFR_IO8(0x00)
00049 #define TWSR    _SFR_IO8(0x01)
00050 #define TWAR    _SFR_IO8(0x02)
00051 #define TWDR    _SFR_IO8(0x03)
00052 
00053 /* ADC */
00054 #define ADCW    _SFR_IO16(0x04)
00055 #define ADCL    _SFR_IO8(0x04)
00056 #define ADCH    _SFR_IO8(0x05)
00057 #define ADCSR   _SFR_IO8(0x06)
00058 #define ADMUX   _SFR_IO8(0x07)
00059 
00060 /* analog comparator */
00061 #define ACSR    _SFR_IO8(0x08)
00062 
00063 /* USART */
00064 #define UBRRL   _SFR_IO8(0x09)
00065 #define UCSRB   _SFR_IO8(0x0A)
00066 #define UCSRA   _SFR_IO8(0x0B)
00067 #define UDR     _SFR_IO8(0x0C)
00068 
00069 /* SPI */
00070 #define SPCR    _SFR_IO8(0x0D)
00071 #define SPSR    _SFR_IO8(0x0E)
00072 #define SPDR    _SFR_IO8(0x0F)
00073 
00074 /* Port D */
00075 #define PIND    _SFR_IO8(0x10)
00076 #define DDRD    _SFR_IO8(0x11)
00077 #define PORTD   _SFR_IO8(0x12)
00078 
00079 /* Port C */
00080 #define PINC    _SFR_IO8(0x13)
00081 #define DDRC    _SFR_IO8(0x14)
00082 #define PORTC   _SFR_IO8(0x15)
00083 
00084 /* Port B */
00085 #define PINB    _SFR_IO8(0x16)
00086 #define DDRB    _SFR_IO8(0x17)
00087 #define PORTB   _SFR_IO8(0x18)
00088 
00089 /* EEPROM */
00090 #define EECR    _SFR_IO8(0x1C)
00091 #define EEDR    _SFR_IO8(0x1D)
00092 #define EEAR    _SFR_IO16(0x1E)
00093 #define EEARL   _SFR_IO8(0x1E)
00094 #define EEARH   _SFR_IO8(0x1F)
00095 
00096 #define UCSRC   _SFR_IO8(0x20)
00097 #define UBRRH   _SFR_IO8(0x20)
00098 
00099 #define WDTCR   _SFR_IO8(0x21)
00100 #define ASSR    _SFR_IO8(0x22)
00101 
00102 /* Timer 2 */
00103 #define OCR2    _SFR_IO8(0x23)
00104 #define TCNT2   _SFR_IO8(0x24)
00105 #define TCCR2   _SFR_IO8(0x25)
00106 
00107 /* Timer 1 */
00108 #define ICR1    _SFR_IO16(0x26)
00109 #define ICR1L   _SFR_IO8(0x26)
00110 #define ICR1H   _SFR_IO8(0x27)
00111 #define OCR1B   _SFR_IO16(0x28)
00112 #define OCR1BL  _SFR_IO8(0x28)
00113 #define OCR1BH  _SFR_IO8(0x29)
00114 #define OCR1A   _SFR_IO16(0x2A)
00115 #define OCR1AL  _SFR_IO8(0x2A)
00116 #define OCR1AH  _SFR_IO8(0x2B)
00117 #define TCNT1   _SFR_IO16(0x2C)
00118 #define TCNT1L  _SFR_IO8(0x2C)
00119 #define TCNT1H  _SFR_IO8(0x2D)
00120 #define TCCR1B  _SFR_IO8(0x2E)
00121 #define TCCR1A  _SFR_IO8(0x2F)
00122 
00123 #define SFIOR   _SFR_IO8(0x30)
00124 
00125 #define OSCCAL  _SFR_IO8(0x31)
00126 
00127 /* Timer 0 */
00128 #define TCNT0   _SFR_IO8(0x32)
00129 #define TCCR0   _SFR_IO8(0x33)
00130 
00131 #define MCUCSR  _SFR_IO8(0x34)
00132 #define MCUCR   _SFR_IO8(0x35)
00133 
00134 #define TWCR    _SFR_IO8(0x36)
00135 
00136 #define SPMCR   _SFR_IO8(0x37)
00137 
00138 #define TIFR    _SFR_IO8(0x38)
00139 #define TIMSK   _SFR_IO8(0x39)
00140 
00141 #define GIFR    _SFR_IO8(0x3A)
00142 #define GIMSK   _SFR_IO8(0x3B)
00143 
00144 /* 0x3C reserved (OCR0?) */
00145 
00146 #define SP      _SFR_IO16(0x3D)
00147 #define SPL     _SFR_IO8(0x3D)
00148 #define SPH     _SFR_IO8(0x3E)
00149 #define SREG    _SFR_IO8(0x3F)
00150 
00151 /* Interrupt vectors */
00152 
00153 #define SIG_INTERRUPT0          _VECTOR(1)
00154 #define SIG_INTERRUPT1          _VECTOR(2)
00155 #define SIG_OUTPUT_COMPARE2     _VECTOR(3)
00156 #define SIG_OVERFLOW2           _VECTOR(4)
00157 #define SIG_INPUT_CAPTURE1      _VECTOR(5)
00158 #define SIG_OUTPUT_COMPARE1A    _VECTOR(6)
00159 #define SIG_OUTPUT_COMPARE1B    _VECTOR(7)
00160 #define SIG_OVERFLOW1           _VECTOR(8)
00161 #define SIG_OVERFLOW0           _VECTOR(9)
00162 #define SIG_SPI                 _VECTOR(10)
00163 #define SIG_UART_RECV           _VECTOR(11)
00164 #define SIG_UART_DATA           _VECTOR(12)
00165 #define SIG_UART_TRANS          _VECTOR(13)
00166 #define SIG_ADC                 _VECTOR(14)
00167 #define SIG_EEPROM_READY        _VECTOR(15)
00168 #define SIG_COMPARATOR          _VECTOR(16)
00169 #define SIG_2WIRE_SERIAL        _VECTOR(17)
00170 #define SIG_SPM_READY           _VECTOR(18)
00171 
00172 #define _VECTORS_SIZE 38
00173 
00174 /* Bit numbers */
00175 
00176 /* GIMSK */
00177 #define INT1    7
00178 #define INT0    6
00179 #define IVSEL   1
00180 #define IVCE    0
00181 
00182 /* GIFR */
00183 #define INTF1   7
00184 #define INTF0   6
00185 
00186 /* TIMSK */
00187 #define OCIE2   7
00188 #define TOIE2   6
00189 #define TICIE1  5
00190 #define OCIE1A  4
00191 #define OCIE1B  3
00192 #define TOIE1   2
00193 /* bit 1 reserved (OCIE0?) */
00194 #define TOIE0   0
00195 
00196 /* TIFR */
00197 #define OCF2    7
00198 #define TOV2    6
00199 #define ICF1    5
00200 #define OCF1A   4
00201 #define OCF1B   3
00202 #define TOV1    2
00203 /* bit 1 reserved (OCF0?) */
00204 #define TOV0    0
00205 
00206 /* SPMCR */
00207 #define SPMIE   7
00208 #define RWWSB   6
00209 /* bit 5 reserved */
00210 #define RWWSRE  4
00211 #define BLBSET  3
00212 #define PGWRT   2
00213 #define PGERS   1
00214 #define SPMEN   0
00215 
00216 /* TWCR */
00217 #define TWINT   7
00218 #define TWEA    6
00219 #define TWSTA   5
00220 #define TWSTO   4
00221 #define TWWC    3
00222 #define TWEN    2
00223 /* bit 1 reserved (TWI_TST?) */
00224 #define TWIE    0
00225 
00226 /* TWAR */
00227 #define TWGCE   0
00228 
00229 /* TWSR */
00230 #define TWS7    7
00231 #define TWS6    6
00232 #define TWS5    5
00233 #define TWS4    4
00234 #define TWS3    3
00235 /* bit 2 reserved */
00236 #define TWPS1   1
00237 #define TWPS0   0
00238 
00239 /* MCUCR */
00240 #define SE      7
00241 #define SM2     6
00242 #define SM1     5
00243 #define SM0     4
00244 #define ISC11   3
00245 #define ISC10   2
00246 #define ISC01   1
00247 #define ISC00   0
00248 
00249 /* MCUCSR */
00250 /* bits 7-4 reserved */
00251 #define WDRF    3
00252 #define BORF    2
00253 #define EXTRF   1
00254 #define PORF    0
00255 
00256 /* SFIOR */
00257 /* bits 7-5 reserved */
00258 #define ADHSM   4
00259 #define ACME    3
00260 #define PUD     2
00261 #define PSR2    1
00262 #define PSR10   0
00263 
00264 /* TCCR0 */
00265 /* bits 7-3 reserved */
00266 #define CS02    2
00267 #define CS01    1
00268 #define CS00    0
00269 
00270 /* TCCR2 */
00271 #define FOC2    7
00272 #define WGM20   6
00273 #define COM21   5
00274 #define COM20   4
00275 #define WGM21   3
00276 #define CS22    2
00277 #define CS21    1
00278 #define CS20    0
00279 
00280 /* ASSR */
00281 /* bits 7-4 reserved */
00282 #define AS2     3
00283 #define TCN2UB  2
00284 #define OCR2UB  1
00285 #define TCR2UB  0
00286 
00287 /* TCCR1A */
00288 #define COM1A1  7
00289 #define COM1A0  6
00290 #define COM1B1  5
00291 #define COM1B0  4
00292 #define FOC1A   3
00293 #define FOC1B   2
00294 #define WGM11   1
00295 #define WGM10   0
00296 
00297 /* TCCR1B */
00298 #define ICNC1   7
00299 #define ICES1   6
00300 /* bit 5 reserved */
00301 #define WGM13   4
00302 #define WGM12   3
00303 #define CS12    2
00304 #define CS11    1
00305 #define CS10    0
00306 
00307 /* WDTCR */
00308 /* bits 7-5 reserved */
00309 #define WDCE    4
00310 #define WDE     3
00311 #define WDP2    2
00312 #define WDP1    1
00313 #define WDP0    0
00314 
00315 /* UBRRH */
00316 #define URSEL   7
00317 
00318 /* UCSRC */
00319 #define URSEL   7
00320 #define UMSEL   6
00321 #define UPM1    5
00322 #define UPM0    4
00323 #define USBS    3
00324 #define UCSZ1   2
00325 #define UCSZ0   1
00326 #define UCPOL   0
00327 
00328 /* EECR */
00329 /* bits 7-4 reserved */
00330 #define EERIE   3
00331 #define EEMWE   2
00332 #define EEWE    1
00333 #define EERE    0
00334 
00335 /* PORTB */
00336 #define PB7     7
00337 #define PB6     6
00338 #define PB5     5
00339 #define PB4     4
00340 #define PB3     3
00341 #define PB2     2
00342 #define PB1     1
00343 #define PB0     0
00344 
00345 /* DDRB */
00346 #define DDB7    7
00347 #define DDB6    6
00348 #define DDB5    5
00349 #define DDB4    4
00350 #define DDB3    3
00351 #define DDB2    2
00352 #define DDB1    1
00353 #define DDB0    0
00354 
00355 /* PINB */
00356 #define PINB7   7
00357 #define PINB6   6
00358 #define PINB5   5
00359 #define PINB4   4
00360 #define PINB3   3
00361 #define PINB2   2
00362 #define PINB1   1
00363 #define PINB0   0
00364 
00365 /* PORTC */
00366 #define PC7      7
00367 #define PC6      6
00368 #define PC5      5
00369 #define PC4      4
00370 #define PC3      3
00371 #define PC2      2
00372 #define PC1      1
00373 #define PC0      0
00374 
00375 /* DDRC */
00376 #define DDC7    7
00377 #define DDC6    6
00378 #define DDC5    5
00379 #define DDC4    4
00380 #define DDC3    3
00381 #define DDC2    2
00382 #define DDC1    1
00383 #define DDC0    0
00384 
00385 /* PINC */
00386 #define PINC7   7
00387 #define PINC6   6
00388 #define PINC5   5
00389 #define PINC4   4
00390 #define PINC3   3
00391 #define PINC2   2
00392 #define PINC1   1
00393 #define PINC0   0
00394 
00395 /* PORTD */
00396 #define PD7      7
00397 #define PD6      6
00398 #define PD5      5
00399 #define PD4      4
00400 #define PD3      3
00401 #define PD2      2
00402 #define PD1      1
00403 #define PD0      0
00404 
00405 /* DDRD */
00406 #define DDD7    7
00407 #define DDD6    6
00408 #define DDD5    5
00409 #define DDD4    4
00410 #define DDD3    3
00411 #define DDD2    2
00412 #define DDD1    1
00413 #define DDD0    0
00414 
00415 /* PIND */
00416 #define PIND7   7
00417 #define PIND6   6
00418 #define PIND5   5
00419 #define PIND4   4
00420 #define PIND3   3
00421 #define PIND2   2
00422 #define PIND1   1
00423 #define PIND0   0
00424 
00425 /* SPSR */
00426 #define SPIF    7
00427 #define WCOL    6
00428 #define SPI2X   0
00429 
00430 /* SPCR */
00431 #define SPIE    7
00432 #define SPE     6
00433 #define DORD    5
00434 #define MSTR    4
00435 #define CPOL    3
00436 #define CPHA    2
00437 #define SPR1    1
00438 #define SPR0    0
00439 
00440 /* UCSRA */
00441 #define RXC     7
00442 #define TXC     6
00443 #define UDRE    5
00444 #define FE      4
00445 #define DOR     3
00446 #define PE      2
00447 #define U2X     1
00448 #define MPCM    0
00449 
00450 /* UCSRB */
00451 #define RXCIE   7
00452 #define TXCIE   6
00453 #define UDRIE   5
00454 #define RXEN    4
00455 #define TXEN    3
00456 #define UCSZ2   2
00457 #define RXB8    1
00458 #define TXB8    0
00459 
00460 /* ACSR */
00461 #define ACD     7
00462 #define ACBG    6
00463 #define ACO     5
00464 #define ACI     4
00465 #define ACIE    3
00466 #define ACIC    2
00467 #define ACIS1   1
00468 #define ACIS0   0
00469 
00470 /* ADCSR */
00471 #define ADEN    7
00472 #define ADSC    6
00473 #define ADFR    5
00474 #define ADIF    4
00475 #define ADIE    3
00476 #define ADPS2   2
00477 #define ADPS1   1
00478 #define ADPS0   0
00479 
00480 /* ADMUX */
00481 #define REFS1   7
00482 #define REFS0   6
00483 #define ADLAR   5
00484 /* bit 4 reserved */
00485 #define MUX3    3
00486 #define MUX2    2
00487 #define MUX1    1
00488 #define MUX0    0
00489 
00490 /* Pointer registers (same for all AVR devices so far) */
00491 #define XL r26
00492 #define XH r27
00493 #define YL r28
00494 #define YH r29
00495 #define ZL r30
00496 #define ZH r31
00497 
00498 /* Last memory addresses */
00499 #define RAMEND          0x45F
00500 #define XRAMEND         0x45F
00501 #define E2END           0x1FF
00502 #define FLASHEND        0x1FFF
00503 
00504 #endif /* _AVR_IOM8_H_ */

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