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

iom128.h

00001 /* Copyright (c) 2002, Peter Jansen
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/iom128.h - defines for ATmega128 
00027 
00028    As of 2002-08-27:
00029    - This should be up to date with data sheet 2467E-AVR-05/02 */
00030 
00031 #ifndef _AVR_IOM128_H_
00032 #define _AVR_IOM128_H_ 1
00033 
00034 /* This file should only be included from <avr/io.h>, never directly. */
00035 
00036 #ifndef _AVR_IO_H_
00037 #  error "Include <avr/io.h> instead of this file."
00038 #endif
00039 
00040 #ifndef _AVR_IOXXX_H_
00041 #  define _AVR_IOXXX_H_ "iom128.h"
00042 #else
00043 #  error "Attempt to include more than one <avr/ioXXX.h> file."
00044 #endif 
00045 
00046 #include <avr/sfr_defs.h>
00047 
00048 /* I/O registers */
00049 
00050 /* Input Pins, Port F */
00051 #define PINF      _SFR_IO8(0x00)
00052 
00053 /* Input Pins, Port E */
00054 #define PINE      _SFR_IO8(0x01)
00055 
00056 /* Data Direction Register, Port E */
00057 #define DDRE      _SFR_IO8(0x02)
00058 
00059 /* Data Register, Port E */
00060 #define PORTE     _SFR_IO8(0x03)
00061 
00062 /* ADC Data Register */
00063 #define ADCW    _SFR_IO16(0x04) /* for backwards compatibility */
00064 #define ADC     _SFR_IO16(0x04)
00065 #define ADCL    _SFR_IO8(0x04)
00066 #define ADCH    _SFR_IO8(0x05)
00067 
00068 /* ADC Control and status register */
00069 #define ADCSR     _SFR_IO8(0x06)
00070 #define ADCSRA    _SFR_IO8(0x06) /* new name in datasheet (2467E-AVR-05/02) */
00071 
00072 /* ADC Multiplexer select */
00073 #define ADMUX     _SFR_IO8(0x07)
00074 
00075 /* Analog Comparator Control and Status Register */
00076 #define ACSR      _SFR_IO8(0x08)
00077 
00078 /* USART0 Baud Rate Register Low */
00079 #define UBRR0L    _SFR_IO8(0x09)
00080 
00081 /* USART0 Control and Status Register B */
00082 #define UCSR0B    _SFR_IO8(0x0A)
00083 
00084 /* USART0 Control and Status Register A */
00085 #define UCSR0A    _SFR_IO8(0x0B)
00086 
00087 /* USART0 I/O Data Register */
00088 #define UDR0      _SFR_IO8(0x0C)
00089 
00090 /* SPI Control Register */
00091 #define SPCR      _SFR_IO8(0x0D)
00092 
00093 /* SPI Status Register */
00094 #define SPSR      _SFR_IO8(0x0E)
00095 
00096 /* SPI I/O Data Register */
00097 #define SPDR      _SFR_IO8(0x0F)
00098 
00099 /* Input Pins, Port D */
00100 #define PIND      _SFR_IO8(0x10)
00101 
00102 /* Data Direction Register, Port D */
00103 #define DDRD      _SFR_IO8(0x11)
00104 
00105 /* Data Register, Port D */
00106 #define PORTD     _SFR_IO8(0x12)
00107 
00108 /* Input Pins, Port C */
00109 #define PINC      _SFR_IO8(0x13)
00110 
00111 /* Data Direction Register, Port C */
00112 #define DDRC      _SFR_IO8(0x14)
00113 
00114 /* Data Register, Port C */
00115 #define PORTC     _SFR_IO8(0x15)
00116 
00117 /* Input Pins, Port B */
00118 #define PINB      _SFR_IO8(0x16)
00119 
00120 /* Data Direction Register, Port B */
00121 #define DDRB      _SFR_IO8(0x17)
00122 
00123 /* Data Register, Port B */
00124 #define PORTB     _SFR_IO8(0x18)
00125 
00126 /* Input Pins, Port A */
00127 #define PINA      _SFR_IO8(0x19)
00128 
00129 /* Data Direction Register, Port A */
00130 #define DDRA      _SFR_IO8(0x1A)
00131 
00132 /* Data Register, Port A */
00133 #define PORTA     _SFR_IO8(0x1B)
00134 
00135 /* EEPROM Control Register */
00136 #define EECR      _SFR_IO8(0x1C)
00137 
00138 /* EEPROM Data Register */
00139 #define EEDR      _SFR_IO8(0x1D)
00140 
00141 /* EEPROM Address Register */
00142 #define EEAR    _SFR_IO16(0x1E)
00143 #define EEARL     _SFR_IO8(0x1E)
00144 #define EEARH     _SFR_IO8(0x1F)
00145 
00146 /* Special Function I/O Register */
00147 #define SFIOR     _SFR_IO8(0x20)
00148 
00149 /* Watchdog Timer Control Register */
00150 #define WDTCR     _SFR_IO8(0x21)
00151 
00152 /* On-chip Debug Register */
00153 #define OCDR      _SFR_IO8(0x22)
00154 
00155 /* Timer2 Output Compare Register */
00156 #define OCR2      _SFR_IO8(0x23)
00157 
00158 /* Timer/Counter 2 */
00159 #define TCNT2     _SFR_IO8(0x24)
00160 
00161 /* Timer/Counter 2 Control register */
00162 #define TCCR2     _SFR_IO8(0x25)
00163 
00164 /* T/C 1 Input Capture Register */
00165 #define ICR1    _SFR_IO16(0x26)
00166 #define ICR1L     _SFR_IO8(0x26)
00167 #define ICR1H     _SFR_IO8(0x27)
00168 
00169 /* Timer/Counter1 Output Compare Register B */
00170 #define OCR1B   _SFR_IO16(0x28)
00171 #define OCR1BL    _SFR_IO8(0x28)
00172 #define OCR1BH    _SFR_IO8(0x29)
00173 
00174 /* Timer/Counter1 Output Compare Register A */
00175 #define OCR1A   _SFR_IO16(0x2A)
00176 #define OCR1AL    _SFR_IO8(0x2A)
00177 #define OCR1AH    _SFR_IO8(0x2B)
00178 
00179 /* Timer/Counter 1 */
00180 #define TCNT1   _SFR_IO16(0x2C)
00181 #define TCNT1L    _SFR_IO8(0x2C)
00182 #define TCNT1H    _SFR_IO8(0x2D)
00183 
00184 /* Timer/Counter 1 Control and Status Register */
00185 #define TCCR1B    _SFR_IO8(0x2E)
00186 
00187 /* Timer/Counter 1 Control Register */
00188 #define TCCR1A    _SFR_IO8(0x2F)
00189 
00190 /* Timer/Counter 0 Asynchronous Control & Status Register */
00191 #define ASSR      _SFR_IO8(0x30)
00192 
00193 /* Output Compare Register 0 */
00194 #define OCR0      _SFR_IO8(0x31)
00195 
00196 /* Timer/Counter 0 */
00197 #define TCNT0     _SFR_IO8(0x32)
00198 
00199 /* Timer/Counter 0 Control Register */
00200 #define TCCR0     _SFR_IO8(0x33)
00201 
00202 /* MCU Status Register */
00203 #define MCUSR     _SFR_IO8(0x34)
00204 #define MCUCSR    _SFR_IO8(0x34) /* new name in datasheet (2467E-AVR-05/02) */
00205 
00206 /* MCU general Control Register */
00207 #define MCUCR     _SFR_IO8(0x35)
00208 
00209 /* Timer/Counter Interrupt Flag Register */
00210 #define TIFR      _SFR_IO8(0x36)
00211 
00212 /* Timer/Counter Interrupt MaSK register */
00213 #define TIMSK     _SFR_IO8(0x37)
00214 
00215 /* External Interrupt Flag Register */
00216 #define EIFR      _SFR_IO8(0x38)
00217 
00218 /* External Interrupt MaSK register */
00219 #define EIMSK     _SFR_IO8(0x39)
00220 
00221 /* External Interrupt Control Register B */
00222 #define EICRB     _SFR_IO8(0x3A)
00223 
00224 /* RAM Page Z select register */
00225 #define RAMPZ     _SFR_IO8(0x3B)
00226 
00227 /* XDIV Divide control register */
00228 #define XDIV      _SFR_IO8(0x3C)
00229 
00230 /* Stack Pointer */
00231 #define SP      _SFR_IO16(0x3D)
00232 #define SPL     _SFR_IO8(0x3D)
00233 #define SPH     _SFR_IO8(0x3E)
00234 
00235 /* Status REGister */
00236 #define SREG      _SFR_IO8(0x3F)
00237 
00238 /* Extended I/O registers */
00239 
00240 /* Data Direction Register, Port F */
00241 #define DDRF      _SFR_MEM8(0x61)
00242 
00243 /* Data Register, Port F */
00244 #define PORTF     _SFR_MEM8(0x62)
00245 
00246 /* Input Pins, Port G */
00247 #define PING      _SFR_MEM8(0x63)
00248 
00249 /* Data Direction Register, Port G */
00250 #define DDRG      _SFR_MEM8(0x64)
00251 
00252 /* Data Register, Port G */
00253 #define PORTG     _SFR_MEM8(0x65)
00254 
00255 /* Store Program Memory Control and Status Register */
00256 #define SPMCR     _SFR_MEM8(0x68)
00257 #define SPMCSR    _SFR_MEM8(0x68) /* new name in datasheet (2467E-AVR-05/02) */
00258 
00259 /* External Interrupt Control Register A */
00260 #define EICRA     _SFR_MEM8(0x6A)
00261 
00262 /* External Memory Control Register B */
00263 #define XMCRB     _SFR_MEM8(0x6C)
00264 
00265 /* External Memory Control Register A */
00266 #define XMCRA     _SFR_MEM8(0x6D)
00267 
00268 /* Oscillator Calibration Register */
00269 #define OSCCAL    _SFR_MEM8(0x6F)
00270 
00271 /* 2-wire Serial Interface Bit Rate Register */
00272 #define TWBR      _SFR_MEM8(0x70)
00273 
00274 /* 2-wire Serial Interface Status Register */
00275 #define TWSR      _SFR_MEM8(0x71)
00276 
00277 /* 2-wire Serial Interface Address Register */
00278 #define TWAR      _SFR_MEM8(0x72)
00279 
00280 /* 2-wire Serial Interface Data Register */
00281 #define TWDR      _SFR_MEM8(0x73)
00282 
00283 /* 2-wire Serial Interface Control Register */
00284 #define TWCR      _SFR_MEM8(0x74)
00285 
00286 /* Time Counter 1 Output Compare Register C */
00287 #define OCR1C   _SFR_MEM16(0x78)
00288 #define OCR1CL    _SFR_MEM8(0x78)
00289 #define OCR1CH    _SFR_MEM8(0x79)
00290 
00291 /* Timer/Counter 1 Control Register C */
00292 #define TCCR1C    _SFR_MEM8(0x7A)
00293 
00294 /* Extended Timer Interrupt Flag Register */
00295 #define ETIFR     _SFR_MEM8(0x7C)
00296 
00297 /* Extended Timer Interrupt Mask Register */
00298 #define ETIMSK    _SFR_MEM8(0x7D)
00299 
00300 /* Timer/Counter 3 Input Capture Register */
00301 #define ICR3    _SFR_MEM16(0x80)
00302 #define ICR3L     _SFR_MEM8(0x80)
00303 #define ICR3H     _SFR_MEM8(0x81)
00304 
00305 /* Timer/Counter 3 Output Compare Register C */
00306 #define OCR3C   _SFR_MEM16(0x82)
00307 #define OCR3CL    _SFR_MEM8(0x82)
00308 #define OCR3CH    _SFR_MEM8(0x83)
00309 
00310 /* Timer/Counter 3 Output Compare Register B */
00311 #define OCR3B   _SFR_MEM16(0x84)
00312 #define OCR3BL    _SFR_MEM8(0x84)
00313 #define OCR3BH    _SFR_MEM8(0x85)
00314 
00315 /* Timer/Counter 3 Output Compare Register A */
00316 #define OCR3A   _SFR_MEM16(0x86)
00317 #define OCR3AL    _SFR_MEM8(0x86)
00318 #define OCR3AH    _SFR_MEM8(0x87)
00319 
00320 /* Timer/Counter 3 Counter Register */
00321 #define TCNT3   _SFR_MEM16(0x88)
00322 #define TCNT3L    _SFR_MEM8(0x88)
00323 #define TCNT3H    _SFR_MEM8(0x89)
00324 
00325 /* Timer/Counter 3 Control Register B */
00326 #define TCCR3B    _SFR_MEM8(0x8A)
00327 
00328 /* Timer/Counter 3 Control Register A */
00329 #define TCCR3A    _SFR_MEM8(0x8B)
00330 
00331 /* Timer/Counter 3 Control Register C */
00332 #define TCCR3C    _SFR_MEM8(0x8C)
00333 
00334 /* USART0 Baud Rate Register High */
00335 #define UBRR0H    _SFR_MEM8(0x90)
00336 
00337 /* USART0 Control and Status Register C */
00338 #define UCSR0C    _SFR_MEM8(0x95)
00339 
00340 /* USART1 Baud Rate Register High */
00341 #define UBRR1H    _SFR_MEM8(0x98)
00342 
00343 /* USART1 Baud Rate Register Low*/
00344 #define UBRR1L    _SFR_MEM8(0x99)
00345 
00346 /* USART1 Control and Status Register B */
00347 #define UCSR1B    _SFR_MEM8(0x9A)
00348 
00349 /* USART1 Control and Status Register A */
00350 #define UCSR1A    _SFR_MEM8(0x9B)
00351 
00352 /* USART1 I/O Data Register */
00353 #define UDR1      _SFR_MEM8(0x9C)
00354 
00355 /* USART1 Control and Status Register C */
00356 #define UCSR1C    _SFR_MEM8(0x9D)
00357 
00358 
00359 /* Interrupt vectors */
00360 
00361 #define SIG_INTERRUPT0          _VECTOR(1)
00362 #define SIG_INTERRUPT1          _VECTOR(2)
00363 #define SIG_INTERRUPT2          _VECTOR(3)
00364 #define SIG_INTERRUPT3          _VECTOR(4)
00365 #define SIG_INTERRUPT4          _VECTOR(5)
00366 #define SIG_INTERRUPT5          _VECTOR(6)
00367 #define SIG_INTERRUPT6          _VECTOR(7)
00368 #define SIG_INTERRUPT7          _VECTOR(8)
00369 #define SIG_OUTPUT_COMPARE2     _VECTOR(9)
00370 #define SIG_OVERFLOW2           _VECTOR(10)
00371 #define SIG_INPUT_CAPTURE1      _VECTOR(11)
00372 #define SIG_OUTPUT_COMPARE1A    _VECTOR(12)
00373 #define SIG_OUTPUT_COMPARE1B    _VECTOR(13)
00374 #define SIG_OVERFLOW1           _VECTOR(14)
00375 #define SIG_OUTPUT_COMPARE0     _VECTOR(15)
00376 #define SIG_OVERFLOW0           _VECTOR(16)
00377 #define SIG_SPI                 _VECTOR(17)
00378 #define SIG_UART0_RECV          _VECTOR(18)
00379 #define SIG_UART0_DATA          _VECTOR(19)
00380 #define SIG_UART0_TRANS         _VECTOR(20)
00381 #define SIG_ADC                 _VECTOR(21)
00382 #define SIG_EEPROM_READY        _VECTOR(22)
00383 #define SIG_COMPARATOR          _VECTOR(23)
00384 #define SIG_OUTPUT_COMPARE1C    _VECTOR(24)
00385 #define SIG_INPUT_CAPTURE3      _VECTOR(25)
00386 #define SIG_OUTPUT_COMPARE3A    _VECTOR(26)
00387 #define SIG_OUTPUT_COMPARE3B    _VECTOR(27)
00388 #define SIG_OUTPUT_COMPARE3C    _VECTOR(28)
00389 #define SIG_OVERFLOW3           _VECTOR(29)
00390 #define SIG_UART1_RECV          _VECTOR(30)
00391 #define SIG_UART1_DATA          _VECTOR(31)
00392 #define SIG_UART1_TRANS         _VECTOR(32)
00393 #define SIG_2WIRE_SERIAL        _VECTOR(33)
00394 #define SIG_SPM_READY           _VECTOR(34)
00395 
00396 #define _VECTORS_SIZE 140
00397 
00398 /*
00399    The Register Bit names are represented by their bit number (0-7).
00400 */
00401 
00402 /* 2-wire Control Register - TWCR */
00403 #define    TWINT        7
00404 #define    TWEA         6
00405 #define    TWSTA        5
00406 #define    TWSTO        4
00407 #define    TWWC         3
00408 #define    TWEN         2
00409 #define    TWIE         0
00410 
00411 /* 2-wire Address Register - TWAR */
00412 #define    TWA6         7
00413 #define    TWA5         6
00414 #define    TWA4         5
00415 #define    TWA3         4
00416 #define    TWA2         3
00417 #define    TWA1         2
00418 #define    TWA0         1
00419 #define    TWGCE        0
00420 
00421 /* 2-wire Status Register - TWSR */
00422 #define    TWS7         7
00423 #define    TWS6         6
00424 #define    TWS5         5
00425 #define    TWS4         4
00426 #define    TWS3         3
00427 #define    TWPS1        1
00428 #define    TWPS0        0
00429 
00430 /* External Memory Control Register A - XMCRA */
00431 #define    SRL2         6
00432 #define    SRL1         5
00433 #define    SRL0         4
00434 #define    SRW01        3
00435 #define    SRW00        2
00436 #define    SRW11        1
00437 
00438 /* External Memory Control Register B - XMCRA */
00439 #define    XMBK         7
00440 #define    XMM2         2
00441 #define    XMM1         1
00442 #define    XMM0         0
00443 
00444 /* XDIV Divide control register - XDIV */
00445 #define    XDIVEN       7
00446 #define    XDIV6        6
00447 #define    XDIV5        5
00448 #define    XDIV4        4
00449 #define    XDIV3        3
00450 #define    XDIV2        2
00451 #define    XDIV1        1
00452 #define    XDIV0        0
00453 
00454 /* RAM Page Z select register - RAMPZ */
00455 #define     RAMPZ0      0
00456 
00457 /* External Interrupt Control Register A - EICRA */
00458 #define    ISC31        7
00459 #define    ISC30        6
00460 #define    ISC21        5
00461 #define    ISC20        4
00462 #define    ISC11        3
00463 #define    ISC10        2
00464 #define    ISC01        1
00465 #define    ISC00        0
00466 
00467 /* External Interrupt Control Register B - EICRB */
00468 #define    ISC71        7
00469 #define    ISC70        6
00470 #define    ISC61        5
00471 #define    ISC60        4
00472 #define    ISC51        3
00473 #define    ISC50        2
00474 #define    ISC41        1
00475 #define    ISC40        0
00476 
00477 /* Store Program Memory Control Register - SPMCSR, SPMCR */
00478 #define    SPMIE        7
00479 #define    RWWSB        6
00480 #define    RWWSRE       4
00481 #define    BLBSET       3
00482 #define    PGWRT        2
00483 #define    PGERS        1
00484 #define    SPMEN        0
00485 
00486 /* External Interrupt MaSK register - EIMSK */
00487 #define    INT7         7
00488 #define    INT6         6
00489 #define    INT5         5
00490 #define    INT4         4
00491 #define    INT3         3
00492 #define    INT2         2
00493 #define    INT1         1
00494 #define    INT0         0
00495 
00496 /* External Interrupt Flag Register - EIFR */
00497 #define    INTF7        7
00498 #define    INTF6        6
00499 #define    INTF5        5
00500 #define    INTF4        4
00501 #define    INTF3        3
00502 #define    INTF2        2
00503 #define    INTF1        1
00504 #define    INTF0        0
00505 
00506 /* Timer/Counter Interrupt MaSK register - TIMSK */
00507 #define    OCIE2        7
00508 #define    TOIE2        6
00509 #define    TICIE1       5
00510 #define    OCIE1A       4
00511 #define    OCIE1B       3
00512 #define    TOIE1        2
00513 #define    OCIE0        1
00514 #define    TOIE0        0
00515 
00516 /* Timer/Counter Interrupt Flag Register - TIFR */
00517 #define    OCF2         7
00518 #define    TOV2         6
00519 #define    ICF1         5
00520 #define    OCF1A        4
00521 #define    OCF1B        3
00522 #define    TOV1         2
00523 #define    OCF0         1
00524 #define    TOV0         0
00525 
00526 /* Extended Timer Interrupt MaSK register - ETIMSK */
00527 #define    TICIE3       5
00528 #define    OCIE3A       4
00529 #define    OCIE3B       3
00530 #define    TOIE3        2
00531 #define    OCIE3C       1
00532 #define    OCIE1C       0
00533 
00534 /* Extended Timer Interrupt Flag Register - ETIFR */
00535 #define    ICF3         5
00536 #define    OCF3A        4
00537 #define    OCF3B        3
00538 #define    TOV3         2
00539 #define    OCF3C        1
00540 #define    OCF1C        0
00541 
00542 /* MCU general Control Register - MCUCR */
00543 #define    SRE          7
00544 #define    SRW          6
00545 #define    SRW10        6       /* new name in datasheet (2467E-AVR-05/02) */
00546 #define    SE           5
00547 #define    SM1          4
00548 #define    SM0          3
00549 #define    SM2          2
00550 #define    IVSEL        1
00551 #define    IVCE         0
00552 
00553 /* MCU Status Register - MCUSR, MCUCSR */
00554 #define    JTD          7
00555 #define    JTRF         4
00556 #define    WDRF         3
00557 #define    BORF         2
00558 #define    EXTRF        1
00559 #define    PORF         0
00560 
00561 /* Timer/Counter Control Register (generic) */
00562 #define    FOC          7
00563 #define    WGM0         6
00564 #define    COM1         5
00565 #define    COM0         4
00566 #define    WGM1         3
00567 #define    CS2          2
00568 #define    CS1          1
00569 #define    CS0          0
00570 
00571 /* Timer/Counter 0 Control Register - TCCR0 */
00572 #define    FOC0         7
00573 #define    WGM00        6
00574 #define    COM01        5
00575 #define    COM00        4
00576 #define    WGM01        3
00577 #define    CS12         2
00578 #define    CS11         1
00579 #define    CS10         0
00580 
00581 /* Timer/Counter 2 Control Register - TCCR2 */
00582 #define    FOC2         7
00583 #define    WGM20        6
00584 #define    COM21        5
00585 #define    COM20        4
00586 #define    WGM21        3
00587 #define    CS22         2
00588 #define    CS21         1
00589 #define    CS20         0
00590 
00591 /* Timer/Counter 0 Asynchronous Control & Status Register - ASSR */
00592 #define    AS0          3
00593 #define    TCN0UB       2
00594 #define    OCR0UB       1
00595 #define    TCR0UB       0
00596 
00597 /* Timer/Counter Control Register A (generic) */
00598 #define    COMA1        7
00599 #define    COMA0        6
00600 #define    COMB1        5
00601 #define    COMB0        4
00602 #define    COMC1        3
00603 #define    COMC0        2
00604 #define    WGMA1        1
00605 #define    WGMA0        0
00606 
00607 /* Timer/Counter 1 Control and Status Register A - TCCR1A */
00608 #define    COM1A1       7
00609 #define    COM1A0       6
00610 #define    COM1B1       5
00611 #define    COM1B0       4
00612 #define    COM1C1       3
00613 #define    COM1C0       2
00614 #define    WGM11        1
00615 #define    WGM10        0
00616 
00617 /* Timer/Counter 3 Control and Status Register A - TCCR3A */
00618 #define    COM3A1       7
00619 #define    COM3A0       6
00620 #define    COM3B1       5
00621 #define    COM3B0       4
00622 #define    COM3C1       3
00623 #define    COM3C0       2
00624 #define    WGM31        1
00625 #define    WGM30        0
00626 
00627 /* Timer/Counter Control and Status Register B (generic) */
00628 #define    ICNC         7
00629 #define    ICES         6
00630 #define    WGMB3        4
00631 #define    WGMB2        3
00632 #define    CSB2         2
00633 #define    CSB1         1
00634 #define    CSB0         0
00635 
00636 /* Timer/Counter 1 Control and Status Register B - TCCR1B */
00637 #define    ICNC1        7
00638 #define    ICES1        6
00639 #define    WGM13        4
00640 #define    WGM12        3
00641 #define    CS12         2
00642 #define    CS11         1
00643 #define    CS10         0
00644 
00645 /* Timer/Counter 3 Control and Status Register B - TCCR3B */
00646 #define    ICNC3        7
00647 #define    ICES3        6
00648 #define    WGM33        4
00649 #define    WGM32        3
00650 #define    CS32         2
00651 #define    CS31         1
00652 #define    CS30         0
00653 
00654 /* Timer/Counter Control Register C (generic) */
00655 #define    FOCA         7
00656 #define    FOCB         6
00657 #define    FOCC         5
00658 
00659 /* Timer/Counter 3 Control Register C - TCCR3C */
00660 #define    FOC3A        7
00661 #define    FOC3B        6
00662 #define    FOC3C        5
00663 
00664 /* Timer/Counter 1 Control Register C - TCCR1C */
00665 #define    FOC1A        7
00666 #define    FOC1B        6
00667 #define    FOC1C        5
00668 
00669 /* On-chip Debug Register - OCDR */
00670 #define    IDRD         7
00671 #define    OCDR7        7
00672 #define    OCDR6        6
00673 #define    OCDR5        5
00674 #define    OCDR4        4
00675 #define    OCDR3        3
00676 #define    OCDR2        2
00677 #define    OCDR1        1
00678 #define    OCDR0        0
00679 
00680 /* Watchdog Timer Control Register - WDTCR */
00681 #define    WDCE         4
00682 #define    WDE          3
00683 #define    WDP2         2
00684 #define    WDP1         1
00685 #define    WDP0         0
00686 
00687 /* Special Function I/O Register - SFIOR */
00688 #define    TSM          7
00689 #define    ADHSM        4
00690 #define    ACME         3
00691 #define    PUD          2
00692 #define    PSR0         1
00693 #define    PSR321       0
00694 
00695 /* EEPROM Control Register - EECR */
00696 #define    EERIE        3
00697 #define    EEMWE        2
00698 #define    EEWE         1
00699 #define    EERE         0
00700 
00701 /* Port Data Register (generic) */
00702 #define    PORT7        7
00703 #define    PORT6        6
00704 #define    PORT5        5
00705 #define    PORT4        4
00706 #define    PORT3        3
00707 #define    PORT2        2
00708 #define    PORT1        1
00709 #define    PORT0        0
00710 
00711 /* Port Data Direction Register (generic) */
00712 #define    DD7          7
00713 #define    DD6          6
00714 #define    DD5          5
00715 #define    DD4          4
00716 #define    DD3          3
00717 #define    DD2          2
00718 #define    DD1          1
00719 #define    DD0          0
00720 
00721 /* Port Input Pins (generic) */
00722 #define    PIN7         7
00723 #define    PIN6         6
00724 #define    PIN5         5
00725 #define    PIN4         4
00726 #define    PIN3         3
00727 #define    PIN2         2
00728 #define    PIN1         1
00729 #define    PIN0         0
00730 
00731 /* Status Register - SREG */
00732 #define    SREG_I       7
00733 #define    SREG_T       6
00734 #define    SREG_H       5
00735 #define    SREG_S       4
00736 #define    SREG_V       3
00737 #define    SREG_N       2
00738 #define    SREG_Z       1
00739 #define    SREG_C       0
00740 
00741 /* SPI Status Register - SPSR */
00742 #define    SPIF         7
00743 #define    WCOL         6
00744 #define    SPI2X        0
00745 
00746 /* SPI Control Register - SPCR */
00747 #define    SPIE         7
00748 #define    SPE          6
00749 #define    DORD         5
00750 #define    MSTR         4
00751 #define    CPOL         3
00752 #define    CPHA         2
00753 #define    SPR1         1
00754 #define    SPR0         0
00755 
00756 /* USART Register C (generic) */
00757 #define    UMSEL        6
00758 #define    UPM1         5
00759 #define    UPM0         4
00760 #define    USBS         3
00761 #define    UCSZ1        2
00762 #define    UCSZ0        1
00763 #define    UCPOL        0
00764 
00765 /* USART1 Register C - UCSR1C */
00766 #define    UMSEL1       6
00767 #define    UPM11        5
00768 #define    UPM10        4
00769 #define    USBS1        3
00770 #define    UCSZ11       2
00771 #define    UCSZ10       1
00772 #define    UCPOL1       0
00773 
00774 /* USART0 Register C - UCSR0C */
00775 #define    UMSEL0       6
00776 #define    UPM01        5
00777 #define    UPM00        4
00778 #define    USBS0        3
00779 #define    UCSZ01       2
00780 #define    UCSZ00       1
00781 #define    UCPOL0       0
00782 
00783 /* USART Status Register A (generic) */
00784 #define    RXC          7
00785 #define    TXC          6
00786 #define    UDRE         5
00787 #define    FE           4
00788 #define    DOR          3
00789 #define    UPE          2
00790 #define    U2X          1
00791 #define    MPCM         0
00792 
00793 /* USART1 Status Register A - UCSR1A */
00794 #define    RXC1         7
00795 #define    TXC1         6
00796 #define    UDRE1        5
00797 #define    FE1          4
00798 #define    DOR1         3
00799 #define    UPE1         2
00800 #define    U2X1         1
00801 #define    MPCM1        0
00802 
00803 /* USART0 Status Register A - UCSR0A */
00804 #define    RXC0         7
00805 #define    TXC0         6
00806 #define    UDRE0        5
00807 #define    FE0          4
00808 #define    DOR0         3
00809 #define    UPE0         2
00810 #define    U2X0         1
00811 #define    MPCM0        0
00812 
00813 /* USART Control Register B (generic) */
00814 #define    RXCIE        7
00815 #define    TXCIE        6
00816 #define    UDRIE        5
00817 #define    RXEN         4
00818 #define    TXEN         3
00819 #define    UCSZ         2
00820 #define    UCSZ2        2       /* new name in datasheet (2467E-AVR-05/02) */
00821 #define    RXB8         1
00822 #define    TXB8         0
00823 
00824 /* USART1 Control Register B - UCSR1B */
00825 #define    RXCIE1       7
00826 #define    TXCIE1       6
00827 #define    UDRIE1       5
00828 #define    RXEN1        4
00829 #define    TXEN1        3
00830 #define    UCSZ12       2
00831 #define    RXB81        1
00832 #define    TXB81        0
00833 
00834 /* USART0 Control Register B - UCSR0B */
00835 #define    RXCIE0       7
00836 #define    TXCIE0       6
00837 #define    UDRIE0       5
00838 #define    RXEN0        4
00839 #define    TXEN0        3
00840 #define    UCSZ02       2
00841 #define    RXB80        1
00842 #define    TXB80        0
00843 
00844 /* Analog Comparator Control and Status Register - ACSR */
00845 #define    ACD          7
00846 #define    ACBG         6
00847 #define    ACO          5
00848 #define    ACI          4
00849 #define    ACIE         3
00850 #define    ACIC         2
00851 #define    ACIS1        1
00852 #define    ACIS0        0
00853 
00854 /* ADC Control and status register - ADCSRA */
00855 #define    ADEN         7
00856 #define    ADSC         6
00857 #define    ADFR         5
00858 #define    ADIF         4
00859 #define    ADIE         3
00860 #define    ADPS2        2
00861 #define    ADPS1        1
00862 #define    ADPS0        0
00863 
00864 /* ADC Multiplexer select - ADMUX */
00865 #define    REFS1        7
00866 #define    REFS0        6
00867 #define    ADLAR        5
00868 #define    MUX4         4
00869 #define    MUX3         3
00870 #define    MUX2         2
00871 #define    MUX1         1
00872 #define    MUX0         0
00873 
00874 /* Port A Data Register - PORTA */
00875 #define    PORTA7       7
00876 #define    PORTA6       6
00877 #define    PORTA5       5
00878 #define    PORTA4       4
00879 #define    PORTA3       3
00880 #define    PORTA2       2
00881 #define    PORTA1       1
00882 #define    PORTA0       0
00883 
00884 /* Port A Data Direction Register - DDRA */
00885 #define    DDA7         7
00886 #define    DDA6         6
00887 #define    DDA5         5
00888 #define    DDA4         4
00889 #define    DDA3         3
00890 #define    DDA2         2
00891 #define    DDA1         1
00892 #define    DDA0         0
00893 
00894 /* Port A Input Pins - PINA */
00895 #define    PINA7        7
00896 #define    PINA6        6
00897 #define    PINA5        5
00898 #define    PINA4        4
00899 #define    PINA3        3
00900 #define    PINA2        2 
00901 #define    PINA1        1
00902 #define    PINA0        0
00903 
00904 /* Port B Data Register - PORTB */
00905 #define    PORTB7       7
00906 #define    PORTB6       6
00907 #define    PORTB5       5
00908 #define    PORTB4       4
00909 #define    PORTB3       3
00910 #define    PORTB2       2
00911 #define    PORTB1       1
00912 #define    PORTB0       0
00913 
00914 /* Port B Data Direction Register - DDRB */
00915 #define    DDB7         7
00916 #define    DDB6         6
00917 #define    DDB5         5
00918 #define    DDB4         4
00919 #define    DDB3         3
00920 #define    DDB2         2
00921 #define    DDB1         1
00922 #define    DDB0         0
00923 
00924 /* Port B Input Pins - PINB */
00925 #define    PINB7        7
00926 #define    PINB6        6
00927 #define    PINB5        5
00928 #define    PINB4        4
00929 #define    PINB3        3
00930 #define    PINB2        2 
00931 #define    PINB1        1
00932 #define    PINB0        0
00933 
00934 /* Port C Data Register - PORTC */
00935 #define    PORTC7       7
00936 #define    PORTC6       6
00937 #define    PORTC5       5
00938 #define    PORTC4       4
00939 #define    PORTC3       3
00940 #define    PORTC2       2
00941 #define    PORTC1       1
00942 #define    PORTC0       0
00943 
00944 /* Port C Data Direction Register - DDRC */
00945 #define    DDC7         7
00946 #define    DDC6         6
00947 #define    DDC5         5
00948 #define    DDC4         4
00949 #define    DDC3         3
00950 #define    DDC2         2
00951 #define    DDC1         1
00952 #define    DDC0         0
00953 
00954 /* Port C Input Pins - PINC */
00955 #define    PINC7        7
00956 #define    PINC6        6
00957 #define    PINC5        5
00958 #define    PINC4        4
00959 #define    PINC3        3
00960 #define    PINC2        2 
00961 #define    PINC1        1
00962 #define    PINC0        0
00963 
00964 /* Port D Data Register - PORTD */
00965 #define    PORTD7       7
00966 #define    PORTD6       6
00967 #define    PORTD5       5
00968 #define    PORTD4       4
00969 #define    PORTD3       3
00970 #define    PORTD2       2
00971 #define    PORTD1       1
00972 #define    PORTD0       0
00973 
00974 /* Port D Data Direction Register - DDRD */
00975 #define    DDD7         7
00976 #define    DDD6         6
00977 #define    DDD5         5
00978 #define    DDD4         4
00979 #define    DDD3         3
00980 #define    DDD2         2
00981 #define    DDD1         1
00982 #define    DDD0         0
00983 
00984 /* Port D Input Pins - PIND */
00985 #define    PIND7        7
00986 #define    PIND6        6
00987 #define    PIND5        5
00988 #define    PIND4        4
00989 #define    PIND3        3
00990 #define    PIND2        2 
00991 #define    PIND1        1
00992 #define    PIND0        0
00993 
00994 /* Port E Data Register - PORTE */
00995 #define    PORTE7       7
00996 #define    PORTE6       6
00997 #define    PORTE5       5
00998 #define    PORTE4       4
00999 #define    PORTE3       3
01000 #define    PORTE2       2
01001 #define    PORTE1       1
01002 #define    PORTE0       0
01003 
01004 /* Port E Data Direction Register - DDRE */
01005 #define    DDE7         7
01006 #define    DDE6         6
01007 #define    DDE5         5
01008 #define    DDE4         4
01009 #define    DDE3         3
01010 #define    DDE2         2
01011 #define    DDE1         1
01012 #define    DDE0         0
01013 
01014 /* Port E Input Pins - PINE */
01015 #define    PINE7        7
01016 #define    PINE6        6
01017 #define    PINE5        5
01018 #define    PINE4        4
01019 #define    PINE3        3
01020 #define    PINE2        2 
01021 #define    PINE1        1
01022 #define    PINE0        0
01023 
01024 /* Port F Data Register - PORTF */
01025 #define    PORTF7       7
01026 #define    PORTF6       6
01027 #define    PORTF5       5
01028 #define    PORTF4       4
01029 #define    PORTF3       3
01030 #define    PORTF2       2
01031 #define    PORTF1       1
01032 #define    PORTF0       0
01033 
01034 /* Port F Data Direction Register - DDRF */
01035 #define    DDF7         7
01036 #define    DDF6         6
01037 #define    DDF5         5
01038 #define    DDF4         4
01039 #define    DDF3         3
01040 #define    DDF2         2
01041 #define    DDF1         1
01042 #define    DDF0         0
01043 
01044 /* Port F Input Pins - PINF */
01045 #define    PINF7        7
01046 #define    PINF6        6
01047 #define    PINF5        5
01048 #define    PINF4        4
01049 #define    PINF3        3
01050 #define    PINF2        2 
01051 #define    PINF1        1
01052 #define    PINF0        0
01053 
01054 /* Port G Data Register - PORTG */
01055 #define    PORTG4       4
01056 #define    PORTG3       3
01057 #define    PORTG2       2
01058 #define    PORTG1       1
01059 #define    PORTG0       0
01060 
01061 /* Port G Data Direction Register - DDRG */
01062 #define    DDG4         4
01063 #define    DDG3         3
01064 #define    DDG2         2
01065 #define    DDG1         1
01066 #define    DDG0         0
01067 
01068 /* Port G Input Pins - PING */
01069 #define    PING4        4
01070 #define    PING3        3
01071 #define    PING2        2 
01072 #define    PING1        1
01073 #define    PING0        0
01074 
01075 /* Pointer definition */
01076 #define    XL       r26
01077 #define    XH       r27
01078 #define    YL       r28
01079 #define    YH       r29
01080 #define    ZL       r30
01081 #define    ZH       r31
01082 
01083 /* Constants */
01084 #define    RAMEND   0x10FF     /* Last On-Chip SRAM Location */
01085 #define    XRAMEND  0xFFFF
01086 #define    E2END    0x0FFF
01087 #define    FLASHEND 0x1FFFF
01088 
01089 #endif /* _AVR_IOM128_H_ */

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