Blame | Last modification | View Log | Download | RSS feed
ifndef reg166inc ; avoid multiple inclusionreg166inc equ 1savelisting off ; no listing over this file;****************************************************************************;* *;* AS 1.42 - Datei REG166.INC *;* *;* Contains SFR, Macro and Adress Definitions for 80C166/167 *;* *;****************************************************************************switch MOMCPUNAMEcase "80C166"_n equ 166case "80C167"_n equ 167case "80C167CS"_n equ 168elsecasefatal "wrong target: only 80C166, 80C167, or 80C167CS are supported!"endcaseif MOMPASS=1message "80C166/167 SFR Definitions (C) 1994 Alfred Arnold"message "Extensions for 80C167CS 2003 Marc Reibel"message "including SFPRs for \{MOMCPUNAME}"endif; Make things a bit shorter:DefIntBits macro BASE,adr,{NoExpand} ; Define Interrupt Register + its Bitstmpstr166 set "BASE"{tmpstr166}IC equ adr{tmpstr166}_GLVL bit {tmpstr166}IC.0 ; Group Priority{tmpstr166}_ILVL bit {tmpstr166}IC.2 ; Interrupt Priority{tmpstr166}IE bit {tmpstr166}IC.6 ; Interrupt Enable{tmpstr166}IR bit {tmpstr166}IC.7 ; Interrupt Flagendm;----------------------------------------------------------------------------; Special Registers:; Bit Addresses only for bit-addressable registers!; Only start bit for bit fields!if _n>=167SYSCON equ 0ff12h ; System ConfigurationXPERSHARE bit SYSCON.0 ; XBUS Peripherals also on External BUSVISIBLE bit SYSCON.1 ; XBUS Peripherals on Port PinsXPEN bit SYSCON.2 ; Enable XBUS PeripheralsBDRSTEN bit SYSCON.3 ; Bidirectional /RSTINOWDDIS bit SYSCON.4 ; Disable Oscillator WatchdogCSCFG bit SYSCON.6 ; Chip Select Mode (1=non-latched)WRCFG bit SYSCON.7 ; /WRL and /WRH instead of /WR and /BHECLKEN bit SYSCON.8 ; Emit System Clock on PinBYTDIS bit SYSCON.9 ; Block /BHE PinROMENT bit SYSCON.10 ; Enable Internal RomSGTDIS bit SYSCON.11 ; Disable Memory SegmentationROMS1 bit SYSCON.12 ; Position of Internal ROMif _n>=168SYSCON1 equ 0f1dch ; Sleep Mode for IDLE Instruction; (Bits 1 and 0); 00 Normal IDLE Mode; 01 SLEEP Mode; 11 SLEEP Mode, RTC and Oscillator offSYSCON2 equ 0f1d0h ; Clock GenerierationRCS bit SYSCON2.6 ; RTC Clock Source Main OscillatorSCS bit SYSCON2.7 ; SDD Clock Source Main OscillatorCLKLOCK bit SYSCON2.15 ; Main Oscillator/PLL stable?RSTCON equ 0f1e0h ; Reset Control RegisterIDCHIP equ 0f07ch ; Chip Identification RegisterIDMANUF equ 0f07ehIDMEM2 equ 0f076hIDMEM equ 0f07ahIDPROG equ 0f078hFOCON equ 0ffaah ; Clock Output Control RegisterSYSCON3 equ 0f1d4h ; Peripheral ManagementADCDIS bit SYSCON3.0 ; Disable ADCASC0DIS bit SYSCON3.1 ; Disable Asynchronous Serial PortSSCDIS bit SYSCON3.2 ; Disable Synchronous Serial PortGPTDIS bit SYSCON3.3 ; Disable GPT DisablesDFMDIS bit SYSCON3.4 ; Disable DFlash (only Variants with Flash)PFMDIS bit SYSCON3.5 ; Disable PFlash (only Variants with Flash)CC1DIS bit SYSCON3.6 ; Disable Capcom1CC2DIS bit SYSCON3.7 ; Disable Capcom2PWMDIS bit SYSCON3.9 ; Disable PWMCAN1DIS bit SYSCON3.13 ; Disable CAN1CAN2DIS bit SYSCON3.14 ; Disable CAN2PCDDIS bit SYSCON3.15 ; Disable Peripheral Clock SourceendifelseifSYSCON equ 0ff0chMCTC bit SYSCON.0 ; Memory Cycle LengthRWDC bit SYSCON.4 ; Write/Read DelayMTTC bit SYSCON.5 ; Tri State TimeBTYP bit SYSCON.6 ; State of EBC-PinsRDYEN bit SYSCON.12 ; Enable /READYendifROMEN bit SYSCON.10 ; Enable Internal ROMSTKSZ bit SYSCON.13 ; Maximum Size of Stackif _n>=167RP0H equ 0f108h ; System Startup Register (Read Only)CSSEL bit RP0H.1 ; Number of CS LinesSALSEL bit RP0H.3 ; Number of Address Lines, starting at A16endifPSW equ 0ff10h ; Flag RegisterN bit PSW.0 ; Negatives ResultC bit PSW.1 ; CarryV bit PSW.2 ; OverflowZ bit PSW.3 ; Zero ResultE bit PSW.4 ; End of TableMULIP bit PSW.5 ; Multiplication/Division interrupted ?USR0 bit PSW.6 ; User Definedif _n>=167HLDEN bit PSW.10 ; Enable HoldendifIEN bit PSW.11 ; Enable InterruptsILVL bit PSW.12 ; Interrupt Level currently being servedTFR equ 0ffach ; Trap Flag RegisterILLBUS bit TFR.0 ; Externer Bus used, but not configuredILLINA bit TFR.1 ; Code Access to Odd AddressILLOPA bit TFR.2 ; Word Access to Odd AddressPRTFLT bit TFR.3 ; Protection ViolationUNDOPC bit TFR.7 ; Undefined Maschine InstructionSTKUF bit TFR.13 ; Stack UnderflowSTKOF bit TFR.14 ; Stack OverflowNMI bit TFR.15 ; Non-Maskable Interruptif _n>=167EXICON equ 0f1c0h ; External Interrupt Controller Controlif _n>=168EXISEL equ 0f1dah ; External Interrupt Source RegisterendifEXI0ES bit EXICON.0 ; Edge-Triggered Interrupt 0EXI1ES bit EXICON.2 ; Edge-Triggered Interrupt 1EXI2ES bit EXICON.4 ; Edge-Triggered Interrupt 2EXI3ES bit EXICON.6 ; Edge-Triggered Interrupt 3EXI4ES bit EXICON.8 ; Edge-Triggered Interrupt 4EXI5ES bit EXICON.10 ; Edge-Triggered Interrupt 5EXI6ES bit EXICON.12 ; Edge-Triggered Interrupt 6EXI7ES bit EXICON.14 ; Edge-Triggered Interrupt 7endifDPP0 equ 0fe00h ; Paging RegisterDPP1 equ 0fe02hDPP2 equ 0fe04hDPP3 equ 0fe06hCSP equ 0fe08h ; Bits 16.. of Program CounterMDH equ 0fe0ch ; Multiplier/Divider RegisterMDL equ 0fe0ehMDC equ 0ff0eh ; Multiplier/Divider ControlMDRIU bit MDC.4 ; Multiplier in UseCP equ 0fe10h ; Register Context PointerSP equ 0fe12h ; Stack PointerSTKOV equ 0fe14h ; Upper Bound Stack PointerSTKUN equ 0fe16h ; Lower Bound Stack PointerZEROS equ 0ff1ch ; Constant All-ZerosONES equ 0ff1eh ; Constant All-Ones;----------------------------------------------------------------------------; Memory Interfaceif _n>=167ADDRSEL1 equ 0fe18h ; Address Decoder Register 1..4ADDRSEL2 equ 0fe1ahADDRSEL3 equ 0fe1chADDRSEL4 equ 0fe1ehBUSCON0 equ 0ff0ch ; Bus Configuration Register 0..4MCTC0 bit BUSCON0.0 ; Memory Cycle LengthRWDC0 bit BUSCON0.4 ; Write/Read DelayMTTC0 bit BUSCON0.5 ; Tri State ZeitBTYP0 bit BUSCON0.6 ; State of EBC PinsALECTL0 bit BUSCON0.9 ; ALE ExtensionBUSACT0 bit BUSCON0.10 ; Bus ActiveRDYEN0 bit BUSCON0.12 ; Enable /READYBUSCON1 equ 0ff14hMCTC1 bit BUSCON1.0 ; Memory Cycle LengthRWDC1 bit BUSCON1.4 ; Write/Read DelayMTTC1 bit BUSCON1.5 ; Tri State ZeitBTYP1 bit BUSCON1.6 ; State of EBC PinsALECTL1 bit BUSCON1.9 ; ALE ExtensionBUSACT1 bit BUSCON1.10 ; Bus ActiveRDYEN1 bit BUSCON1.12 ; Enable /READYCSREN1 bit BUSCON1.14 ; CS Pins Operating ModeCSWEN1 bit BUSCON1.15BUSCON2 equ 0ff16hMCTC2 bit BUSCON2.0 ; see aboveRWDC2 bit BUSCON2.4MTTC2 bit BUSCON2.5BTYP2 bit BUSCON2.6ALECTL2 bit BUSCON2.9BUSACT2 bit BUSCON2.10RDYEN2 bit BUSCON2.12CSREN2 bit BUSCON2.14CSWEN2 bit BUSCON2.15BUSCON3 equ 0ff18hMCTC3 bit BUSCON3.0RWDC3 bit BUSCON3.4MTTC3 bit BUSCON3.5BTYP3 bit BUSCON3.6ALECTL3 bit BUSCON3.9BUSACT3 bit BUSCON3.10RDYEN3 bit BUSCON3.12CSREN3 bit BUSCON3.14CSWEN3 bit BUSCON3.15BUSCON4 equ 0ff1ahMCTC4 bit BUSCON4.0RWDC4 bit BUSCON4.4MTTC4 bit BUSCON4.5BTYP4 bit BUSCON4.6ALECTL4 bit BUSCON4.9BUSACT4 bit BUSCON4.10RDYEN4 bit BUSCON4.12CSREN4 bit BUSCON4.14CSWEN4 bit BUSCON4.15if _n>=168XPERCON equ 0f024h ; XPeripheralsXPER0_M equ 0001h ; CAN1 (on after Reset)XPER1_M equ 0002h ; CAN2 (off after Reset)XPER10_M equ 0400h ; XRAM 2 KByte (on after Reset)XPER11_M equ 0800h ; XRAM 6 KByte (off after Reset)!!!XPER14_M equ 4000h ; 4KByte DFlash (off after Reset)!!!ISNC equ 0f1deh ; Interrupt Sub Node Control RegisterRTCIR bit ISNC.0 ; RTC Interrupt Request FlagRTCIE bit ISNC.1 ; Enable RTC InterruptPLLIR bit ISNC.2 ; PLL Interrupt Request FlagPLLIE bit ISNC.3 ; Enable PLL InterruptendifDefIntBits XP0,0f186h ; Interrupt Control Peripheral Device 0DefIntBits XP1,0f18eh ; Interrupt Control Peripheral Device 1DefIntBits XP2,0f196h ; Interrupt Control Peripheral Device 2; Flash Termination (Flash Variants)DefIntBits XP3,0f19eh ; Interrupt Control Peripheral Device 3endif;----------------------------------------------------------------------------; Ports:if _n>=167PICON equ 0f1c4hendifif _n>=167P0L equ 0ff00h ; Port 0 Data RegisterP0H equ 0ff02hDP0L equ 0f100h ; Port 0 Data Direction RegisterDP0H equ 0f102hif _n>=168POCON0H equ 0f082hPOCON0L equ 0f080hendifelseifP0 equ 0ff00hDP0 equ 0ff02hendifif _n>=167P1L equ 0ff04h ; Port 1 Data RegisterP1H equ 0ff06hDP1L equ 0f104h ; Port 1 Data Direction RegisterDP1H equ 0f106hif _n>=168P1DIDIS equ 0fea4h ; Port 1 Disable Digital-Inputendifif _n>=168POCON1H equ 0f086h ; Port 1 Output DriversPOCON1L equ 0f084hendifelseifP1 equ 0ff04hDP1 equ 0ff06hendifP2 equ 0ffc0h ; Port 2 Data RegisterDP2 equ 0ffc2h ; Port 2 Data Direction Registerif _n>=167ODP2 equ 0f1c2h ; Port 2 Open Drain SettingP2LIN bit PICON.0 ; Port 2 Input Threshold Bits 0..7P2HIN bit PICON.1 ; Port 2 Input Threshold Bits 8..15if _n>=168POCON20 equ 0f0aah ; Port 2 Dedicated Pin Control Register; /RSTOUT,CLKOUT/FOUT,ALE,; /WH,/RD,/BHE,/WHPOCON2 equ 0f088h ; Port 2 Output DriversendifendifP3 equ 0ffc4h ; Port 3 Data RegisterDP3 equ 0ffc6h ; Port 3 Data Direction Registerif _n>=167ODP3 equ 0f1c6h ; Port 3 Open Drain SettingP3LIN bit PICON.2 ; Port 3 Input Threshold Bits 0..7P3HIN bit PICON.3 ; Port 3 Input Threshold Bits 8..15if _n>=168POCON3 equ 0f08ah ; Port 3 Output Driversendifendifif _n>=167P4 equ 0ffc8h ; Port 4 Data RegisterDP4 equ 0ffcah ; Port 4 Data Direction RegisterODP4 equ 0f1cah ; Port 4 Open Drain SettingP4LIN bit PICON.4 ; Port 4 Input Thresholdif _n>=168POCON4 equ 0f08ch ; Port 4 Output DriversendifelseifP4 equ 0ff08hDP4 equ 0ff0ahendifP5 equ 0ffa2h ; Port 5 Data Register (input-only)if _n>=167P5DIDIS equ 0ffa4hendifif _n>=167P6 equ 0ffcch ; Port 6 Data RegisterDP6 equ 0ffceh ; Port 6 Data Direction RegisterODP6 equ 0f1ceh ; Port 6 Open Drain SettingP6LIN bit PICON.5 ; Port 6 Input Thresholdif _n>=168POCON6 equ 0f08eh ; Port 6 Output DriversendifP7 equ 0ffd0h ; Port 7 Data RegisterDP7 equ 0ffd2h ; Port 7 Data Direction RegisterODP7 equ 0f1d2h ; Port 7 Open Drain SettingP7LIN bit PICON.6 ; Port 7 Input Thresholdif _n>=168POCON7 equ 0f090h ; Port 7 Output DriversendifP8 equ 0ffd4h ; Port 8 Data RegisterDP8 equ 0ffd6h ; Port 8 Data Direction RegisterODP8 equ 0f1d6h ; Port 8 Open Drain SettingP8LIN bit PICON.7 ; Port 8 Input Thresholdif _n>=168POCON8 equ 0f092h ; Port 8 Output Driversendifendif;----------------------------------------------------------------------------; Timers:T0 equ 0fe50h ; CAPCOM Timer 0T0REL equ 0fe54h ; Timer 0 Reload RegisterT01CON equ 0ff50h ; Timer 0+1 Control RegisterT0I bit T01CON.0 ; Timer 0 Input SelectionT0M bit T01CON.3 ; Timer 0 ModeT0R bit T01CON.6 ; Timer 0 Start/StopT1I bit T01CON.8 ; Timer 1 Input SelectionT1M bit T01CON.11 ; Timer 1 ModeT1R bit T01CON.14 ; Timer 1 Start/StopDefIntBits T0,0ff9ch ; Timer 0 Interrupt ControlT1 equ 0fe52h ; CAPCOM Timer 1T1REL equ 0fe56h ; Timer 1 Reload RegisterDefIntBits T1,0ff9eh ; Timer 1 Interrupt ControlT2 equ 0fe40h ; Timer 2T2CON equ 0ff40h ; Timer 2 Control RegisterT2I bit T2CON.0 ; Timer 2 Input SelectionT2M bit T2CON.3 ; Timer 2 ModeT2R bit T2CON.6 ; Timer 2 Start/StopT2UD bit T2CON.7 ; Timer 2 Directionif _n>=167T2UDE bit T2CON.8 ; Timer 2 External Count Direction SelectionendifDefIntBits T2,0ff60h ; Timer 2 Interrupt ControlT3 equ 0fe42h ; Timer 3T3CON equ 0ff42h ; Timer 3 Control RegisterT3I bit T3CON.0 ; Timer 3 Input SelectionT3M bit T3CON.3 ; Timer 3 ModeT3R bit T3CON.6 ; Timer 3 Start/StopT3UD bit T3CON.7 ; Timer 3 DirectionT3UDE bit T3CON.8 ; Timer 3 External Count Direction SelectionT3OE bit T3CON.9 ; Timer 3 Enable OutputT3OTL bit T3CON.10 ; Timer 3 OverflowDefIntBits T3,0ff62h ; Timer 3 Interrupt ControlT4 equ 0fe44h ; Timer 4T4CON equ 0ff44h ; Timer 4 Control RegisterT4I bit T4CON.0 ; Timer 4 EingangssignalT4M bit T4CON.3 ; Timer 4 ModeT4R bit T4CON.6 ; Timer 4 Start/StopT4UD bit T4CON.7 ; Timer 4 Directionif _n>=167T4UDE bit T4CON.8 ; Timer 4 External Count Direction SelectionendifDefIntBits T4,0ff64h ; Timer 4 Interrupt ControlT5 equ 0fe46h ; Timer 5T5CON equ 0ff46h ; Timer 5 Control RegisterT5I bit T5CON.0 ; Timer 5 Input SelectionT5M bit T5CON.3 ; Timer 5 ModeT5R bit T5CON.6 ; Timer 5 Start/StopT5UD bit T5CON.7 ; Timer 5 Directionif _n>=167T5UDE bit T5CON.8 ; Timer 5 External Count Direction SelectionendifCI bit T5CON.12 ; CAPREL Input SelectionT5CLR bit T5CON.14 ; Timer 5 Clear upon CaptureT5SC bit T5CON.15 ; Timer 5 Capture EnableDefIntBits T5,0ff66h ; Timer 5 Interrupt ControlT6 equ 0fe48h ; Timer 6T6CON equ 0ff48h ; Control Register Timer 6T6I bit T6CON.0 ; Timer 6 Input Selectionif _n>=167T6M bit T6CON.3 ; Timer 6 ModeendifT6R bit T6CON.6 ; Timer 6 Start/StopT6UD bit T6CON.7 ; Timer 6 Count Directionif _n>=167T6UDE bit T6CON.8 ; Timer 6 External Count Direction SelectionendifT6OE bit T6CON.9 ; Timer 6 Enable OutputT6OTL bit T6CON.10 ; Timer 6 OverflowT6SR bit T6CON.15 ; Timer 6 ReloadDefIntBits T6,0ff68h ; Timer 6 Interrupt Controlif _n>=167T78CON equ 0ff20h ; Timer 7+8 Control RegisterT7 equ 0f050h ; Timer 7T7REL equ 0f054h ; Timer 7 Reload RegisterT7M bit T78CON.3 ; Timer 7 Timer/Counter ModeDefIntBits T7,0f17ah ; Timer 7 Interrupt ControlT8 equ 0f052h ; CAPCOM Timer 8T8REL equ 0f056h ; Timer 8 Reload RegisterT8M bit T78CON.11 ; Timer 8 Timer/Counter ModeDefIntBits T8,0f17ch ; Timer 8 Interrupt Controlif _n>=168T14 equ 0f0d2h ; RTC Timer 14T14REL equ 0f0d0h ; RTC Timer 14 Reload RegisterRTCL equ 0f0d4h ; RTC Low WordRTCH equ 0f0d6h ; RTC High Wordendifendif;-----------------------------------------------------------------------; Capture/Compare Unit:CAPREL equ 0fe4ah ; Capture/Reload RegisterCC0 equ 0fe80h ; CAPCOM RegistersCC1 equ 0fe82hCC2 equ 0fe84hCC3 equ 0fe86hCC4 equ 0fe88hCC5 equ 0fe8ahCC6 equ 0fe8chCC7 equ 0fe8ehCC8 equ 0fe90hCC9 equ 0fe92hCC10 equ 0fe94hCC11 equ 0fe96hCC12 equ 0fe98hCC13 equ 0fe9ahCC14 equ 0fe9chCC15 equ 0fe9ehif _n>=167CC16 equ 0fe60h ; Further CAPCOM RegistersCC17 equ 0fe62hCC18 equ 0fe64hCC19 equ 0fe66hCC20 equ 0fe68hCC21 equ 0fe6ahCC22 equ 0fe6chCC23 equ 0fe6ehCC24 equ 0fe70hCC25 equ 0fe72hCC26 equ 0fe74hCC27 equ 0fe76hCC28 equ 0fe78hCC29 equ 0fe7ahCC30 equ 0fe7chCC31 equ 0fe7ehendifCCM0 equ 0ff52h ; CAPCOM Mode RegisterCCMOD0 bit CCM0.0 ; CC0 Mode SelectionACC0 bit CCM0.3 ; CC0 assigned to Timer 0/1CCMOD1 bit CCM0.4 ; CC1 Mode SelectionACC1 bit CCM0.7 ; CC1 assigned to Timer 0/1CCMOD2 bit CCM0.8 ; CC2 Mode SelectionACC2 bit CCM0.11 ; CC2 assigned to Timer 0/1CCMOD3 bit CCM0.12 ; CC3 Mode SelectionACC3 bit CCM0.15 ; CC3 assigned to Timer 0/1CCM1 equ 0ff54hCCMOD4 bit CCM1.0 ; CC4 Mode SelectionACC4 bit CCM1.3 ; CC4 assigned to Timer 0/1CCMOD5 bit CCM1.4 ; CC5 Mode SelectionACC5 bit CCM1.7 ; CC5 assigned to Timer 0/1CCMOD6 bit CCM1.8 ; CC6 Mode SelectionACC6 bit CCM1.11 ; CC6 assigned to Timer 0/1CCMOD7 bit CCM1.12 ; CC7 Mode SelectionACC7 bit CCM1.15 ; CC7 assigned to Timer 0/1CCM2 equ 0ff56hCCMOD8 bit CCM2.0 ; CC8 Mode SelectionACC8 bit CCM2.3 ; CC8 assigned to Timer 0/1CCMOD9 bit CCM2.4 ; CC9 Mode SelectionACC9 bit CCM2.7 ; CC9 assigned to Timer 0/1CCMOD10 bit CCM2.8 ; CC10 Mode SelectionACC10 bit CCM2.11 ; CC10 assigned to Timer 0/1CCMOD11 bit CCM2.12 ; CC11 Mode SelectionACC11 bit CCM2.15 ; CC11 assigned to Timer 0/1CCM3 equ 0ff58hCCMOD12 bit CCM3.0 ; CC12 Mode SelectionACC12 bit CCM3.3 ; CC12 assigned to Timer 0/1CCMOD13 bit CCM3.4 ; CC13 Mode SelectionACC13 bit CCM3.7 ; CC13 assigned to Timer 0/1CCMOD14 bit CCM3.8 ; CC14 Mode SelectionACC14 bit CCM3.11 ; CC14 assigned to Timer 0/1CCMOD15 bit CCM3.12 ; CC15 Mode SelectionACC15 bit CCM3.15 ; CC15 assigned to Timer 0/1CCM4 equ 0ff22hCCMOD16 bit CCM4.0 ; CC16 Mode SelectionACC16 bit CCM4.3 ; CC16 assigned to Timer 0/1CCMOD17 bit CCM4.4 ; CC17 Mode SelectionACC17 bit CCM4.7 ; CC17 assigned to Timer 0/1CCMOD18 bit CCM4.8 ; CC18 Mode SelectionACC18 bit CCM4.11 ; CC18 assigned to Timer 0/1CCMOD19 bit CCM4.12 ; CC19 Mode SelectionACC19 bit CCM4.15 ; CC19 assigned to Timer 0/1CCM5 equ 0ff24hCCMOD20 bit CCM5.0 ; CC20 Mode SelectionACC20 bit CCM5.3 ; CC20 assigned to Timer 0/1CCMOD21 bit CCM5.4 ; CC21 Mode SelectionACC21 bit CCM5.7 ; CC21 assigned to Timer 0/1CCMOD22 bit CCM5.8 ; CC22 Mode SelectionACC22 bit CCM5.11 ; CC22 assigned to Timer 0/1CCMOD23 bit CCM5.12 ; CC23 Mode SelectionACC23 bit CCM5.15 ; CC23 assigned to Timer 0/1CCM6 equ 0ff26hCCMOD24 bit CCM6.0 ; CC24 Mode SelectionACC24 bit CCM6.3 ; CC24 assigned to Timer 0/1CCMOD25 bit CCM6.4 ; CC25 Mode SelectionACC25 bit CCM6.7 ; CC25 assigned to Timer 0/1CCMOD26 bit CCM6.8 ; CC26 Mode SelectionACC26 bit CCM6.11 ; CC26 assigned to Timer 0/1CCMOD27 bit CCM6.12 ; CC27 Mode SelectionACC27 bit CCM6.15 ; CC27 assigned to Timer 0/1CCM7 equ 0ff28hCCMOD28 bit CCM7.0 ; CC28 Mode SelectionACC28 bit CCM7.3 ; CC28 assigned to Timer 0/1CCMOD29 bit CCM7.4 ; CC29 Mode SelectionACC29 bit CCM7.7 ; CC29 assigned to Timer 0/1CCMOD30 bit CCM7.8 ; CC30 Mode SelectionACC30 bit CCM7.11 ; CC30 assigned to Timer 0/1CCMOD31 bit CCM7.12 ; CC31 Mode SelectionACC31 bit CCM7.15 ; CC31 assigned to Timer 0/1DefIntBits CR,0ff6ah ; CAPREL Interrupt Control RegisterDefIntBits CC0,0ff78h ; Interrupt Control CAPCOM ChannelsDefIntBits CC1,0ff7ahDefIntBits CC2,0ff7chDefIntBits CC3,0ff7ehDefIntBits CC4,0ff80hDefIntBits CC5,0ff82hDefIntBits CC6,0ff84hDefIntBits CC7,0ff86hDefIntBits CC8,0ff88hDefIntBits CC9,0ff8ahDefIntBits CC10,0ff8chDefIntBits CC11,0ff8ehDefIntBits CC12,0ff90hDefIntBits CC13,0ff92hDefIntBits CC14,0ff94hDefIntBits CC15,0ff96hif _n>=167DefIntBits CC16,0f160h ; Interrupt Control futher CAPCOM ChannelsDefIntBits CC17,0f162hDefIntBits CC18,0f164hDefIntBits CC19,0f166hDefIntBits CC20,0f168hDefIntBits CC21,0f16ahDefIntBits CC22,0f16chDefIntBits CC23,0f16ehDefIntBits CC24,0f170hDefIntBits CC25,0f172hDefIntBits CC26,0f174hDefIntBits CC27,0f176hDefIntBits CC28,0f178hDefIntBits CC29,0f184hDefIntBits CC30,0f18chDefIntBits CC31,0f194hendifPECC0 equ 0fec0h ; PEC Channel Control RegisterPECC1 equ 0fec2hPECC2 equ 0fec4hPECC3 equ 0fec6hPECC4 equ 0fec8hPECC5 equ 0fecahPECC6 equ 0fecchPECC7 equ 0fecehSRCP0 equ 0fce0h ; PEC Source RegisterSRCP1 equ 0fce4hSRCP2 equ 0fce8hSRCP3 equ 0fcechSRCP4 equ 0fcf0hSRCP5 equ 0fcf4hSRCP6 equ 0fcf8hSRCP7 equ 0fcfchDSTP0 equ 0fce2h ; PEC Destination RegisterDSTP1 equ 0fce6hDSTP2 equ 0fceahDSTP3 equ 0fceehDSTP4 equ 0fcf2hDSTP5 equ 0fcf6hDSTP6 equ 0fcfahDSTP7 equ 0fcfeh;----------------------------------------------------------------------------; Pulse Width Modulator:if _n>=167PP0 equ 0f038h ; PWM Period 0PT0 equ 0f030h ; PWM Counter 0PW0 equ 0fe30h ; PWM Pulse Width 0PP1 equ 0f03ah ; PWM Period 1PT1 equ 0f032h ; PWM Counter 1PW1 equ 0fe30h ; PWM Pulse Width 1PP2 equ 0f03ch ; PWM Period 2PT2 equ 0f034h ; PWM Counter 2PW2 equ 0fe30h ; PWM Pulse Width 2PP3 equ 0f03eh ; PWM Period 3PT3 equ 0f036h ; PWM Counter 3PW3 equ 0fe30h ; PWM Pulse Width 3PWMCON0 equ 0ff30h ; PWM Control Register 0PTR0 bit PWMCON0.0 ; PT0 RunPTR1 bit PWMCON0.1 ; PT1 RunPTR2 bit PWMCON0.2 ; PT2 RunPTR3 bit PWMCON0.3 ; PT3 RunPTI0 bit PWMCON0.4 ; PT0 Input SelectionPTI1 bit PWMCON0.5 ; PT1 Input SelectionPTI2 bit PWMCON0.6 ; PT2 Input SelectionPTI3 bit PWMCON0.7 ; PT3 Input SelectionPIE0 bit PWMCON0.8 ; PT0 Enable InterrupsPIE1 bit PWMCON0.9 ; PT1 Enable InterrupsPIE2 bit PWMCON0.10 ; PT2 Enable InterrupsPIE3 bit PWMCON0.11 ; PT3 Enable InterrupsPIR0 bit PWMCON0.12 ; PT0 Interrupt FlagPIR1 bit PWMCON0.13 ; PT1 Interrupt FlagPIR2 bit PWMCON0.14 ; PT2 Interrupt FlagPIR3 bit PWMCON0.15 ; PT3 Interrupt FlagPWMCON1 equ 0ff32h ; PWM Control Register 1PEN0 bit PWMCON1.0 ; PT0 Enable OutputPEN1 bit PWMCON1.1 ; PT1 Enable OutputPEN2 bit PWMCON1.2 ; PT2 Enable OutputPEN3 bit PWMCON1.3 ; PT3 Enable OutputPM0 bit PWMCON1.4 ; PT0 ModePM1 bit PWMCON1.5 ; PT1 ModePM2 bit PWMCON1.6 ; PT2 ModePM3 bit PWMCON1.7 ; PT3 ModePB01 bit PWMCON1.12 ; PT0&1 Burst ModePS2 bit PWMCON1.14 ; PT2 Single Shot ModePS3 bit PWMCON1.15 ; PT3 Single Shot ModeDefIntBits PWM,0f17eh ; PWM Interrupt Controlendif;----------------------------------------------------------------------------; A/D-Converter:ADDAT equ 0fea0h ; A/D-Converter Ergebnisif _n>=167ADDAT2 equ 0f0a0h ; A/D-Converter Ergebnis 2endifDefIntBits ADC,0ff98h ; A/D-Converter Interrupt Control for End of ConversionDefIntBits ADE,0ff9ah ; A/D-Converter Interrupt Control for ErrorsADCON equ 0ffa0h ; A/D-Converter Control RegisterADCH bit ADCON.0 ; A/D-Converter Channel SelectionADM bit ADCON.4 ; A/D-Converter ModeADST bit ADCON.7 ; Start A/D ConversionADBSY bit ADCON.8 ; A/D-Converter Busyif _n>=167ADWR bit ADCON.9 ; do not restart A/D-Converter before being readADCIN bit ADCON.10 ; A/D-Converter Channel Injection (??...)ADCRQ bit ADCON.11 ; A/D-Converter Channel Injection Requestedendif;----------------------------------------------------------------------------; Watchdog:WDT equ 0feaeh ; Watchdog CounterWDTCON equ 0ffaeh ; Watchdog Control RegisterWDTIN bit WDTCON.0 ; Watchdog Input frequencyWDTR bit WDTCON.1 ; Reset by Watchdogif _n>=167SWR bit WDTCON.2 ; Software ResetSHWR bit WDTCON.3 ; Short Hardware-ResetLHWR bit WDTCON.4 ; Long Hardware-ResetPONR bit WDTCON.5 ; Power On Reset (Flash Variants)endifWDTREL bit WDTCON.8 ; Reload Value Watchdog;----------------------------------------------------------------------------; Serielles:S0TBUF equ 0feb0h ; SIO0 Transmit RegisterS0RBUF equ 0feb2h ; SIO0 Receive RegisterS0BG equ 0feb4h ; SIO0 Baud Rate SelectionDefIntBits S0T,0ff6ch ; SIO0 Interrupt Control TransmitterDefIntBits S0R,0ff6eh ; SIO0 Interrupt Control ReceiverDefIntBits S0E,0ff70h ; SIO0 Interrupt Control Errorsif _n>=167DefIntBits S0TB,0f19ch ; Interrupt Control Transmit BufferendifS0CON equ 0ffb0h ; SIO0 Control RegisterS0M bit S0CON.0 ; SIO0 ModeS0STP bit S0CON.3 ; SIO0 Number of StopbitsS0REN bit S0CON.4 ; SIO0 Enable ReceiverS0PEN bit S0CON.5 ; SIO0 Enable ParityS0FEN bit S0CON.6 ; SIO0 Enable Frame CheckS0OEN bit S0CON.7 ; SIO0 Enable Overflow CheckS0PE bit S0CON.8 ; SIO0 Parity ErrorS0FE bit S0CON.9 ; SIO0 Framing ErrorS0OE bit S0CON.10 ; SIO0 Overflowif _n>=167S0ODD bit S0CON.12 ; SIO0 Odd ParityS0BRS bit S0CON.13 ; SIO0 Baud Rate FactorendifS0LB bit S0CON.14 ; SIO0 LoopbackS0R bit S0CON.15 ; SIO0 Enable Baud Rate Generatorif _n>=167SSCTB equ 0f0b0h ; SSC Transmit RegisterSSCRB equ 0f0b2h ; SSC Receive RegisterSSCBR equ 0f0b4h ; SSC Baud Rate SelectionDefIntBits SSCT,0ff72h ; SSC Interrupt Control TransmitterDefIntBits SSCR,0ff74h ; SSC Interrupt Control ReceiverDefIntBits SSCE,0ff76h ; SSC Interrupt Control ErrorsSSCCON equ 0ffb2h ; SSC Control RegisterSSCBM bit SSCCON.0 ; Word WidthSSCBC bit SSCCON.0 ; Number of BitsSSCHB bit SSCCON.4 ; Start Bit ControlSSCPH bit SSCCON.5 ; Clock PhaseSSCP0 bit SSCCON.6 ; Clock PolaritySSCTEN bit SSCCON.8 ; Enable Transmit ErrorsSSCTE bit SSCCON.8 ; Transmit Error FlagSSCREN bit SSCCON.9 ; Enable Receive ErrorsSSCRE bit SSCCON.9 ; Receive Errot FlagSSCPEN bit SSCCON.10 ; Enable Phase ErrorsSSCPE bit SSCCON.10 ; Phase Error FlagSSCBEN bit SSCCON.11 ; Enable Baud Rate ErrorsSSCBE bit SSCCON.11 ; Baud Rate Errors FlagSSCBSY bit SSCCON.12 ; SSC BusySSCMS bit SSCCON.14 ; SSC Operate as MasterSSCEN bit SSCCON.15 ; SSC EnableelseifS1TBUF equ 0feb8h ; SIO1 Transmit RegisterS1RBUF equ 0febah ; SIO1 Receive RegisterS1BG equ 0febch ; SIO1 Baud Rate SelectionDefIntBits S1T,0ff72h ; SIO1 Interrupt Control TransmitterDefIntBits S1R,0ff74h ; SIO1 Interrupt Control ReceiverDefIntBits S1E,0ff76h ; SIO1 Interrupt Control ErrorsS1CON equ 0ffb8h ; SIO1 Control RegisterS1M bit S1CON.0 ; SIO1 ModeS1STP bit S1CON.3 ; SIO1 Number of StopbitsS1REN bit S1CON.4 ; SIO1 Enable ReceiverS1PEN bit S1CON.5 ; SIO1 Enable ParityS1FEN bit S1CON.6 ; SIO1 Enable Frame CheckS1OEN bit S1CON.7 ; SIO1 Enable Overflow CheckS1PE bit S1CON.8 ; SIO1 Parity ErrorS1FE bit S1CON.9 ; SIO1 Framing ErrorS1OE bit S1CON.10 ; SIO1 OverflowS1LB bit S1CON.14 ; SIO1 LoopbackS1R bit S1CON.15 ; SIO1 Enable Baud Rate Generatorendif;----------------------------------------------------------------------------; Canbus 1 und 2if _n>=167;bitram; DefIntBits C1, 0ef02h ; CAN1 Interrupt Control RegisterC1BTR equ 0ef04h ; CAN1 Bit Timing RegisterC1CSR equ 0ef00h ; CAN1 Control/Status RegisterC1GMS equ 0ef06h ; CAN1 Global Mask ShortC1LAR1 equ 0ef14h ; CAN1 Lower Arbitration RegisterC1LAR2 equ 0ef24hC1LAR3 equ 0ef34hC1LAR4 equ 0ef44hC1LAR5 equ 0ef54hC1LAR6 equ 0ef64hC1LAR7 equ 0ef74hC1LAR8 equ 0ef84hC1LAR9 equ 0ef94hC1LAR10 equ 0efa4hC1LAR11 equ 0efb4hC1LAR12 equ 0efc4hC1LAR13 equ 0efd4hC1LAR14 equ 0efe4hC1LAR15 equ 0eff4hC1LGML equ 0ef0ah ; CAN1 Lower Global Mask Support LongC1LMLM equ 0ef0eh ; CAN1 Lower Mask Of Last MessageC1MCFG1 equ 0ef16h ; CAN1 Message Configuration RegisterC1MCFG2 equ 0ef26hC1MCFG3 equ 0ef36hC1MCFG4 equ 0ef46hC1MCFG5 equ 0ef56hC1MCFG6 equ 0ef66hC1MCFG7 equ 0ef76hC1MCFG8 equ 0ef86hC1MCFG9 equ 0ef96hC1MCFG10 equ 0efa6hC1MCFG11 equ 0efb6hC1MCFG12 equ 0efc6hC1MCFG13 equ 0efd6hC1MCFG14 equ 0efe6hC1MCFG15 equ 0eff6hC1MCR1 equ 0ef10h ; CAN1 Message Control RegisterC1MCR2 equ 0ef20hC1MCR3 equ 0ef30hC1MCR4 equ 0ef40hC1MCR5 equ 0ef50hC1MCR6 equ 0ef60hC1MCR7 equ 0ef70hC1MCR8 equ 0ef80hC1MCR9 equ 0ef90hC1MCR10 equ 0efa0hC1MCR11 equ 0efb0hC1MCR12 equ 0efc0hC1MCR13 equ 0efd0hC1MCR14 equ 0efe0hC1MCR15 equ 0eff0hC1PCIR equ 0ef02h ; CAN1 Port Control and Interrupt RegisterC1UAR1 equ 0ef12h ; CAN1 Upper Arbitration RegisterC1UAR2 equ 0ef22hC1UAR3 equ 0ef32hC1UAR4 equ 0ef42hC1UAR5 equ 0ef52hC1UAR6 equ 0ef62hC1UAR7 equ 0ef72hC1UAR8 equ 0ef82hC1UAR9 equ 0ef92hC1UAR10 equ 0efa2hC1UAR11 equ 0efb2hC1UAR12 equ 0efc2hC1UAR13 equ 0efd2hC1UAR14 equ 0efe2hC1UAR15 equ 0eff2hC1UGML equ 0ef08h ; CAN1 Upper Global Mask LongC1UMLM equ 0ef0ch ; CAN1 Upper Mask Of Last Messageendifif _n>=168;bitram; DefIntBits C2, 0ee02h ; CAN2 Interrupt Control RegisterC2BTR equ 0ee04h ; CAN2 Bit Timing RegisterC2CSR equ 0ee00h ; CAN2 Control Status RegisterC2GMS equ 0ee06h ; CAN2 Global Mask SupportC2LAR1 equ 0ee14h ; CAN2 Lower Arbitration RegisterC2LAR2 equ 0ee24hC2LAR3 equ 0ee34hC2LAR4 equ 0ee44hC2LAR5 equ 0ee54hC2LAR6 equ 0ee64hC2LAR7 equ 0ee74hC2LAR8 equ 0ee84hC2LAR9 equ 0ee94hC2LAR10 equ 0eea4hC2LAR11 equ 0eeb4hC2LAR12 equ 0eec4hC2LAR13 equ 0eed4hC2LAR14 equ 0eee4hC2LAR15 equ 0eef4hC2LGML equ 0ee0ah ; CAN2 Lower Global Mask SupportC2LMLM equ 0ee0eh ; CAN2 Lower Mask Of Last MessageC2MCFG1 equ 0ee16h ; CAN2 Message Configuration RegisterC2MCFG2 equ 0ee26hC2MCFG3 equ 0ee36hC2MCFG4 equ 0ee46hC2MCFG5 equ 0ee56hC2MCFG6 equ 0ee66hC2MCFG7 equ 0ee76hC2MCFG8 equ 0ee86hC2MCFG9 equ 0ee96hC2MCFG10 equ 0eea6hC2MCFG11 equ 0eeb6hC2MCFG12 equ 0eec6hC2MCFG13 equ 0eed6hC2MCFG14 equ 0eee6hC2MCFG15 equ 0eef6hC2MCR1 equ 0ee10h ; CAN2 Message Control RegisterC2MCR2 equ 0ee20hC2MCR3 equ 0ee30hC2MCR4 equ 0ee40hC2MCR5 equ 0ee50hC2MCR6 equ 0ee60hC2MCR7 equ 0ee70hC2MCR8 equ 0ee80hC2MCR9 equ 0ee90hC2MCR10 equ 0eea0hC2MCR11 equ 0eeb0hC2MCR12 equ 0eec0hC2MCR13 equ 0eed0hC2MCR14 equ 0eee0hC2MCR15 equ 0eef0hC2PCIR equ 0ee02h ; CAN2 Port Control And Interrupt RegisterC2UAR1 equ 0ee12h ; CAN2 Upper Arbitration RegisterC2UAR2 equ 0ee22hC2UAR3 equ 0ee32hC2UAR4 equ 0ee42hC2UAR5 equ 0ee52hC2UAR6 equ 0ee62hC2UAR7 equ 0ee72hC2UAR8 equ 0ee82hC2UAR9 equ 0ee92hC2UAR10 equ 0eea2hC2UAR11 equ 0eeb2hC2UAR12 equ 0eec2hC2UAR13 equ 0eed2hC2UAR14 equ 0eee2hC2UAR15 equ 0eef2hC2UGML equ 0ee08h ; CAN2 Upper Global Mask SupportC2UMLM equ 0ee0ch ; CAN2 Upper Mask Of Last Messageendif;----------------------------------------------------------------------------; Vectors / Special AddressesRESET equ 000h ; Reset EntryNMITRAP equ 008h ; NMI EntrySTOTRAP equ 010h ; Entry Stack OverflowSTUTRAP equ 018h ; Entry Stack UnderflowBTRAP equ 028h ; Undefined Opcode, Protection Fault,; Invalid Word Access, Invalid Instruction Address,; Invalid Bus AccessCC0INT equ 040h ; Interrupt Entry CAPCOMCC1INT equ 044hCC2INT equ 048hCC3INT equ 04chCC4INT equ 050hCC5INT equ 054hCC6INT equ 058hCC7INT equ 05chCC8INT equ 060hCC9INT equ 064hCC10INT equ 068hCC11INT equ 06chCC12INT equ 070hCC13INT equ 074hCC14INT equ 078hCC15INT equ 07chif _n>=167CC16INT equ 0c0hCC17INT equ 0c4hCC18INT equ 0c8hCC19INT equ 0cchCC20INT equ 0d0hCC21INT equ 0d4hCC22INT equ 0d8hCC23INT equ 0dchCC24INT equ 0e0hCC25INT equ 0e4hCC26INT equ 0e8hCC27INT equ 0echCC28INT equ 0f0hCC29INT equ 0110hCC30INT equ 0114hCC31INT equ 0118hendifT0INT equ 080h ; Interrupt Entry Timer 0T1INT equ 084h ; Interrupt Entry Timer 1T2INT equ 088h ; Interrupt Entry Timer 2T3INT equ 08ch ; Interrupt Entry Timer 3T4INT equ 090h ; Interrupt Entry Timer 4T5INT equ 094h ; Interrupt Entry Timer 5T6INT equ 098h ; Interrupt Entry Timer 6if _n>=167T7INT equ 0f4h ; Interrupt Entry Timer 7T8INT equ 0f8h ; Interrupt Entry Timer 8endifCRINT equ 09ch ; Interrupt Entry CAPRELADCINT equ 0a0h ; Interrupt Entry A/D Conversion CompleteADEINT equ 0a4h ; Interrupt Entry A/D Converter OverflowS0TINT equ 0a8h ; Interrupt Entry SIO0 Ready to SendS0RINT equ 0ach ; Interrupt Entry SIO0 Character ReceptionS0EINT equ 0b0h ; Interrupt Entry SIO0 ErrorS1TINT equ 0b4h ; Interrupt Entry SIO1 Ready to SendS1RINT equ 0b8h ; Interrupt Entry SIO1 Character ReceptionS1EINT equ 0bch ; Interrupt Entry SIO1 Errorif _n>=167S0TBINT equ 011ch ; ASC0 Transmit BufferPWMINT equ 0fch ; PWM Channels 0..3XP0INT equ 0100h ; CAN1XP1INT equ 0104h ; CAN2XP2INT equ 0108h ; Unassigned NodeXP3INT equ 010ch ; PLL,OWD,RTCendif;----------------------------------------------------------------------------; Memory Rangesswitch _ncase 168IRAM equ 0f200h ; Start of Internal RAMcase 167IRAM equ 0f600helsecaseIRAM equ 0fa00hendcaseIRAMEND equ 0fdffh ; End " " "BITRAM equ 0fd00h ; Start of Bit Addressable IRAM AreaBITRAMEND equ 0fdffh ; End " " " " "if _n>=167BITRAM1 equ 0f100h ; Start of Bit Addressable ESFR AreaBITRAM1END equ 0f1ffh ; End " " " " "BITRAM2 equ 0ff00h ; Start of Bit Addressable SFR AreaBITRAM2END equ 0ffffh ; End " " " " "endifif _n>=167PECPTR equ 0fce0h ; Start of PEC-Vektoren (optional)PECPTREND equ 0fcffh ; End " "elseifPECPTR equ 0fde0hPECPTREND equ 0fdffhendifSFRSTART equ 0fe00h ; Start of SFR-BereichSFREND equ 0ffffh ; End SFR-Bereichif _n>=167ESFRSTART equ 0f000h ; Start of Extended SFR AreaESFREND equ 0f1ffh ; End of Extended SFR AreaendifIROM equ 0 ; Start of Internal ROMif _n>=167IROMEND equ 07fffh ; End of Internal ROM (not fully populated)elseifIROMEND equ 01fffhendifif _n>=168EEPROM equ 08000h ; Start of Internal 4 KByte EEpromEEPROMEND equ 08fffh ; End of Internal EEpromendifif _n>=167XRAM1 equ 0e000h ; Internal XRAM 2 KByte StartXRAM1END equ 0e7ffh ; Internal XRAM 2 KByte Endendifif _n>=168XRAM2 equ 0c000h ; Internal XRAM 6 KByte StartXRAM2END equ 0d7ffh ; Internal XRAM 6 KByte Endendif;----------------------------------------------------------------------------; Bequemlichkeitsmakrosclr macro op ; Set Operand to 0and op,#0endmbchg macro op ; Invert Bitbmovn op,opendmdec macro op ; Decrementsub op,#1endminc macro op ; Incrementadd op,#1endmswapb macro op ; Swap Bytesror op,#8endm;----------------------------------------------------------------------------restore ; enable listing againendif ; reg166inc