XC2200 Derivatives
System Units (Vol. 1 of 2)
Memory Organization
User’s Manual
3-6
V2.1, 2008-08
MemoryX2K, V1.3
Special Function Registers
The functions of the CPU, the bus interface, the IO ports, and the on-chip peripherals of
the XC2200 are controlled via a number of Special Function Registers (SFRs).
All Special Function Registers can be addressed via indirect and long 16-bit addressing
modes. The (word) SFRs and their respective low bytes in the SFR/ESFR areas can be
addressed using an 8-bit offset together with an implicit base address. However, this
does not work
for the respective high bytes!
Note: Writing to any byte of an SFR causes the not addressed complementary byte to
be cleared.
The upper half of the SFR-area (00’FFFF
H
… 00’FF00
H
) and the ESFR-area (00’F1FF
H
… 00’F100
H
) is bit-addressable, so the respective control/status bits can be modified
directly or checked using bit addressing.
When accessing registers in the ESFR area using 8-bit addresses or direct bit
addressing, an Extend Register (EXTR) instruction is required beforehand to switch the
short addressing mechanism from the standard SFR area to the Extended SFR area.
This is not required for 16-bit and indirect addresses. The GPRs R15 … R0 are
duplicated, i.e. they are accessible within both register blocks via short 2-, 4-, or 8-bit
addresses without switching.
ESFR_SWITCH_EXAMPLE:
EXTR #4 ;Switch to ESFR area for next 4 instr.
MOV STMREL, #data16 ;STMREL uses 8-bit reg addressing
BFLDL STMCON, #mask, #data8 ;Bit addressing for bitfields
BSET WUCR.CLRTRG ;Bit addressing for single bits
MOV T8REL, R1 ;T8REL uses 16-bit mem address,
;R1 is duplicated into the ESFR space
;(EXTR is not required for this access)
;---- ;--------------- ;The scope of the EXTR #4 instruction …
;… ends here!
MOV T8REL, R1 ;T8REL uses 16-bit mem address,
;R1 is accessed via the SFR space
In order to minimize the use of the EXTR instructions the ESFR area mostly holds
registers which are mainly required for initialization and mode selection. Registers that
need to be accessed frequently are allocated to the standard SFR area, wherever
possible.
Note: The tools are equipped to monitor accesses to the ESFR area and will
automatically insert EXTR instructions, or issue a warning in case of missing or
excessive EXTR instructions.
Accesses to registers in the XSFR area use 16-bit addresses and require no specific
addressing modes or precautions.