Integrated EEPROM
The internal EEPROM module of the MC9S12DP512 contains
4KB of memory. It consists of 1024 sectors with 4 bytes (32 bits) per
sector. For erasure, any single sector can be selected. Programming is
done by words (2 bytes). Read accesses can be made to any word or
byte.
After reset, the EEPROM module of the MC9S12DP512 is mapped
to address 0x0000. In the lower 1KB area (0x0000..0x03FF), control
registers take precedence over EEPROM. In order to use the full
EEPROM space, the EEPROM module can be relocated (see INITEE
control register).
In the following example, the EEPROM module is left at it's
default position. The initialization sequence just takes care for setting
up the EEPROM Clock Divider according to the quartz crystal frequen-
cy. The write function wrSectEETS() copies two words (4 bytes) from
source address src to EEPROM address dest. dest must be identical to
an EEPROM sector border (aligned 32 bit value). If the sector is not
erased (erased state = 0xFFFFFFFF), the routine will perform a sector
erase before writing to the sector.
The access functions readItemEETS() and writeItemEETS()
provide a more abstract way to deal with EEPROM contents. Instead of
using certain addresses, which must be part of the EEPROM address
range, these routines use abstract "item numbers", with each item consi-
sting of a variable amount of data (1 to 4 bytes).
S12compact
18