Blame | Last modification | View Log | Download | RSS feed
ifndef __regmx8inc__regmx8inc equ 1savelisting off ; no listing over this file;****************************************************************************;* *;* AS 1.42 - File REGMX8.INC *;* *;* Contains Bit & Register Definitions for ATmega48/88/168 *;* *;****************************************************************************;----------------------------------------------------------------------------; Chip ControlMCUCR port 0x35 ; MCU Control RegisterIVCE avrbit MCUCR,0 ; Interrupt Vector Change EnableIVSEL avrbit MCUCR,1 ; Interrupt Vector SelectMCUSR port 0x34 ; MCU Status RegisterPORF avrbit MCUSR,0 ; Power-On Reset OccuredEXTRF avrbit MCUSR,1 ; External Reset OccuredBORF avrbit MCUSR,2 ; brown Out Reset OccuredWDRF avrbit MCUSR,3 ; watchdog Reset OccuredSMCR port 0x33 ; Sleep Mode Control RegisterSE avrbit SMCR,0 ; Sleep Mode EnableSM0 avrbit SMCR,1 ; Sleep Mode SelectSM1 avrbit SMCR,2SM2 avrbit SMCR,3PRR sfr 0x64 ; Power Reduction RegisterPRADC avrbit PRR,0 ; Power Reduction ADCPRUSART0 avrbit PRR,1 ; Power Reduction USART0PRSPI0 avrbit PRR,2 ; Power Reduction Serial Peripheral Interface 0PRTIM1 avrbit PRR,3 ; Power Reduction Timer/Counter 1PRTIM0 avrbit PRR,5 ; Power Reduction Timer/Counter 0PRTIM2 avrbit PRR,6 ; Power Reduction Timer/Counter 2PRTWI0 avrbit PRR,7 ; Power Reduction Two Wire Interface 0OSCCAL sfr 0x66 ; Oscillator CalibrationCLKPR sfr 0x61 ; Clock Prescale RegisterCLKPS0 avrbit CLKPR,0 ; Clock Prescaler SelectCLKPS1 avrbit CLKPR,1CLKPS2 avrbit CLKPR,2CLKPS3 avrbit CLKPR,3CLKPCE avrbit CLKPR,7 ; Clock Prescaler Change EnableDWDR port 0x31 ; debugWire Data Register;----------------------------------------------------------------------------; EEPROM/Program Memory Accessinclude "eem2.inc"include "spmcsr37.inc"EEPM0 avrbit EECR,4 ; EEPROM Programming ModeEEPM1 avrbit EECR,5SIGRD avrbit SPMCSR,5 ; Signature Row Read;----------------------------------------------------------------------------; GPIOPUD avrbit MCUCR,4 ; Pull-Up DisablePINB port 0x03 ; Port B @ 0x03 (IO) ff.PINC port 0x06 ; Port C @ 0x06 (IO) ff.PIND port 0x09 ; Port D @ 0x09 (IO) ff.PCMSK0 sfr 0x6b ; Pin Change Mask Register 0PCMSK1 sfr 0x6c ; Pin Change Mask Register 1PCMSK2 sfr 0x6d ; Pin Change Mask Register 2PCICR sfr 0x68 ; Pin Change Interrupt Control RegisterPCIFR port 0x1b ; Pin Change Interrupt Flag RegisterGPIOR0 port 0x1e ; General Purpose I/O RegistersGPIOR1 port 0x2aGPIOR2 port 0x2b;----------------------------------------------------------------------------; Interrupt Vectorsif MOMCPUNAME="ATMEGA168"enumconf 2,codeenum INT0_vect=2 ; External Interrupt Request 0elseifenumconf 1,codeenum INT0_vect=1 ; External Interrupt Request 0endifnextenum INT1_vect ; External Interrupt Request 1nextenum PCINT0_vect ; Pin Change Interrupt Request 0nextenum PCINT1_vect ; Pin Change Interrupt Request 1nextenum PCINT2_vect ; Pin Change Interrupt Request 2nextenum WDT_vect ; watchdog Time-Out Interruptnextenum TIMER2_COMPA_vect ; Timer/Counter 2 Compare Match Anextenum TIMER2_COMPB_vect ; Timer/Counter 2 Compare Match Bnextenum TIMER2_OVF_vect ; Timer/Counter 2 Overflownextenum TIMER1_CAPT_vect ; Timer/Counter 1 Capturenextenum TIMER1_COMPA_vect ; Timer/Counter 1 Compare Match Anextenum TIMER1_COMPB_vect ; Timer/Counter 1 Compare Match Bnextenum TIMER1_OVF_vect ; Timer/Counter 1 Overflownextenum TIMER0_COMPA_vect ; Timer/Counter 0 Compare Match Anextenum TIMER0_COMPB_vect ; Timer/Counter 0 Compare Match Bnextenum TIMER0_OVF_vect ; Timer/Counter 0 Overflownextenum SPI_STC_vect ; SPI Serial Transfer Completenextenum USART_RX_vect ; UART Rx Completenextenum USART_UDRE_vect ; UART Data Register Emptynextenum USART_TX_vect ; UART Tx Completenextenum ADC_vect ; ADC Conversion Completenextenum EE_READY_vect ; EEPROM Readynextenum ANALOG_COMP_vect ; Analog Comparatornextenum TWI_vect ; Two-Wire Serial interfacenextenum SPM_READY_vect ; Store Program Memory Ready;----------------------------------------------------------------------------; External InterruptsEICRA sfr 0x69 ; External Interrupt Control Register AISC00 avrbit EICRA,0 ; External Interrupt 0 Sense ControlISC01 avrbit EICRA,1ISC10 avrbit EICRA,2 ; External Interrupt 1 Sense ControlISC11 avrbit EICRA,3EIMSK port 0x1d ; External Interrupt Mask RegisterINT0 avrbit EIMSK,0 ; Enable External Interrupt 0INT1 avrbit EIMSK,1 ; Enable External Interrupt 1EIFR port 0x1c ; External Interrupt Flag RegisterINTF0 avrbit EIFR,0 ; External Interrupt 0 OccuredINTF1 avrbit EIFR,1 ; External Interrupt 1 Occured;----------------------------------------------------------------------------; TimersGTCCR port 0x23 ; General Timer/Counter Control RegisterPSRSYNC avrbit GTCCR,0 ; Prescaler ResetPSRASY avrbit GTCCR,1 ; Prescaler Reset Timer/Counter2TSM avrbit GTCCR,7 ; Timer/Counter Synchronization ModeTCCR0A port 0x24 ; Timer/Counter 0 Control Register AWGM00 avrbit TCCR0A,0 ; Timer/Counter 0 Waveform Generation ModeWGM01 avrbit TCCR0A,1COM0B0 avrbit TCCR0A,4 ; Timer/Counter 0 Compare B ModeCOM0B1 avrbit TCCR0A,5COM0A0 avrbit TCCR0A,6 ; Timer/Counter 0 Compare A ModeCOM0A1 avrbit TCCR0A,7TCCR0B port 0x25 ; Timer/Counter 0 Control Register BCS00 avrbit TCCR0B,0 ; Timer/Counter 0 Clock SelectCS01 avrbit TCCR0B,1CS02 avrbit TCCR0B,2WGM02 avrbit TCCR0B,3 ; Timer/Counter 0 Waveform Generation ModeFOC0B avrbit TCCR0B,6 ; Timer/Counter 0 Force Output Compare BFOC0A avrbit TCCR0B,7 ; Timer/Counter 0 Force Output Compare ATCNT0 port 0x26 ; Timer/Counter 0OCR0A port 0x27 ; Timer/Counter 0 Output Compare Value AOCR0B port 0x28 ; Timer/Counter 0 Output Compare Value BTCCR1A sfr 0x80 ; Timer/Counter 1 Control Register AWGM10 avrbit TCCR1A,0 ; Timer/Counter 1 Waveform Generation ModeWGM11 avrbit TCCR1A,1COM1B0 avrbit TCCR1A,4 ; Timer/Counter 1 Compare Mode BCOM1B1 avrbit TCCR1A,5COM1A0 avrbit TCCR1A,6 ; Timer/Counter 1 Compare Mode ACOM1A1 avrbit TCCR1A,7TCCR1B sfr 0x81 ; Timer/Counter 1 Control Register BCS10 avrbit TCCR1B,0 ; Timer/Counter 1 Prescaler SettingCS11 avrbit TCCR1B,1CS12 avrbit TCCR1B,2WGM12 avrbit TCCR1B,3 ; Timer/Counter 1 Waveform Generation ModeWGM13 avrbit TCCR1B,4ICES1 avrbit TCCR1B,6 ; Timer/Counter 1 Capture Slope SelectionICNC1 avrbit TCCR1B,7 ; Timer/Counter 1 Capture Noise FilterTCCR1C sfr 0x82 ; Timer/Counter 1 Control Register CFOC1B avrbit TCCR1C,6 ; Timer/Counter 1 Force Output Compare BFOC1A avrbit TCCR1C,7 ; Timer/Counter 1 Force Output Compare ATCNT1L sfr 0x84 ; Timer/Counter 1 Value LSBTCNT1H sfr 0x85 ; Timer/Counter 1 Value MSBOCR1AL sfr 0x88 ; Timer/Counter 1 Output Compare Value A LSBOCR1AH sfr 0x89 ; Timer/Counter 1 Output Compare Value A MSBOCR1BL sfr 0x8a ; Timer/Counter 1 Output Compare Value B LSBOCR1BH sfr 0x8b ; Timer/Counter 1 Output Compare Value B MSBICR1L sfr 0x86 ; Timer/Counter 1 Input Capture Value LSBICR1H sfr 0x87 ; Timer/Counter 1 Input Capture Value MSBTCCR2A sfr 0xb0 ; Timer/Counter 2 Control Register AWGM20 avrbit TCCR2A,0 ; Timer/Counter 2 Waveform Generation ModeWGM21 avrbit TCCR2A,1COM2B0 avrbit TCCR2A,4 ; Timer/Counter 2 Compare Mode BCOM2B1 avrbit TCCR2A,5COM2A0 avrbit TCCR2A,6 ; Timer/Counter 2 Compare Mode BCOM2A1 avrbit TCCR2A,7TCCR2B sfr 0xb1 ; Timer/Counter 2 Control Register BCS20 avrbit TCCR2B,0CS21 avrbit TCCR2B,1CS22 avrbit TCCR2B,2 ; Timer/Counter 2 Prescaler SettingWGM22 avrbit TCCR2B,3FOC2B avrbit TCCR2B,6 ; Timer/Counter 2 Force Output Compare BFOC2A avrbit TCCR2B,7 ; Timer/Counter 2 Force Output Compare ATCNT2 sfr 0xb2 ; Timer/Counter 2 ValueOCR2A sfr 0xb3 ; Timer/Counter 2 Output Compare Value AOCR2B sfr 0xb4 ; Timer/Counter 2 Output Compare Value BTIMSK0 sfr 0x6e ; Timer/Counter 0 Interrupt Mask RegisterTOIE0 avrbit TIMSK0,0 ; Timer/Counter 0 Overflow Interrupt EnableOCIE0A avrbit TIMSK0,1 ; Timer/Counter 0 Output Compare Interrupt Enable AOCIE0B avrbit TIMSK0,2 ; Timer/Counter 0 Output Compare Interrupt Enable BTIMSK1 sfr 0x6f ; Timer/Counter 1 Interrupt Mask RegisterTOIE1 avrbit TIMSK1,0 ; Timer/Counter 1 Overflow Interrupt EnableOCIE1A avrbit TIMSK1,1 ; Timer/Counter 1 Output Compare Interrupt Enable AOCIE1B avrbit TIMSK1,2 ; Timer/Counter 1 Output Compare Interrupt Enable BICIE1 avrbit TIMSK1,5 ; Timer/Counter 1 Input Capture EventTIMSK2 sfr 0x70 ; Timer/Counter 2 Interrupt Mask RegisterTOIE2 avrbit TIMSK2,0 ; Timer/Counter 2 Overflow Interrupt EnableOCIE2A avrbit TIMSK2,1 ; Timer/Counter 2 Output Compare Interrupt Enable AOCIE2B avrbit TIMSK2,2 ; Timer/Counter 2 Output Compare Interrupt Enable BTIFR0 port 0x15 ; Timer/Counter 0 Interrupt Status RegisterTIFR1 port 0x16 ; Timer/Counter 1 Interrupt Status RegisterTIFR2 port 0x17 ; Timer/Counter 2 Interrupt Status RegisterASSR sfr 0xb6 ; Asynchronous Status RegisterTCR2BUB avrbit ASSR,0 ; Timer/Counter Control Register 2 B Update BusyTCR2AUB avrbit ASSR,1 ; Timer/Counter Control Register 2 A Update BusyOCR2BUB avrbit ASSR,2 ; Output Compare Register 2 B Update BusyOCR2AUB avrbit ASSR,3 ; Output Compare Register 2 A Update BusyTCN2UB avrbit ASSR,4 ; Timer/Counter 2 Update BusyAS2 avrbit ASSR,5 ; Asynchronous Timer/Counter 2EXCLK avrbit ASSR,6 ; Enable External Clock Input;----------------------------------------------------------------------------; Watchdog Timerinclude "wdme.inc";----------------------------------------------------------------------------; USART__USART0_SPI__ equ 1include "usartc0.inc";----------------------------------------------------------------------------; SPIinclude "spim02c.inc";----------------------------------------------------------------------------; TWIinclude "twimb8.inc";----------------------------------------------------------------------------; A/D Converterinclude "adcm78.inc";----------------------------------------------------------------------------; Analog Comparatorinclude "acm30.inc"restore ; re-enable listingendif ; __regmx8inc