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

iom103.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/iom103.h - definitions for ATmega103 */
00027 
00028 #ifndef _AVR_IOM103_H_
00029 #define _AVR_IOM103_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_ "iom103.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 F */
00048 #define PINF    _SFR_IO8(0x00)
00049 
00050 /* Input Pins, Port E */
00051 #define PINE    _SFR_IO8(0x01)
00052 
00053 /* Data Direction Register, Port E */
00054 #define DDRE    _SFR_IO8(0x02)
00055 
00056 /* Data Register, Port E */
00057 #define PORTE   _SFR_IO8(0x03)
00058 
00059 /* ADC Data Register */
00060 #define ADCW    _SFR_IO16(0x04)
00061 #define ADCL    _SFR_IO8(0x04)
00062 #define ADCH    _SFR_IO8(0x05)
00063 
00064 /* ADC Control and status register */
00065 #define ADCSR   _SFR_IO8(0x06)
00066 
00067 /* ADC Multiplexer select */
00068 #define ADMUX   _SFR_IO8(0x07)
00069 
00070 /* Analog Comparator Control and Status Register */
00071 #define ACSR    _SFR_IO8(0x08)
00072 
00073 /* UART Baud Rate Register */
00074 #define UBRR    _SFR_IO8(0x09)
00075 
00076 /* UART Control Register */
00077 #define UCR     _SFR_IO8(0x0A)
00078 
00079 /* UART Status Register */
00080 #define USR     _SFR_IO8(0x0B)
00081 
00082 /* UART I/O Data Register */
00083 #define UDR     _SFR_IO8(0x0C)
00084 
00085 /* SPI Control Register */
00086 #define SPCR    _SFR_IO8(0x0D)
00087 
00088 /* SPI Status Register */
00089 #define SPSR    _SFR_IO8(0x0E)
00090 
00091 /* SPI I/O Data Register */
00092 #define SPDR    _SFR_IO8(0x0F)
00093 
00094 /* Input Pins, Port D */
00095 #define PIND    _SFR_IO8(0x10)
00096 
00097 /* Data Direction Register, Port D */
00098 #define DDRD    _SFR_IO8(0x11)
00099 
00100 /* Data Register, Port D */
00101 #define PORTD   _SFR_IO8(0x12)
00102 
00103 /* Data Register, Port C */
00104 #define PORTC   _SFR_IO8(0x15)
00105 
00106 /* Input Pins, Port B */
00107 #define PINB    _SFR_IO8(0x16)
00108 
00109 /* Data Direction Register, Port B */
00110 #define DDRB    _SFR_IO8(0x17)
00111 
00112 /* Data Register, Port B */
00113 #define PORTB   _SFR_IO8(0x18)
00114 
00115 /* Input Pins, Port A */
00116 #define PINA    _SFR_IO8(0x19)
00117 
00118 /* Data Direction Register, Port A */
00119 #define DDRA    _SFR_IO8(0x1A)
00120 
00121 /* Data Register, Port A */
00122 #define PORTA   _SFR_IO8(0x1B)
00123 
00124 /* EEPROM Control Register */
00125 #define EECR    _SFR_IO8(0x1C)
00126 
00127 /* EEPROM Data Register */
00128 #define EEDR    _SFR_IO8(0x1D)
00129 
00130 /* EEPROM Address Register */
00131 #define EEAR    _SFR_IO16(0x1E)
00132 #define EEARL   _SFR_IO8(0x1E)
00133 #define EEARH   _SFR_IO8(0x1F)
00134 
00135 /* Watchdog Timer Control Register */
00136 #define WDTCR   _SFR_IO8(0x21)
00137 
00138 /* Timer2 Output Compare Register */
00139 #define OCR2    _SFR_IO8(0x23)
00140 
00141 /* Timer/Counter 2 */
00142 #define TCNT2   _SFR_IO8(0x24)
00143 
00144 /* Timer/Counter 2 Control register */
00145 #define TCCR2   _SFR_IO8(0x25)
00146 
00147 /* T/C 1 Input Capture Register */
00148 #define ICR1    _SFR_IO16(0x26)
00149 #define ICR1L   _SFR_IO8(0x26)
00150 #define ICR1H   _SFR_IO8(0x27)
00151 
00152 /* Timer/Counter1 Output Compare Register B */
00153 #define OCR1B   _SFR_IO16(0x28)
00154 #define OCR1BL  _SFR_IO8(0x28)
00155 #define OCR1BH  _SFR_IO8(0x29)
00156 
00157 /* Timer/Counter1 Output Compare Register A */
00158 #define OCR1A   _SFR_IO16(0x2A)
00159 #define OCR1AL  _SFR_IO8(0x2A)
00160 #define OCR1AH  _SFR_IO8(0x2B)
00161 
00162 /* Timer/Counter 1 */
00163 #define TCNT1   _SFR_IO16(0x2C)
00164 #define TCNT1L  _SFR_IO8(0x2C)
00165 #define TCNT1H  _SFR_IO8(0x2D)
00166 
00167 /* Timer/Counter 1 Control and Status Register */
00168 #define TCCR1B  _SFR_IO8(0x2E)
00169 
00170 /* Timer/Counter 1 Control Register */
00171 #define TCCR1A  _SFR_IO8(0x2F)
00172 
00173 /* Timer/Counter 0 Asynchronous Control & Status Register */
00174 #define ASSR    _SFR_IO8(0x30)
00175 
00176 /* Output Compare Register 0 */
00177 #define OCR0    _SFR_IO8(0x31)
00178 
00179 /* Timer/Counter 0 */
00180 #define TCNT0   _SFR_IO8(0x32)
00181 
00182 /* Timer/Counter 0 Control Register */
00183 #define TCCR0   _SFR_IO8(0x33)
00184 
00185 /* MCU Status Register */
00186 #define MCUSR   _SFR_IO8(0x34)
00187 
00188 /* MCU general Control Register */
00189 #define MCUCR   _SFR_IO8(0x35)
00190 
00191 /* Timer/Counter Interrupt Flag Register */
00192 #define TIFR    _SFR_IO8(0x36)
00193 
00194 /* Timer/Counter Interrupt MaSK register */
00195 #define TIMSK   _SFR_IO8(0x37)
00196 
00197 /* Èxternal Interrupt Flag Register */
00198 #define EIFR    _SFR_IO8(0x38)
00199 
00200 /* External Interrupt MaSK register */
00201 #define EIMSK   _SFR_IO8(0x39)
00202 
00203 /* External Interrupt Control Register */
00204 #define EICR    _SFR_IO8(0x3A)
00205 
00206 /* RAM Page Z select register */
00207 #define RAMPZ   _SFR_IO8(0x3B)
00208 
00209 /* XDIV Divide control register */
00210 #define XDIV    _SFR_IO8(0x3C)
00211 
00212 /* Stack Pointer */
00213 #define SP      _SFR_IO16(0x3D)
00214 #define SPL     _SFR_IO8(0x3D)
00215 #define SPH     _SFR_IO8(0x3E)
00216 
00217 /* Status REGister */
00218 #define SREG    _SFR_IO8(0x3F)
00219 
00220 
00221 /* Interrupt vectors */
00222 
00223 #define SIG_INTERRUPT0          _VECTOR(1)
00224 #define SIG_INTERRUPT1          _VECTOR(2)
00225 #define SIG_INTERRUPT2          _VECTOR(3)
00226 #define SIG_INTERRUPT3          _VECTOR(4)
00227 #define SIG_INTERRUPT4          _VECTOR(5)
00228 #define SIG_INTERRUPT5          _VECTOR(6)
00229 #define SIG_INTERRUPT6          _VECTOR(7)
00230 #define SIG_INTERRUPT7          _VECTOR(8)
00231 #define SIG_OUTPUT_COMPARE2     _VECTOR(9)
00232 #define SIG_OVERFLOW2           _VECTOR(10)
00233 #define SIG_INPUT_CAPTURE1      _VECTOR(11)
00234 #define SIG_OUTPUT_COMPARE1A    _VECTOR(12)
00235 #define SIG_OUTPUT_COMPARE1B    _VECTOR(13)
00236 #define SIG_OVERFLOW1           _VECTOR(14)
00237 #define SIG_OUTPUT_COMPARE0     _VECTOR(15)
00238 #define SIG_OVERFLOW0           _VECTOR(16)
00239 #define SIG_SPI                 _VECTOR(17)
00240 #define SIG_UART_RECV           _VECTOR(18)
00241 #define SIG_UART_DATA           _VECTOR(19)
00242 #define SIG_UART_TRANS          _VECTOR(20)
00243 #define SIG_ADC                 _VECTOR(21)
00244 #define SIG_EEPROM_READY        _VECTOR(22)
00245 #define SIG_COMPARATOR          _VECTOR(23)
00246 
00247 #define _VECTORS_SIZE 96
00248 
00249 /*
00250    The Register Bit names are represented by their bit number (0-7).
00251 */
00252 
00253 /* XDIV Divide control register*/
00254 #define    XDIVEN       7
00255 #define    XDIV6        6
00256 #define    XDIV5        5
00257 #define    XDIV4        4
00258 #define    XDIV3        3
00259 #define    XDIV2        2
00260 #define    XDIV1        1
00261 #define    XDIV0        0
00262 
00263 /* RAM Page Z select register */
00264 #define     RAMPZ0      0
00265 
00266 /* External Interrupt Control Register */
00267 #define    ISC71        7
00268 #define    ISC70        6
00269 #define    ISC61        5
00270 #define    ISC60        4
00271 #define    ISC51        3
00272 #define    ISC50        2
00273 #define    ISC41        1
00274 #define    ISC40        0
00275 
00276 /* External Interrupt MaSK register */
00277 #define    INT7         7
00278 #define    INT6         6
00279 #define    INT5         5
00280 #define    INT4         4
00281 #define    INT3         3
00282 #define    INT2         2
00283 #define    INT1         1
00284 #define    INT0         0
00285 
00286 /* Èxternal Interrupt Flag Register */
00287 #define    INTF7        7
00288 #define    INTF6        6
00289 #define    INTF5        5
00290 #define    INTF4        4
00291 
00292 /* Timer/Counter Interrupt MaSK register */
00293 #define    OCIE2        7
00294 #define    TOIE2        6
00295 #define    TICIE1       5
00296 #define    OCIE1A       4
00297 #define    OCIE1B       3
00298 #define    TOIE1        2
00299 #define    OCIE0        1
00300 #define    TOIE0        0
00301 
00302 /* Timer/Counter Interrupt Flag Register */
00303 #define    OCF2         7
00304 #define    TOV2         6
00305 #define    ICF1         5
00306 #define    OCF1A        4
00307 #define    OCF1B        3
00308 #define    TOV1         2
00309 #define    OCF0         1
00310 #define    TOV0         0
00311 
00312 /* MCU general Control Register */
00313 #define    SRE          7
00314 #define    SRW          6
00315 #define    SE           5
00316 #define    SM1          4
00317 #define    SM0          3
00318 
00319 /* MCU Status Register */
00320 #define    EXTRF        1
00321 #define    PORF         0
00322 
00323 /* Timer/Counter 0 Control Register */
00324 #define    PWM0         6
00325 #define    COM01        5
00326 #define    COM00        4
00327 #define    CTC0         3
00328 #define    CS02         2
00329 #define    CS01         1
00330 #define    CS00         0
00331 
00332 /* Timer/Counter 0 Asynchronous Control & Status Register */
00333 #define    AS0          3
00334 #define    TCN0UB       2
00335 #define    OCR0UB       1
00336 #define    TCR0UB       0
00337 
00338 /* Timer/Counter 1 Control Register */
00339 #define    COM1A1       7
00340 #define    COM1A0       6
00341 #define    COM1B1       5
00342 #define    COM1B0       4
00343 #define    PWM11        1
00344 #define    PWM10        0
00345 
00346 /* Timer/Counter 1 Control and Status Register */
00347 #define    ICNC1        7
00348 #define    ICES1        6
00349 #define    CTC1         3
00350 #define    CS12         2
00351 #define    CS11         1
00352 #define    CS10         0
00353 
00354 /* Timer/Counter 2 Control register */
00355 #define    PWM2         6
00356 #define    COM21        5
00357 #define    COM20        4
00358 #define    CTC2         3
00359 #define    CS22         2
00360 #define    CS21         1
00361 #define    CS20         0
00362 
00363 /* Watchdog Timer Control Register */
00364 #define    WDTOE        4
00365 #define    WDE          3
00366 #define    WDP2         2
00367 #define    WDP1         1
00368 #define    WDP0         0
00369 
00370 /* EEPROM Control Register */
00371 #define    EERIE        3
00372 #define    EEMWE        2
00373 #define    EEWE         1
00374 #define    EERE         0
00375 
00376 /* Data Register, Port A */
00377 #define    PA7          7
00378 #define    PA6          6
00379 #define    PA5          5
00380 #define    PA4          4
00381 #define    PA3          3
00382 #define    PA2          2
00383 #define    PA1          1
00384 #define    PA0          0
00385 
00386 /* Data Direction Register, Port A */
00387 #define    DDA7         7
00388 #define    DDA6         6
00389 #define    DDA5         5
00390 #define    DDA4         4
00391 #define    DDA3         3
00392 #define    DDA2         2
00393 #define    DDA1         1
00394 #define    DDA0         0
00395 
00396 /* Input Pins, Port A */
00397 #define    PINA7        7
00398 #define    PINA6        6
00399 #define    PINA5        5
00400 #define    PINA4        4
00401 #define    PINA3        3
00402 #define    PINA2        2
00403 #define    PINA1        1
00404 #define    PINA0        0
00405 
00406 /* Data Register, Port B */
00407 #define    PB7          7
00408 #define    PB6          6
00409 #define    PB5          5
00410 #define    PB4          4
00411 #define    PB3          3
00412 #define    PB2          2
00413 #define    PB1          1
00414 #define    PB0          0
00415 
00416 /* Data Direction Register, Port B */
00417 #define    DDB7         7
00418 #define    DDB6         6
00419 #define    DDB5         5
00420 #define    DDB4         4
00421 #define    DDB3         3
00422 #define    DDB2         2
00423 #define    DDB1         1
00424 #define    DDB0         0
00425 
00426 /* Input Pins, Port B */
00427 #define    PINB7        7
00428 #define    PINB6        6
00429 #define    PINB5        5
00430 #define    PINB4        4
00431 #define    PINB3        3
00432 #define    PINB2        2
00433 #define    PINB1        1
00434 #define    PINB0        0
00435 
00436 /* Data Register, Port C */
00437 #define    PC7          7
00438 #define    PC6          6
00439 #define    PC5          5
00440 #define    PC4          4
00441 #define    PC3          3
00442 #define    PC2          2
00443 #define    PC1          1
00444 #define    PC0          0
00445 
00446 /* Data Register, Port D */
00447 #define    PD7          7
00448 #define    PD6          6
00449 #define    PD5          5
00450 #define    PD4          4
00451 #define    PD3          3
00452 #define    PD2          2
00453 #define    PD1          1
00454 #define    PD0          0
00455 
00456 /* Data Direction Register, Port D */
00457 #define    DDD7         7
00458 #define    DDD6         6
00459 #define    DDD5         5
00460 #define    DDD4         4
00461 #define    DDD3         3
00462 #define    DDD2         2
00463 #define    DDD1         1
00464 #define    DDD0         0
00465 
00466 /* Input Pins, Port D */
00467 #define    PIND7        7
00468 #define    PIND6        6
00469 #define    PIND5        5
00470 #define    PIND4        4
00471 #define    PIND3        3
00472 #define    PIND2        2
00473 #define    PIND1        1
00474 #define    PIND0        0
00475 
00476 /* Data Register, Port E */
00477 #define    PE7          7
00478 #define    PE6          6
00479 #define    PE5          5
00480 #define    PE4          4
00481 #define    PE3          3
00482 #define    PE2          2
00483 #define    PE1          1
00484 #define    PE0          0
00485 
00486 /* Data Direction Register, Port E */
00487 #define    DDE7         7
00488 #define    DDE6         6
00489 #define    DDE5         5
00490 #define    DDE4         4
00491 #define    DDE3         3
00492 #define    DDE2         2
00493 #define    DDE1         1
00494 #define    DDE0         0
00495 
00496 /* Input Pins, Port E */
00497 #define    PINE7        7
00498 #define    PINE6        6
00499 #define    PINE5        5
00500 #define    PINE4        4
00501 #define    PINE3        3
00502 #define    PINE2        2
00503 #define    PINE1        1
00504 #define    PINE0        0
00505 
00506 /* Input Pins, Port F */
00507 #define    PINF7        7
00508 #define    PINF6        6
00509 #define    PINF5        5
00510 #define    PINF4        4
00511 #define    PINF3        3
00512 #define    PINF2        2
00513 #define    PINF1        1
00514 #define    PINF0        0
00515 
00516 /* SPI Status Register */
00517 #define    SPIF         7
00518 #define    WCOL         6
00519 
00520 /* SPI Control Register */
00521 #define    SPIE         7
00522 #define    SPE          6
00523 #define    DORD         5
00524 #define    MSTR         4
00525 #define    CPOL         3
00526 #define    CPHA         2
00527 #define    SPR1         1
00528 #define    SPR0         0
00529 
00530 /* UART Status Register */
00531 #define    RXC          7
00532 #define    TXC          6
00533 #define    UDRE         5
00534 #define    FE           4
00535 #define    DOR          3
00536 
00537 /* UART Control Register */
00538 #define    RXCIE        7
00539 #define    TXCIE        6
00540 #define    UDRIE        5
00541 #define    RXEN         4
00542 #define    TXEN         3
00543 #define    CHR9         2
00544 #define    RXB8         1
00545 #define    TXB8         0
00546 
00547 /* Analog Comparator Control and Status Register */
00548 #define    ACD          7
00549 #define    ACO          5
00550 #define    ACI          4
00551 #define    ACIE         3
00552 #define    ACIC         2
00553 #define    ACIS1        1
00554 #define    ACIS0        0
00555 
00556 /* ADC Control and status register */
00557 #define    ADEN         7
00558 #define    ADSC         6
00559 #define    ADFR         5
00560 #define    ADIF         4
00561 #define    ADIE         3
00562 #define    ADPS2        2
00563 #define    ADPS1        1
00564 #define    ADPS0        0
00565 
00566 /* ADC Multiplexer select */
00567 #define    MUX2         2
00568 #define    MUX1         1
00569 #define    MUX0         0
00570 
00571 /* Pointer definition */
00572 #define    XL       r26
00573 #define    XH       r27
00574 #define    YL       r28
00575 #define    YH       r29
00576 #define    ZL       r30
00577 #define    ZH       r31
00578 
00579 /* Constants */
00580 #define    RAMEND   0x0FFF     /*Last On-Chip SRAM Location*/
00581 #define    XRAMEND  0xFFFF
00582 #define    E2END    0x0FFF
00583 #define    FLASHEND 0x1FFFF
00584 
00585 #endif /* _AVR_IOM103_H_ */

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