MOTOROLA
4-12
ON-CHIP MEMORY
M68HC11
REFERENCE MANUAL
EEPGM — EEPROM Programming Voltage Enable
This control bit enables the V
PP
power supply to the EEPROM logic for programming
and erase operations. When EEPGM is zero, V
PP
is off; when EEPGM is one, V
PP
is
on. A logic interlock mechanism prevents setting this bit unless EELAT was earlier
written to one.
4.3.5 Programming/Erasing Procedures
The following discussion and program segments demonstrate the various program-
ming and erase operations that can be performed on EEPROM locations. These pro-
gram segments are intended to be simple, straightforward examples of the sequences
needed for basic program and erase operations. There are no special restrictions on
the addressing modes used, and bit manipulation instructions may be used. Other op-
erations can be performed during programming and erasure provided these opera-
tions do not include reads from the EEPROM (the EEPROM is disconnected from the
read data bus during program and erase operations). The subroutine (DLY10) used in
these program segments is not shown but can be any set of instructions that takes 10
ms.
If several bytes of EEPROM are to be programmed, the EELAT bit can be left at one
for the entire block. After each byte is programmed, EEPGM is written to zero and EE-
LAT is left at one. The next EEPROM location is then written, and the EEPGM bit is
written back to one to execute the programming request.
4.3.5.1 Programming
During EEPROM programming, the ROW and BYTE bits are not used. If the E-clock
frequency is less than 2 MHz, the programming time may need to be increased, or the
CSEL bit in the OPTION register may have to be set to enable an on-chip RC oscillator
to drive the V
PP
charge pump. Since programming can only change ones to zeros in
the EEPROM, it is sometimes necessary to erase a byte to $FF in a separate opera-
tion before programming it to a new value. The following programming segment dem-
onstrates how to program an EEPROM byte:
* On entry, A = data to be programmed and X = an EEPROM address
"
"
LDAB
#$02
STAB
$103B
Set EELAT bit (EEPGM=0)
STAA
0,X
Store data to EEPROM address
LDAB
#$03
STAB
$103B
Set EEPGM bit (EELAT=1)
JSR
DLY10
Delay 10 mS
CLR
$103B
Turn off high voltage & set to read mode
"
"
PROG
4.3.5.2 Bulk Erase
The following program segment demonstrates how to bulk erase the 512-byte
EEPROM. The CONFIG register is not affected in this example.