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 :"m323def.inc"
\r
6 ;* Title :Register/Bit Definitions for the ATmega323
\r
9 ;* Support telephone :+47 72 88 43 88 (ATMEL Norway)
\r
10 ;* Support fax :+47 72 88 43 99 (ATMEL Norway)
\r
11 ;* Support E-mail :avr@atmel.no
\r
12 ;* Target MCU :ATmega323
\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 GIMSK =$3b ; For compatibility, keep both names until further
\r
49 .equ GICR =$3b ; new name for GIMSK
\r
56 .equ MCUSR =$34 ; For compatibility,
\r
57 .equ MCUCSR =$34 ; keep both names until further
\r
77 .equ UBRRH =$20 ; Note! UCSRC equals UBRRH
\r
100 .equ UCSRC =$20 ; Note! UCSRC equals UBRRH
\r
114 ;***** Bit Definitions
\r
119 .equ IVSEL =1 ; interrupt vector select
\r
120 .equ IVCE =0 ; interrupt vector change enable
\r
201 .equ CTC1 =3 ; Obsolete - Included for backward compatibility
\r
364 .equ OR =3 ; old name kept for compatibilty
\r
376 .equ CHR9 =2 ; old name kept for compatibilty
\r
443 .equ TWI_TST =1 ;Present in core test mode only. Write Only.
\r
462 .equ FLASHEND =$3FFF
\r
468 .equ SMALLBOOTSTART =0b11111100000000 ;($3F00) smallest boot block is 256W
\r
469 .equ SECONDBOOTSTART =0b11111000000000 ;($3E00) 2'nd boot block size is 512W
\r
470 .equ THIRDBOOTSTART =0b11110000000000 ;($3C00) third boot block size is 1KW
\r
471 .equ LARGEBOOTSTART =0b11100000000000 ;($3800) largest boot block is 2KW
\r
472 .equ BOOTSTART =THIRDBOOTSTART ;OBSOLETE!!! kept for compatibility
\r
473 .equ PAGESIZE =64 ;number of WORDS in a page
\r
476 .equ INT0addr=$002 ; External Interrupt0 Vector Address
\r
477 .equ INT1addr=$004 ; External Interrupt1 Vector Address
\r
478 .equ INT2addr=$006 ; External Interrupt2 Vector Address
\r
479 .equ OC2addr =$008 ; Output Compare2 Interrupt Vector Address
\r
480 .equ OVF2addr=$00a ; Overflow2 Interrupt Vector Address
\r
481 .equ ICP1addr=$00c ; Input Capture1 Interrupt Vector Address
\r
482 .equ OC1Aaddr=$00e ; Output Compare1A Interrupt Vector Address
\r
483 .equ OC1Baddr=$010 ; Output Compare1B Interrupt Vector Address
\r
484 .equ OVF1addr=$012 ; Overflow1 Interrupt Vector Address
\r
485 .equ OC0addr =$014 ; Output Compare0 Interrupt Vector Address
\r
486 .equ OVF0addr=$016 ; Overflow0 Interrupt Vector Address
\r
487 .equ SPIaddr =$018 ; SPI Interrupt Vector Address
\r
488 .equ URXCaddr=$01a ; USART Receive Complete Interrupt Vector Address
\r
489 .equ UDREaddr=$01c ; USART Data Register Empty Interrupt Vector Address
\r
490 .equ UTXCaddr=$01e ; USART Transmit Complete Interrupt Vector Address
\r
491 .equ ADCCaddr=$020 ; ADC Interrupt Vector Address
\r
492 .equ ERDYaddr=$022 ; EEPROM Interrupt Vector Address
\r
493 .equ ACIaddr =$024 ; Analog Comparator Interrupt Vector Address
\r
494 .equ TWSIaddr=$026 ; Irq. vector address for Two-Wire Interface
\r
495 .equ SPMRaddr=$028 ; Store Program Memory Ready Interrupt Vector Address
\r