1 ;***************************************************************************
\r
2 ;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y
\r
5 ;* File Name :"m16def.inc"
\r
6 ;* Title :Register/Bit Definitions for the ATmega16
\r
9 ;* Support telephone :+47 72 88 87 20 (ATMEL Norway)
\r
10 ;* Support fax :+47 72 88 87 18 (ATMEL Norway)
\r
11 ;* Support E-mail :avr@atmel.no
\r
12 ;* Target MCU :ATmega16
\r
15 ;* When including this file in the assembly program file, all I/O register
\r
16 ;* names and I/O register bit names appearing in the data book can be used.
\r
17 ;* In addition, the six registers forming the three data pointers X, Y and
\r
18 ;* Z have been assigned names XL - ZH. Highest RAM address for Internal
\r
19 ;* SRAM is also defined
\r
21 ;* The Register names are represented by their hexadecimal address.
\r
23 ;* The Register Bit names are represented by their bit number (0-7).
\r
25 ;* Please observe the difference in using the bit names with instructions
\r
26 ;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc"
\r
27 ;* (skip if bit in register set/cleared). The following example illustrates
\r
30 ;* in r16,PORTB ;read PORTB latch
\r
31 ;* sbr r16,(1<<PB6)+(1<<PB5) ;set PB6 and PB5 (use masks, not bit#)
\r
32 ;* out PORTB,r16 ;output to PORTB
\r
34 ;* in r16,TIFR ;read the Timer Interrupt Flag Register
\r
35 ;* sbrc r16,TOV0 ;test the overflow flag (use bit#)
\r
36 ;* rjmp TOV0_is_set ;jump if set
\r
37 ;* ... ;otherwise do something else
\r
38 ;***************************************************************************
\r
40 ;***** Specify Device
\r
43 ;***** I/O Register Definitions
\r
48 .equ GICR =$3b ; New name for GIMSK
\r
58 .equ MCUCSR =$34 ; New name for MCUSR
\r
79 .equ UBRRH =$20 ; New name for UBRRHI
\r
101 .equ USR =$0b ; For compatibility with S8535
\r
103 .equ UCR =$0a ; For compatibility with S8535
\r
104 .equ UCSRC =$20 ; Note! UCSRC equals UBRRH
\r
106 .equ UBRRL =$09 ; New name for UBRR
\r
121 ;***** Bit Definitions
\r
194 .equ PWM0 =6 ;OBSOLETE! Use WGM00
\r
198 .equ CTC0 =3 ;OBSOLETE! Use WGM01
\r
221 .equ PWM11 =1 ; OBSOLETE! Use WGM11
\r
222 .equ PWM10 =0 ; OBSOLETE! Use WGM10
\r
229 .equ CTC11 =4 ; OBSOLETE! Use WGM13
\r
230 .equ CTC10 =3 ; OBSOLETE! Use WGM12
\r
231 .equ CTC1 =3 ; OBSOLETE! Use WGM12
\r
240 .equ PWM2 =6 ; OBSOLETE! Use WGM20
\r
244 .equ CTC2 =3 ; OBSOLETE! Use WGM21
\r
410 .equ DOR =3 ;New name for OR
\r
422 .equ UCSZ2 =2 ; New name for CHR9
\r
479 .equ BOOTSTART =$1E00 ;OBSOLETE!!! temporarily kept for compatibility
\r
480 ;.equ LARGEBOOTSTART =$0C00 ;largest boot block is 2KB
\r
481 ;.equ SMALLBOOTSTART =$0F80 ;smallest boot block is 256B
\r
482 .equ SMALLBOOTSTART =0b1111110000000 ;($1F80) smallest boot block is 256B
\r
483 .equ SECONDBOOTSTART =0b1111100000000 ;($1F00) second boot block size is 512B
\r
484 .equ THIRDBOOTSTART =0b1111000000000 ;($1E00) third boot block size is 1KB
\r
485 .equ LARGEBOOTSTART =0b1110000000000 ;($1C00) largest boot block is 2KB
\r
486 .equ PAGESIZE =64 ;number of WORDS in a page
\r
487 .equ FLASHEND =$1fff
\r
489 .equ INT0addr=$002 ;External Interrupt0 Vector Address
\r
490 .equ INT1addr=$004 ;External Interrupt1 Vector Address
\r
491 .equ OC2addr =$006 ;Output Compare2 Interrupt Vector Address
\r
492 .equ OVF2addr=$008 ;Overflow2 Interrupt Vector Address
\r
493 .equ ICP1addr=$00A ;Input Capture1 Interrupt Vector Address
\r
494 .equ OC1Aaddr=$00C ;Output Compare1A Interrupt Vector Address
\r
495 .equ OC1Baddr=$00E ;Output Compare1B Interrupt Vector Address
\r
496 .equ OVF1addr=$010 ;Overflow1 Interrupt Vector Address
\r
497 .equ OVF0addr=$012 ;Overflow0 Interrupt Vector Address
\r
498 .equ SPIaddr =$014 ;SPI Interrupt Vector Address
\r
499 .equ URXCaddr=$016 ;UART Receive Complete Interrupt Vector Address
\r
500 .equ UDREaddr=$018 ;UART Data Register Empty Interrupt Vector Address
\r
501 .equ UTXCaddr=$01A ;UART Transmit Complete Interrupt Vector Address
\r
502 .equ ADCCaddr=$01C ;ADC Interrupt Vector Address
\r
503 .equ ERDYaddr=$01E ;EEPROM Interrupt Vector Address
\r
504 .equ ACIaddr =$020 ;Analog Comparator Interrupt Vector Address
\r
505 .equ TWIaddr =$022 ;Irq. vector address for Two-Wire Interface
\r
506 .equ INT2addr=$024 ;External Interrupt2 Vector Address
\r
507 .equ OC0addr =$026 ;Output Compare0 Interrupt Vector Address
\r
508 .equ SPMRaddr=$028 ;Store Program Memory Ready Interrupt Vector Address
\r