📄 m406def.inc
字号:
.equ PINA0 = 0 ; Input Pins, Port A bit 0
.equ PINA1 = 1 ; Input Pins, Port A bit 1
.equ PINA2 = 2 ; Input Pins, Port A bit 2
.equ PINA3 = 3 ; Input Pins, Port A bit 3
.equ PINA4 = 4 ; Input Pins, Port A bit 4
.equ PINA5 = 5 ; Input Pins, Port A bit 5
.equ PINA6 = 6 ; Input Pins, Port A bit 6
.equ PINA7 = 7 ; Input Pins, Port A bit 7
; ***** PORTB ************************
; PORTB - Port B Data Register
.equ PORTB0 = 0 ; Port B Data Register bit 0
.equ PB0 = 0 ; For compatibility
.equ PORTB1 = 1 ; Port B Data Register bit 1
.equ PB1 = 1 ; For compatibility
.equ PORTB2 = 2 ; Port B Data Register bit 2
.equ PB2 = 2 ; For compatibility
.equ PORTB3 = 3 ; Port B Data Register bit 3
.equ PB3 = 3 ; For compatibility
.equ PORTB4 = 4 ; Port B Data Register bit 4
.equ PB4 = 4 ; For compatibility
.equ PORTB5 = 5 ; Port B Data Register bit 5
.equ PB5 = 5 ; For compatibility
.equ PORTB6 = 6 ; Port B Data Register bit 6
.equ PB6 = 6 ; For compatibility
.equ PORTB7 = 7 ; Port B Data Register bit 7
.equ PB7 = 7 ; For compatibility
; DDRB - Port B Data Direction Register
.equ DDB0 = 0 ; Port B Data Direction Register bit 0
.equ DDB1 = 1 ; Port B Data Direction Register bit 1
.equ DDB2 = 2 ; Port B Data Direction Register bit 2
.equ DDB3 = 3 ; Port B Data Direction Register bit 3
.equ DDB4 = 4 ; Port B Data Direction Register bit 4
.equ DDB5 = 5 ; Port B Data Direction Register bit 5
.equ DDB6 = 6 ; Port B Data Direction Register bit 6
.equ DDB7 = 7 ; Port B Data Direction Register bit 7
; PINB - Port B Input Pins
.equ PINB0 = 0 ; Port B Input Pins bit 0
.equ PINB1 = 1 ; Port B Input Pins bit 1
.equ PINB2 = 2 ; Port B Input Pins bit 2
.equ PINB3 = 3 ; Port B Input Pins bit 3
.equ PINB4 = 4 ; Port B Input Pins bit 4
.equ PINB5 = 5 ; Port B Input Pins bit 5
.equ PINB6 = 6 ; Port B Input Pins bit 6
.equ PINB7 = 7 ; Port B Input Pins bit 7
; ***** PORTC ************************
; PORTC - Port C Data Register
.equ PORTC0 = 0 ; Port C Data Register bit 0
.equ PC0 = 0 ; For compatibility
; ***** PORTD ************************
; PORTD - Data Register, Port D
.equ PORTD0 = 0 ;
.equ PD0 = 0 ; For compatibility
.equ PORTD1 = 1 ;
.equ PD1 = 1 ; For compatibility
; DDRD - Data Direction Register, Port D
.equ DDD0 = 0 ;
.equ DDD1 = 1 ;
; PIND - Input Pins, Port D
.equ PIND0 = 0 ;
.equ PIND1 = 1 ;
; ***** BOOT_LOAD ********************
; SPMCSR - Store Program Memory Control Register
.equ SPMEN = 0 ; Store Program Memory Enable
.equ PGERS = 1 ; Page Erase
.equ PGWRT = 2 ; Page Write
.equ BLBSET = 3 ; Boot Lock Bit Set
.equ RWWSRE = 4 ; Read While Write section read enable
.equ SIGRD = 5 ; Signature Row Read
.equ RWWSB = 6 ; Read While Write Section Busy
.equ SPMIE = 7 ; SPM Interrupt Enable
; ***** TWI **************************
; TWBCSR - TWI Bus Control and Status Register
.equ TWBCIP = 0 ; TWI Bus Connect/Disconnect Interrupt Polarity
.equ TWBDT0 = 1 ; TWI Bus Disconnect Time-out Period
.equ TWBDT1 = 2 ; TWI Bus Disconnect Time-out Period
.equ TWBCIE = 6 ; TWI Bus Connect/Disconnect Interrupt Enable
.equ TWBCIF = 7 ; TWI Bus Connect/Disconnect Interrupt Flag
; TWAMR - TWI (Slave) Address Mask Register
.equ TWAM0 = 1 ;
.equ TWAM1 = 2 ;
.equ TWAM2 = 3 ;
.equ TWAM3 = 4 ;
.equ TWAM4 = 5 ;
.equ TWAM5 = 6 ;
.equ TWAM6 = 7 ;
; TWBR - TWI Bit Rate register
.equ TWBR0 = 0 ;
.equ TWBR1 = 1 ;
.equ TWBR2 = 2 ;
.equ TWBR3 = 3 ;
.equ TWBR4 = 4 ;
.equ TWBR5 = 5 ;
.equ TWBR6 = 6 ;
.equ TWBR7 = 7 ;
; TWCR - TWI Control Register
.equ TWIE = 0 ; TWI Interrupt Enable
.equ TWEN = 2 ; TWI Enable Bit
.equ TWWC = 3 ; TWI Write Collition Flag
.equ TWSTO = 4 ; TWI Stop Condition Bit
.equ TWSTA = 5 ; TWI Start Condition Bit
.equ TWEA = 6 ; TWI Enable Acknowledge Bit
.equ TWINT = 7 ; TWI Interrupt Flag
; TWSR - TWI Status Register
.equ TWPS0 = 0 ; TWI Prescaler
.equ TWPS1 = 1 ; TWI Prescaler
.equ TWS3 = 3 ; TWI Status
.equ TWS4 = 4 ; TWI Status
.equ TWS5 = 5 ; TWI Status
.equ TWS6 = 6 ; TWI Status
.equ TWS7 = 7 ; TWI Status
; TWDR - TWI Data register
.equ TWD0 = 0 ; TWI Data Register Bit 0
.equ TWD1 = 1 ; TWI Data Register Bit 1
.equ TWD2 = 2 ; TWI Data Register Bit 2
.equ TWD3 = 3 ; TWI Data Register Bit 3
.equ TWD4 = 4 ; TWI Data Register Bit 4
.equ TWD5 = 5 ; TWI Data Register Bit 5
.equ TWD6 = 6 ; TWI Data Register Bit 6
.equ TWD7 = 7 ; TWI Data Register Bit 7
; TWAR - TWI (Slave) Address register
.equ TWGCE = 0 ; TWI General Call Recognition Enable Bit
.equ TWA0 = 1 ; TWI (Slave) Address register Bit 0
.equ TWA1 = 2 ; TWI (Slave) Address register Bit 1
.equ TWA2 = 3 ; TWI (Slave) Address register Bit 2
.equ TWA3 = 4 ; TWI (Slave) Address register Bit 3
.equ TWA4 = 5 ; TWI (Slave) Address register Bit 4
.equ TWA5 = 6 ; TWI (Slave) Address register Bit 5
.equ TWA6 = 7 ; TWI (Slave) Address register Bit 6
; ***** BANDGAP **********************
; BGCRR - Bandgap Calibration of Resistor Ladder
.equ BGCR0 = 0 ; Bandgap Calibration of Resistor Ladder Bit 0
.equ BGCR1 = 1 ; Bandgap Calibration of Resistor Ladder Bit 1
.equ BGCR2 = 2 ; Bandgap Calibration of Resistor Ladder Bit 2
.equ BGCR3 = 3 ; Bandgap Calibration of Resistor Ladder Bit 3
.equ BGCR4 = 4 ; Bandgap Calibration of Resistor Ladder Bit 4
.equ BGCR5 = 5 ; Bandgap Calibration of Resistor Ladder Bit 5
.equ BGCR6 = 6 ; Bandgap Calibration of Resistor Ladder Bit 6
.equ BGCR7 = 7 ; Bandgap Calibration of Resistor Ladder Bit 7
; BGCCR - Bandgap Calibration Register
.equ BGCC0 = 0 ; BG Calibration of PTAT Current Bit 0
.equ BGCC1 = 1 ; BG Calibration of PTAT Current Bit 1
.equ BGCC2 = 2 ; BG Calibration of PTAT Current Bit 2
.equ BGCC3 = 3 ; BG Calibration of PTAT Current Bit 3
.equ BGCC4 = 4 ; BG Calibration of PTAT Current Bit 4
.equ BGCC5 = 5 ; BG Calibration of PTAT Current Bit 5
.equ BGD = 7 ; Setting the BGD bit to one will disable the bandgap voltage reference. This bit must be cleared before enabling CC-ADC or V-ADC, and must remain unset while either ADC is enabled.
; ***** EEPROM ***********************
; EEDR - EEPROM Data Register
.equ EEDR0 = 0 ; EEPROM Data Register bit 0
.equ EEDR1 = 1 ; EEPROM Data Register bit 1
.equ EEDR2 = 2 ; EEPROM Data Register bit 2
.equ EEDR3 = 3 ; EEPROM Data Register bit 3
.equ EEDR4 = 4 ; EEPROM Data Register bit 4
.equ EEDR5 = 5 ; EEPROM Data Register bit 5
.equ EEDR6 = 6 ; EEPROM Data Register bit 6
.equ EEDR7 = 7 ; EEPROM Data Register bit 7
; EECR - EEPROM Control Register
.equ EERE = 0 ; EEPROM Read Enable
.equ EEPE = 1 ; EEPROM Programming Enable
.equ EEWE = EEPE ; For compatibility
.equ EEMPE = 2 ; EEPROM Master Programming Enable
.equ EEMWE = EEMPE ; For compatibility
.equ EERIE = 3 ; EEPROM Ready Interrupt Enable
.equ EEPM0 = 4 ; EEPROM Programming Mode Bits
.equ EEPM1 = 5 ; EEPROM Programming Mode Bits
; ***** LOCKSBITS ********************************************************
.equ LB1 = 0 ; Lock bit
.equ LB2 = 1 ; Lock bit
.equ BLB01 = 2 ; Boot Lock bit
.equ BLB02 = 3 ; Boot Lock bit
.equ BLB11 = 4 ; Boot lock bit
.equ BLB12 = 5 ; Boot lock bit
; ***** FUSES ************************************************************
; LOW fuse bits
.equ CKSEL = 0 ; Clock Selection
.equ SUT0 = 1 ; Select start-up time
.equ SUT1 = 2 ; Select start-up time
.equ BOOTRST = 3 ; Select reset vector
.equ BOOTSZ0 = 4 ; Select boot size
.equ BOOTSZ1 = 5 ; Select boot size
.equ EESAVE = 6 ; EEPROM memory is preserved through the chip erase
.equ WDTON = 7 ; Watchdog Timer Always On
; HIGH fuse bits
.equ JTAGEN = 0 ; Enable JTAG
.equ OCDEN = 1 ; Enable OCD
; ***** CPU REGISTER DEFINITIONS *****************************************
.def XH = r27
.def XL = r26
.def YH = r29
.def YL = r28
.def ZH = r31
.def ZL = r30
; ***** DATA MEMORY DECLARATIONS *****************************************
.equ FLASHEND = 0x4fff ; Note: Word address
.equ IOEND = 0x00ff
.equ SRAM_START = 0x0100
.equ SRAM_SIZE = 2048
.equ RAMEND = 0x08ff
.equ XRAMEND = 0x0000
.equ E2END = 0x01ff
.equ EEPROMEND = 0x01ff
.equ EEADRBITS = 9
#pragma AVRPART MEMORY PROG_FLASH 40960
#pragma AVRPART MEMORY EEPROM 512
#pragma AVRPART MEMORY INT_SRAM SIZE 2048
#pragma AVRPART MEMORY INT_SRAM START_ADDR 0x100
; ***** BOOTLOADER DECLARATIONS ******************************************
.equ NRWW_START_ADDR = 0x4800
.equ NRWW_STOP_ADDR = 0x4fff
.equ RWW_START_ADDR = 0x0
.equ RWW_STOP_ADDR = 0x47ff
.equ PAGESIZE = 64
.equ FIRSTBOOTSTART = 0x4f00
.equ SECONDBOOTSTART = 0x4e00
.equ THIRDBOOTSTART = 0x4c00
.equ FOURTHBOOTSTART = 0x4800
.equ SMALLBOOTSTART = FIRSTBOOTSTART
.equ LARGEBOOTSTART = FOURTHBOOTSTART
; ***** INTERRUPT VECTORS ************************************************
.equ BPINTaddr = 0x0002 ; Battery Protection Interrupt
.equ INT0addr = 0x0004 ; External Interrupt Request 0
.equ INT1addr = 0x0006 ; External Interrupt Request 1
.equ INT2addr = 0x0008 ; External Interrupt Request 2
.equ INT3addr = 0x000a ; External Interrupt Request 3
.equ PCI0addr = 0x000c ; Pin Change Interrupt 0
.equ PCI1addr = 0x000e ; Pin Change Interrupt 1
.equ WDTaddr = 0x0010 ; Watchdog Timeout Interrupt
.equ WUTaddr = 0x0012 ; Wakeup timer overflow
.equ OC1addr = 0x0014 ; Timer/Counter 1 Compare Match
.equ OVF1addr = 0x0016 ; Timer/Counter 1 Overflow
.equ OC0Aaddr = 0x0018 ; Timer/Counter0 Compare A Match
.equ OC0Baddr = 0x001a ; Timer/Counter0 Compare B Match
.equ OVF0addr = 0x001c ; Timer/Counter0 Overflow
.equ TWICDaddr = 0x001e ; Two-Wire Bus Connect/Disconnect
.equ TWIaddr = 0x0020 ; Two-Wire Serial Interface
.equ VADCaddr = 0x0022 ; Voltage ADC Conversion Complete
.equ CADICaddr = 0x0024 ; Coulomb Counter ADC Conversion Complete
.equ CADRCaddr = 0x0026 ; Coloumb Counter ADC Regular Current
.equ CADACaddr = 0x0028 ; Coloumb Counter ADC Accumulator
.equ ERDYaddr = 0x002a ; EEPROM Ready
.equ SPMRaddr = 0x002c ; Store Program Memory Ready
.equ INT_VECTORS_SIZE = 46 ; size in words
#endif /* _M406DEF_INC_ */
; ***** END OF FILE ******************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -